com php-src: Remove PHP_SLEEP_NON_VOID as it is n ot useful anymore: ext/standard/basic_functions.c
ext/standard/tests/general_functions/sleep_basic.phpt main/php.h win32/build/config.w32.h.in
| From: | Máté Kocsis | Date: | Thu, 07 Nov 2019 16:56:26 +0000 |
| Subject: | com php-src: Remove PHP_SLEEP_NON_VOID as it is n ot useful anymore: ext/standard/basic_functions.c ext/standard/tests/general_functions/sleep_basic.phpt main/php.h win32/build/config.w32.h.in |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109217@lists.php.net to get a copy of this message | ||
Commit: 662afc80f82dd42b1023d0ee424136e8b46cfb69
Author: Máté Kocsis <kocsismate@woohoolabs.com> Thu, 7 Nov 2019 01:10:52 +0100
Parents: e710862f8ce205cadaccb1734beced48c8425940
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=662afc80f82dd42b1023d0ee424136e8b46cfb69
Log:
Remove PHP_SLEEP_NON_VOID as it is not useful anymore
Changed paths:
M ext/standard/basic_functions.c
M ext/standard/tests/general_functions/sleep_basic.phpt
M main/php.h
M win32/build/config.w32.h.in
Diff:
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 6135ace4575..b11311b51c0 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 0ef0e7c2131..d3dd8c44f5a 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 b014379fda1..48c78291d7a 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 bfe57ed488e..ca3a19b5ce3 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