summaryrefslogtreecommitdiff
path: root/Zend/zend_hash.h
diff options
context:
space:
mode:
authorAndrei Zmievski <andrei@php.net>2000-03-13 15:25:18 +0000
committerAndrei Zmievski <andrei@php.net>2000-03-13 15:25:18 +0000
commita32c54bdbb68f4f9126217893fca51c62c02c702 (patch)
tree9f10d2eed4e65a31f8314e85144d6cb7c1443028 /Zend/zend_hash.h
parent773d0560f280d70bdd0e66f9a863872f469755ff (diff)
downloadphp-git-a32c54bdbb68f4f9126217893fca51c62c02c702.tar.gz
Introduced a way to traverse hashes through external pointers.
Diffstat (limited to 'Zend/zend_hash.h')
-rw-r--r--Zend/zend_hash.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index fee4206f93..bef0f074b1 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -73,6 +73,8 @@ typedef struct hashtable {
#endif
} HashTable;
+typedef Bucket* HashPosition;
+
BEGIN_EXTERN_C()
/* startup/shutdown */
@@ -146,13 +148,28 @@ ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h);
ZEND_API ulong zend_hash_next_free_element(HashTable *ht);
/* traversing */
-ZEND_API void zend_hash_move_forward(HashTable *ht);
-ZEND_API void zend_hash_move_backwards(HashTable *ht);
-ZEND_API int zend_hash_get_current_key(HashTable *ht, char **str_index, ulong *num_index);
-ZEND_API int zend_hash_get_current_key_type(HashTable *ht);
-ZEND_API int zend_hash_get_current_data(HashTable *ht, void **pData);
-ZEND_API void zend_hash_internal_pointer_reset(HashTable *ht);
-ZEND_API void zend_hash_internal_pointer_end(HashTable *ht);
+ZEND_API void zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);
+ZEND_API void 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_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);
+ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos);
+
+#define zend_hash_move_forward(ht) \
+ zend_hash_move_forward_ex(ht, NULL)
+#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)
+#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) \
+ zend_hash_get_current_data_ex(ht, pData, NULL)
+#define zend_hash_internal_pointer_reset(ht) \
+ zend_hash_internal_pointer_reset_ex(ht, NULL)
+#define zend_hash_internal_pointer_end(ht) \
+ zend_hash_internal_pointer_end_ex(ht, NULL)
/* Copying, merging and sorting */
ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size);