@@ -1362,11 +1362,7 @@ PHP_FUNCTION(stream_set_blocking)
1362
1362
Z_PARAM_BOOL (block )
1363
1363
ZEND_PARSE_PARAMETERS_END ();
1364
1364
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 ));
1370
1366
}
1371
1367
1372
1368
/* }}} */
@@ -1407,11 +1403,7 @@ PHP_FUNCTION(stream_set_timeout)
1407
1403
}
1408
1404
#endif
1409
1405
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 ));
1415
1407
}
1416
1408
#endif /* HAVE_SYS_TIME_H || defined(PHP_WIN32) */
1417
1409
/* }}} */
@@ -1587,11 +1579,7 @@ PHP_FUNCTION(stream_is_local)
1587
1579
wrapper = php_stream_locate_url_wrapper (Z_STRVAL_P (zstream ), NULL , 0 );
1588
1580
}
1589
1581
1590
- if (!wrapper ) {
1591
- RETURN_FALSE ;
1592
- }
1593
-
1594
- RETURN_BOOL (wrapper -> is_url == 0 );
1582
+ RETURN_BOOL (wrapper && wrapper -> is_url == 0 );
1595
1583
}
1596
1584
/* }}} */
1597
1585
@@ -1604,11 +1592,7 @@ PHP_FUNCTION(stream_supports_lock)
1604
1592
PHP_Z_PARAM_STREAM (stream )
1605
1593
ZEND_PARSE_PARAMETERS_END ();
1606
1594
1607
- if (!php_stream_supports_lock (stream )) {
1608
- RETURN_FALSE ;
1609
- }
1610
-
1611
- RETURN_TRUE ;
1595
+ RETURN_BOOL (php_stream_supports_lock (stream ));
1612
1596
}
1613
1597
1614
1598
/* {{{ Check if a stream is a TTY. */
@@ -1635,15 +1619,13 @@ PHP_FUNCTION(stream_isatty)
1635
1619
1636
1620
#ifdef PHP_WIN32
1637
1621
/* 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 ));
1639
1623
#elif defined(HAVE_UNISTD_H )
1640
1624
/* Check if the file descriptor identifier is a terminal */
1641
- RETVAL_BOOL (isatty (fileno ));
1625
+ RETURN_BOOL (isatty (fileno ));
1642
1626
#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 );
1647
1629
#endif
1648
1630
}
1649
1631
@@ -1689,21 +1671,10 @@ PHP_FUNCTION(sapi_windows_vt100_support)
1689
1671
1690
1672
if (enable_is_null ) {
1691
1673
/* 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 {
1700
1676
/* 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));
1707
1678
}
1708
1679
}
1709
1680
#endif
0 commit comments