diff options
| author | Zeev Suraski <zeev@php.net> | 2000-05-02 17:52:31 +0000 |
|---|---|---|
| committer | Zeev Suraski <zeev@php.net> | 2000-05-02 17:52:31 +0000 |
| commit | 8ca13c97c2d5daa91dd282cf3c8d490f353373a7 (patch) | |
| tree | f806405367b80cbd3259cc59d658b5ab0effcce1 | |
| parent | f5520fd465ef6d41cbb17ee67cd42bc8b1207ab8 (diff) | |
| download | php-git-8ca13c97c2d5daa91dd282cf3c8d490f353373a7.tar.gz | |
Change zend_hash_get_current_key_ex() to also return the string length
| -rw-r--r-- | Zend/zend_hash.c | 5 | ||||
| -rw-r--r-- | Zend/zend_hash.h | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 073d511f6d..7487eebf7c 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -946,7 +946,7 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos) /* This function should be made binary safe */ -ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *num_index, HashPosition *pos) +ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *str_length, ulong *num_index, HashPosition *pos) { Bucket *p; @@ -958,6 +958,9 @@ ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong if (p->nKeyLength) { *str_index = (char *) pemalloc(p->nKeyLength, ht->persistent); memcpy(*str_index, p->arKey, p->nKeyLength); + if (str_length) { + *str_length = p->nKeyLength; + } return HASH_KEY_IS_STRING; } else { *num_index = p->h; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 2a5ef4035d..16641fa98c 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -141,7 +141,7 @@ ZEND_API ulong zend_hash_next_free_element(HashTable *ht); /* traversing */ ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *num_index, HashPosition *pos); +ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *str_length, ulong *num_index, HashPosition *pos); ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos); ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); @@ -152,7 +152,7 @@ ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos #define zend_hash_move_backwards(ht) \ zend_hash_move_backwards_ex(ht, NULL) #define zend_hash_get_current_key(ht, str_index, num_index) \ - zend_hash_get_current_key_ex(ht, str_index, num_index, NULL) + zend_hash_get_current_key_ex(ht, str_index, NULL, num_index, NULL) #define zend_hash_get_current_key_type(ht) \ zend_hash_get_current_key_type_ex(ht, NULL) #define zend_hash_get_current_data(ht, pData) \ |
