diff options
Diffstat (limited to 'ext/spl/spl_iterators.c')
-rw-r--r-- | ext/spl/spl_iterators.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 68ddd42dda..cd0c624b50 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -2318,10 +2318,7 @@ static void spl_dual_it_free_storage(zend_object *_object) } if (object->dit_type == DIT_CachingIterator || object->dit_type == DIT_RecursiveCachingIterator) { - if (Z_TYPE(object->u.caching.zcache) != IS_UNDEF) { - zval_ptr_dtor(&object->u.caching.zcache); - //ZVAL_UNDEF(&object->u.caching.zcache); - } + zval_ptr_dtor(&object->u.caching.zcache); } #if HAVE_PCRE || HAVE_BUNDLED_PCRE @@ -2645,7 +2642,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern) ZVAL_DEREF(data); Z_TRY_ADDREF_P(data); - array_set_zval_key(HASH_OF(&intern->u.caching.zcache), key, data); + array_set_zval_key(Z_ARRVAL(intern->u.caching.zcache), key, data); zval_ptr_dtor(data); } /* Recursion ? */ @@ -2710,7 +2707,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern) static inline void spl_caching_it_rewind(spl_dual_it_object *intern) { spl_dual_it_rewind(intern); - zend_hash_clean(HASH_OF(&intern->u.caching.zcache)); + zend_hash_clean(Z_ARRVAL(intern->u.caching.zcache)); spl_caching_it_next(intern); } @@ -2831,7 +2828,7 @@ SPL_METHOD(CachingIterator, offsetSet) if (Z_REFCOUNTED_P(value)) { Z_ADDREF_P(value); } - zend_symtable_update(HASH_OF(&intern->u.caching.zcache), key, value); + zend_symtable_update(Z_ARRVAL(intern->u.caching.zcache), key, value); } /* }}} */ @@ -2854,7 +2851,7 @@ SPL_METHOD(CachingIterator, offsetGet) return; } - if ((value = zend_symtable_find(HASH_OF(&intern->u.caching.zcache), key)) == NULL) { + if ((value = zend_symtable_find(Z_ARRVAL(intern->u.caching.zcache), key)) == NULL) { zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(key)); return; } @@ -2882,7 +2879,7 @@ SPL_METHOD(CachingIterator, offsetUnset) return; } - zend_symtable_del(HASH_OF(&intern->u.caching.zcache), key); + zend_symtable_del(Z_ARRVAL(intern->u.caching.zcache), key); } /* }}} */ @@ -2904,7 +2901,7 @@ SPL_METHOD(CachingIterator, offsetExists) return; } - RETURN_BOOL(zend_symtable_exists(HASH_OF(&intern->u.caching.zcache), key)); + RETURN_BOOL(zend_symtable_exists(Z_ARRVAL(intern->u.caching.zcache), key)); } /* }}} */ @@ -2913,7 +2910,6 @@ SPL_METHOD(CachingIterator, offsetExists) SPL_METHOD(CachingIterator, getCache) { spl_dual_it_object *intern; - zval *value; if (zend_parse_parameters_none() == FAILURE) { return; @@ -2926,9 +2922,7 @@ SPL_METHOD(CachingIterator, getCache) return; } - value = &intern->u.caching.zcache; - ZVAL_DEREF(value); - ZVAL_COPY(return_value, value); + ZVAL_COPY(return_value, &intern->u.caching.zcache); } /* }}} */ @@ -2975,7 +2969,7 @@ SPL_METHOD(CachingIterator, setFlags) } if ((flags & CIT_FULL_CACHE) != 0 && (intern->u.caching.flags & CIT_FULL_CACHE) == 0) { /* clear on (re)enable */ - zend_hash_clean(HASH_OF(&intern->u.caching.zcache)); + zend_hash_clean(Z_ARRVAL(intern->u.caching.zcache)); } intern->u.caching.flags = (intern->u.caching.flags & ~CIT_PUBLIC) | (flags & CIT_PUBLIC); } @@ -2998,7 +2992,7 @@ SPL_METHOD(CachingIterator, count) return; } - RETURN_LONG(zend_hash_num_elements(HASH_OF(&intern->u.caching.zcache))); + RETURN_LONG(zend_hash_num_elements(Z_ARRVAL(intern->u.caching.zcache))); } /* }}} */ |