From 662afc80f82dd42b1023d0ee424136e8b46cfb69 Mon Sep 17 00:00:00 2001 From: =?utf8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Thu, 7 Nov 2019 01:10:52 +0100 Subject: [PATCH] Remove PHP_SLEEP_NON_VOID as it is not useful anymore --- ext/standard/basic_functions.c | 8 ++------ ext/standard/tests/general_functions/sleep_basic.phpt | 4 +++- main/php.h | 1 - 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 -- 2.50.1