com php-src: simplify and generalize crossplatform parts: ext/standard/streamsfuncs.c
| From: | Anatol Belski | Date: | Thu, 13 Apr 2017 11:04:55 +0000 |
| Subject: | com php-src: simplify and generalize crossplatform parts: ext/standard/streamsfuncs.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97576@lists.php.net to get a copy of this message | ||
Commit: df3e1a16fe838d513122e36f85c10ed2f8fe9a69
Author: Anatol Belski <ab@php.net> Thu, 13 Apr 2017 13:04:55 +0200
Parents: 858ad8a59853bddb1612a9958bfe8b792c4a81ce
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=df3e1a16fe838d513122e36f85c10ed2f8fe9a69
Log:
simplify and generalize crossplatform parts
Changed paths:
M ext/standard/streamsfuncs.c
Diff:
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index e74d900..8e225f3 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -1632,36 +1632,23 @@ PHP_FUNCTION(stream_isatty)
if (php_stream_can_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT) == SUCCESS) {
php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT, (void*)&fileno, 0);
- }
- else if (php_stream_can_cast(stream, PHP_STREAM_AS_FD) == SUCCESS) {
+ } else if (php_stream_can_cast(stream, PHP_STREAM_AS_FD) == SUCCESS) {
php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)&fileno, 0);
- }
- else {
+ } else {
RETURN_FALSE;
}
#ifdef PHP_WIN32
/* Check if the Windows standard handle is redirected to file */
- if (php_win32_console_fileno_is_console(fileno)) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
+ RETVAL_BOOL(php_win32_console_fileno_is_console(fileno));
#elif HAVE_UNISTD_H
/* Check if the file descriptor identifier is a terminal */
- if (isatty(fileno)) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
+ RETVAL_BOOL(isatty(fileno));
#else
- zend_stat_t stat = {0};
- if (zend_fstat(fileno, &stat) == 0 && (stat.st_mode & /*S_IFMT*/0170000) ==
/*S_IFCHR*/0020000) {
- RETURN_TRUE;
+ {
+ zend_stat_t stat = {0};
+ RETVAL_BOOL(zend_fstat(fileno, &stat) == 0 && (stat.st_mode & /*S_IFMT*/0170000)
== /*S_IFCHR*/0020000);
}
- RETURN_FALSE;
#endif
}