mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
SPL: minor refactoring (#8341)
Use more appropriate types and return macros
This commit is contained in:
parent
8233e06109
commit
cfc38a6014
8 changed files with 24 additions and 32 deletions
|
@ -1304,7 +1304,7 @@ PHP_METHOD(ArrayObject, count)
|
|||
RETURN_LONG(spl_array_object_count_elements_helper(intern));
|
||||
} /* }}} */
|
||||
|
||||
static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) /* {{{ */
|
||||
static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, size_t fname_len, int use_arg) /* {{{ */
|
||||
{
|
||||
spl_array_object *intern = Z_SPLARRAY_P(ZEND_THIS);
|
||||
HashTable **ht_ptr = spl_array_get_hash_table_ptr(intern);
|
||||
|
@ -1393,12 +1393,12 @@ PHP_METHOD(ArrayIterator, current)
|
|||
}
|
||||
|
||||
if ((entry = zend_hash_get_current_data_ex(aht, spl_array_get_pos_ptr(aht, intern))) == NULL) {
|
||||
return;
|
||||
RETURN_NULL();
|
||||
}
|
||||
if (Z_TYPE_P(entry) == IS_INDIRECT) {
|
||||
entry = Z_INDIRECT_P(entry);
|
||||
if (Z_TYPE_P(entry) == IS_UNDEF) {
|
||||
return;
|
||||
RETURN_NULL();
|
||||
}
|
||||
}
|
||||
RETURN_COPY_DEREF(entry);
|
||||
|
@ -1490,7 +1490,7 @@ PHP_METHOD(RecursiveArrayIterator, getChildren)
|
|||
}
|
||||
|
||||
if ((entry = zend_hash_get_current_data_ex(aht, spl_array_get_pos_ptr(aht, intern))) == NULL) {
|
||||
return;
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (Z_TYPE_P(entry) == IS_INDIRECT) {
|
||||
|
@ -1500,7 +1500,7 @@ PHP_METHOD(RecursiveArrayIterator, getChildren)
|
|||
ZVAL_DEREF(entry);
|
||||
if (Z_TYPE_P(entry) == IS_OBJECT) {
|
||||
if ((intern->ar_flags & SPL_ARRAY_CHILD_ARRAYS_ONLY) != 0) {
|
||||
return;
|
||||
RETURN_NULL();
|
||||
}
|
||||
if (instanceof_function(Z_OBJCE_P(entry), Z_OBJCE_P(ZEND_THIS))) {
|
||||
RETURN_OBJ_COPY(Z_OBJ_P(entry));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue