diff options
author | Rasmus Lerdorf <rasmus@lerdorf.com> | 2015-01-30 22:57:40 -0800 |
---|---|---|
committer | Rasmus Lerdorf <rasmus@lerdorf.com> | 2015-01-30 22:57:40 -0800 |
commit | 74b85316ea06c17256e102483daa472f4b638221 (patch) | |
tree | abe0618e15fcfc93158b4239889485ffc70c4c1c /Zend/zend_hash.h | |
parent | 130d7320b160443ca160ee6b3a19a034ee2c5ef1 (diff) | |
parent | 1e41295097576dbce6c197ddb7507c07ccae3cbe (diff) | |
download | php-git-dstogov-foreach.tar.gz |
Merge branch 'foreach' of https://github.com/dstogov/php-src into dstogov-foreachdstogov-foreach
Diffstat (limited to 'Zend/zend_hash.h')
-rw-r--r-- | Zend/zend_hash.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 377f508658..602cd7a2e4 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -50,8 +50,6 @@ typedef struct _zend_hash_key { typedef zend_bool (*merge_checker_func_t)(HashTable *target_ht, zval *source_data, zend_hash_key *hash_key, void *pParam); -typedef uint32_t HashPosition; - BEGIN_EXTERN_C() /* startup/shutdown */ @@ -171,13 +169,6 @@ ZEND_API zval *zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos); ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos); -typedef struct _HashPointer { - HashPosition pos; - HashTable *ht; - zend_ulong h; - zend_string *key; -} HashPointer; - #define zend_hash_has_more_elements(ht) \ zend_hash_has_more_elements_ex(ht, &(ht)->nInternalPointer) #define zend_hash_move_forward(ht) \ @@ -234,6 +225,21 @@ void zend_hash_display(const HashTable *ht); ZEND_API int _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx); + +ZEND_API uint32_t zend_hash_iterator_add(HashTable *ht, HashPosition pos); +ZEND_API HashPosition zend_hash_iterator_pos(uint32_t idx, HashTable *ht); +ZEND_API void zend_hash_iterator_del(uint32_t idx); +ZEND_API HashPosition zend_hash_iterators_lower_pos(HashTable *ht, HashPosition start); +ZEND_API void _zend_hash_iterators_update(HashTable *ht, HashPosition from, HashPosition to); + +static zend_always_inline void zend_hash_iterators_update(HashTable *ht, HashPosition from, HashPosition to) +{ + if (UNEXPECTED(ht->u.v.nIteratorsCount)) { + _zend_hash_iterators_update(ht, from, to); + } +} + + END_EXTERN_C() #define ZEND_INIT_SYMTABLE(ht) \ |