@@ -2020,47 +2020,12 @@ static zend_result spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesys
2020
2020
}
2021
2021
} /* }}} */
2022
2022
2023
- static bool spl_filesystem_file_is_empty_line (spl_filesystem_object * intern ) /* {{{ */
2024
- {
2025
- if (intern -> u .file .current_line ) {
2026
- return intern -> u .file .current_line_len == 0 ;
2027
- } else if (!Z_ISUNDEF (intern -> u .file .current_zval )) {
2028
- ZEND_ASSERT (Z_TYPE (intern -> u .file .current_zval ) == IS_ARRAY );
2029
- /* TODO Figure out when this branch can happen... */
2030
- if (SPL_HAS_FLAG (intern -> flags , SPL_FILE_OBJECT_READ_CSV )
2031
- && zend_hash_num_elements (Z_ARRVAL (intern -> u .file .current_zval )) == 1 ) {
2032
- ZEND_ASSERT (false && "Can this happen?" );
2033
- uint32_t idx = 0 ;
2034
- zval * first ;
2035
-
2036
- if (HT_IS_PACKED (Z_ARRVAL (intern -> u .file .current_zval ))) {
2037
- while (Z_ISUNDEF (Z_ARRVAL (intern -> u .file .current_zval )-> arPacked [idx ])) {
2038
- idx ++ ;
2039
- }
2040
- first = & Z_ARRVAL (intern -> u .file .current_zval )-> arPacked [idx ];
2041
- ZEND_ASSERT (Z_TYPE_P (first ) == IS_STRING );
2042
- } else {
2043
- while (Z_ISUNDEF (Z_ARRVAL (intern -> u .file .current_zval )-> arData [idx ].val )) {
2044
- idx ++ ;
2045
- }
2046
- first = & Z_ARRVAL (intern -> u .file .current_zval )-> arData [idx ].val ;
2047
- ZEND_ASSERT (Z_TYPE_P (first ) == IS_STRING );
2048
- }
2049
- return Z_STRLEN_P (first ) == 0 ;
2050
- }
2051
- return zend_hash_num_elements (Z_ARRVAL (intern -> u .file .current_zval )) == 0 ;
2052
- } else {
2053
- return 1 ;
2054
- }
2055
- }
2056
- /* }}} */
2057
-
2058
2023
/* Call to this function reads a line in a "silent" fashion and does not throw an exception */
2059
2024
static zend_result spl_filesystem_file_read_line (zval * this_ptr , spl_filesystem_object * intern ) /* {{{ */
2060
2025
{
2061
2026
zend_result ret = spl_filesystem_file_read_line_ex (this_ptr , intern );
2062
2027
2063
- while (SPL_HAS_FLAG (intern -> flags , SPL_FILE_OBJECT_SKIP_EMPTY ) && ret == SUCCESS && spl_filesystem_file_is_empty_line (intern )) {
2028
+ while (SPL_HAS_FLAG (intern -> flags , SPL_FILE_OBJECT_SKIP_EMPTY ) && ret == SUCCESS && is_line_empty (intern )) {
2064
2029
spl_filesystem_file_free_line (intern );
2065
2030
ret = spl_filesystem_file_read_line_ex (this_ptr , intern );
2066
2031
}
0 commit comments