diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2019-11-07 01:10:52 +0100 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2019-11-07 17:56:26 +0100 |
commit | 662afc80f82dd42b1023d0ee424136e8b46cfb69 (patch) | |
tree | ed9226624e6c322b8822c8360e5c49ddff473e19 | |
parent | e710862f8ce205cadaccb1734beced48c8425940 (diff) | |
download | php-git-662afc80f82dd42b1023d0ee424136e8b46cfb69.tar.gz |
Remove PHP_SLEEP_NON_VOID as it is not useful anymore
-rwxr-xr-x | ext/standard/basic_functions.c | 8 | ||||
-rw-r--r-- | ext/standard/tests/general_functions/sleep_basic.phpt | 4 | ||||
-rw-r--r-- | main/php.h | 1 | ||||
-rw-r--r-- | win32/build/config.w32.h.in | 1 |
4 files changed, 5 insertions, 9 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 6135ace457..b11311b51c 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2972,7 +2972,7 @@ PHP_FUNCTION(flush) } /* }}} */ -/* {{{ proto void sleep(int seconds) +/* {{{ proto int sleep(int seconds) Delay for a given number of seconds */ PHP_FUNCTION(sleep) { @@ -2986,12 +2986,8 @@ PHP_FUNCTION(sleep) zend_value_error("Number of seconds must be greater than or equal to 0"); return; } -#ifdef PHP_SLEEP_NON_VOID - RETURN_LONG(php_sleep((unsigned int)num)); -#else - php_sleep((unsigned int)num); -#endif + RETURN_LONG(php_sleep((unsigned int)num)); } /* }}} */ diff --git a/ext/standard/tests/general_functions/sleep_basic.phpt b/ext/standard/tests/general_functions/sleep_basic.phpt index 0ef0e7c213..d3dd8c44f5 100644 --- a/ext/standard/tests/general_functions/sleep_basic.phpt +++ b/ext/standard/tests/general_functions/sleep_basic.phpt @@ -20,7 +20,7 @@ set_time_limit(20); $time_start = microtime(true); // Sleep for a while -sleep($sleeptime); +$result = sleep($sleeptime); // Test passes if sleeps for at least 98% of specified time $sleeplow = $sleeptime - ($sleeptime * 2 /100); @@ -29,6 +29,7 @@ $time_end = microtime(true); $time = $time_end - $time_start; echo "Thread slept for " . $time . " seconds\n"; +echo "Return value: " . $result . "\n"; if ($time >= $sleeplow) { echo "TEST PASSED\n"; @@ -40,5 +41,6 @@ if ($time >= $sleeplow) { --EXPECTF-- *** Testing sleep() : basic functionality *** Thread slept for %f seconds +Return value: 0 TEST PASSED ===DONE=== diff --git a/main/php.h b/main/php.h index b014379fda..48c78291d7 100644 --- a/main/php.h +++ b/main/php.h @@ -294,7 +294,6 @@ END_EXTERN_C() /* global variables */ #if !defined(PHP_WIN32) -#define PHP_SLEEP_NON_VOID #define php_sleep sleep extern char **environ; #endif /* !defined(PHP_WIN32) */ diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in index bfe57ed488..ca3a19b5ce 100644 --- a/win32/build/config.w32.h.in +++ b/win32/build/config.w32.h.in @@ -44,7 +44,6 @@ /* its in win32/time.c */ #define HAVE_USLEEP 1 #define HAVE_NANOSLEEP 1 -#define PHP_SLEEP_NON_VOID 1 #define HAVE_GETCWD 1 #define NEED_ISBLANK 1 |