@@ -1362,11 +1362,7 @@ PHP_FUNCTION(stream_set_blocking)
13621362 Z_PARAM_BOOL (block )
13631363 ZEND_PARSE_PARAMETERS_END ();
13641364
1365- if (php_stream_set_option (stream , PHP_STREAM_OPTION_BLOCKING , block , NULL ) == -1 ) {
1366- RETURN_FALSE ;
1367- }
1368-
1369- RETURN_TRUE ;
1365+ RETURN_BOOL (-1 != php_stream_set_option (stream , PHP_STREAM_OPTION_BLOCKING , block , NULL ));
13701366}
13711367
13721368/* }}} */
@@ -1407,11 +1403,7 @@ PHP_FUNCTION(stream_set_timeout)
14071403 }
14081404#endif
14091405
1410- if (PHP_STREAM_OPTION_RETURN_OK == php_stream_set_option (stream , PHP_STREAM_OPTION_READ_TIMEOUT , 0 , & t )) {
1411- RETURN_TRUE ;
1412- }
1413-
1414- RETURN_FALSE ;
1406+ RETURN_BOOL (PHP_STREAM_OPTION_RETURN_OK == php_stream_set_option (stream , PHP_STREAM_OPTION_READ_TIMEOUT , 0 , & t ));
14151407}
14161408#endif /* HAVE_SYS_TIME_H || defined(PHP_WIN32) */
14171409/* }}} */
@@ -1587,11 +1579,7 @@ PHP_FUNCTION(stream_is_local)
15871579 wrapper = php_stream_locate_url_wrapper (Z_STRVAL_P (zstream ), NULL , 0 );
15881580 }
15891581
1590- if (!wrapper ) {
1591- RETURN_FALSE ;
1592- }
1593-
1594- RETURN_BOOL (wrapper -> is_url == 0 );
1582+ RETURN_BOOL (wrapper && wrapper -> is_url == 0 );
15951583}
15961584/* }}} */
15971585
@@ -1604,11 +1592,7 @@ PHP_FUNCTION(stream_supports_lock)
16041592 PHP_Z_PARAM_STREAM (stream )
16051593 ZEND_PARSE_PARAMETERS_END ();
16061594
1607- if (!php_stream_supports_lock (stream )) {
1608- RETURN_FALSE ;
1609- }
1610-
1611- RETURN_TRUE ;
1595+ RETURN_BOOL (php_stream_supports_lock (stream ));
16121596}
16131597
16141598/* {{{ Check if a stream is a TTY. */
@@ -1635,15 +1619,13 @@ PHP_FUNCTION(stream_isatty)
16351619
16361620#ifdef PHP_WIN32
16371621 /* Check if the Windows standard handle is redirected to file */
1638- RETVAL_BOOL (php_win32_console_fileno_is_console (fileno ));
1622+ RETURN_BOOL (php_win32_console_fileno_is_console (fileno ));
16391623#elif defined(HAVE_UNISTD_H )
16401624 /* Check if the file descriptor identifier is a terminal */
1641- RETVAL_BOOL (isatty (fileno ));
1625+ RETURN_BOOL (isatty (fileno ));
16421626#else
1643- {
1644- zend_stat_t stat = {0 };
1645- RETVAL_BOOL (zend_fstat (fileno , & stat ) == 0 && (stat .st_mode & /*S_IFMT*/ 0170000 ) == /*S_IFCHR*/ 0020000 );
1646- }
1627+ zend_stat_t stat = {0 };
1628+ RETURN_BOOL (zend_fstat (fileno , & stat ) == 0 && (stat .st_mode & /*S_IFMT*/ 0170000 ) == /*S_IFCHR*/ 0020000 );
16471629#endif
16481630}
16491631
@@ -1689,21 +1671,10 @@ PHP_FUNCTION(sapi_windows_vt100_support)
16891671
16901672 if (enable_is_null ) {
16911673 /* Check if the Windows standard handle has VT100 control codes enabled */
1692- if (php_win32_console_fileno_has_vt100 (fileno )) {
1693- RETURN_TRUE ;
1694- }
1695- else {
1696- RETURN_FALSE ;
1697- }
1698- }
1699- else {
1674+ RETURN_BOOL (php_win32_console_fileno_has_vt100 (fileno ));
1675+ } else {
17001676 /* Enable/disable VT100 control codes support for the specified Windows standard handle */
1701- if (php_win32_console_fileno_set_vt100 (fileno , enable ? TRUE : FALSE)) {
1702- RETURN_TRUE ;
1703- }
1704- else {
1705- RETURN_FALSE ;
1706- }
1677+ RETURN_BOOL (php_win32_console_fileno_set_vt100 (fileno , enable ? TRUE : FALSE));
17071678 }
17081679}
17091680#endif
0 commit comments