summaryrefslogtreecommitdiff
path: root/ext/sockets/sockets.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-12-07 19:24:55 +0300
committerDmitry Stogov <dmitry@zend.com>2017-12-07 19:24:55 +0300
commit6a9d2b2190923bfbc7b7caa1462ba95965a1b991 (patch)
tree26d1695b07a29a873e5fcd74cd4af47c89454f78 /ext/sockets/sockets.c
parentc890d469fab27500f0fa1070dccb16b36aa8be76 (diff)
downloadphp-git-6a9d2b2190923bfbc7b7caa1462ba95965a1b991.tar.gz
Cleanup type conversion
Diffstat (limited to 'ext/sockets/sockets.c')
-rw-r--r--ext/sockets/sockets.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index f963b8f343..e583ef6a02 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -940,29 +940,18 @@ PHP_FUNCTION(socket_select)
/* If seconds is not set to null, build the timeval, else we wait indefinitely */
if (sec != NULL) {
- zval tmp;
-
- if (Z_TYPE_P(sec) != IS_LONG) {
- tmp = *sec;
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
- sec = &tmp;
- }
+ zend_long s = zval_get_long(sec);
/* Solaris + BSD do not like microsecond values which are >= 1 sec */
if (usec > 999999) {
- tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000);
+ tv.tv_sec = s + (usec / 1000000);
tv.tv_usec = usec % 1000000;
} else {
- tv.tv_sec = Z_LVAL_P(sec);
+ tv.tv_sec = s;
tv.tv_usec = usec;
}
tv_p = &tv;
-
- if (sec == &tmp) {
- zval_dtor(&tmp);
- }
}
retval = select(max_fd+1, &rfds, &wfds, &efds, tv_p);