Skip to content

Commit db0db22

Browse files
committed
Use zend_result/bool in spl_array.c
1 parent 2fa33d1 commit db0db22

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

ext/spl/spl_array.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static inline bool spl_array_is_object(spl_array_object *intern) /* {{{ */
115115
}
116116
/* }}} */
117117

118-
static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht);
118+
static zend_result spl_array_skip_protected(spl_array_object *intern, HashTable *aht);
119119

120120
static zend_never_inline void spl_array_create_ht_iter(HashTable *ht, spl_array_object* intern) /* {{{ */
121121
{
@@ -552,7 +552,10 @@ static void spl_array_unset_dimension(zend_object *object, zval *offset) /* {{{
552552
spl_array_unset_dimension_ex(1, object, offset);
553553
} /* }}} */
554554

555-
static int spl_array_has_dimension_ex(bool check_inherited, zend_object *object, zval *offset, int check_empty) /* {{{ */
555+
/* check_empty can take value 0, 1, or 2
556+
* 0/1 are used as normal boolean, but 2 is used for the case when this function is called from
557+
* the offsetExists() method, in which case it needs to report the offset exist even if the value is null */
558+
static bool spl_array_has_dimension_ex(bool check_inherited, zend_object *object, zval *offset, int check_empty) /* {{{ */
556559
{
557560
spl_array_object *intern = spl_array_from_obj(object);
558561
zval rv, *value = NULL, *tmp;
@@ -873,7 +876,7 @@ static int spl_array_compare_objects(zval *o1, zval *o2) /* {{{ */
873876
return result;
874877
} /* }}} */
875878

876-
static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht) /* {{{ */
879+
static zend_result spl_array_skip_protected(spl_array_object *intern, HashTable *aht) /* {{{ */
877880
{
878881
zend_string *string_key;
879882
zend_ulong num_key;
@@ -903,7 +906,7 @@ static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht) /*
903906
return FAILURE;
904907
} /* }}} */
905908

906-
static int spl_array_next_ex(spl_array_object *intern, HashTable *aht) /* {{{ */
909+
static zend_result spl_array_next_ex(spl_array_object *intern, HashTable *aht) /* {{{ */
907910
{
908911
uint32_t *pos_ptr = spl_array_get_pos_ptr(aht, intern);
909912

@@ -915,7 +918,7 @@ static int spl_array_next_ex(spl_array_object *intern, HashTable *aht) /* {{{ */
915918
}
916919
} /* }}} */
917920

918-
static int spl_array_next(spl_array_object *intern) /* {{{ */
921+
static zend_result spl_array_next(spl_array_object *intern) /* {{{ */
919922
{
920923
HashTable *aht = spl_array_get_hash_table(intern);
921924

0 commit comments

Comments
 (0)