]> granicus.if.org Git - php/commitdiff
Add missing function to ease implementations
authorMarcus Boerger <helly@php.net>
Sat, 19 Jul 2003 14:19:04 +0000 (14:19 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 19 Jul 2003 14:19:04 +0000 (14:19 +0000)
Zend/zend_hash.c
Zend/zend_hash.h

index 08ca21ad3147229d8188395b0a21e118146ca011..e91ee2bc27b18ec14ade9833e39ddf49a497f83e 100644 (file)
@@ -1005,6 +1005,20 @@ ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos
 }
 
 
+ZEND_API int zend_hash_has_more_elements_ex(HashTable *ht, HashPosition *pos)
+{
+       HashPosition *current = pos ? pos : &ht->pInternalPointer;
+
+       IS_CONSISTENT(ht);
+
+       if (*current && (*current)->pListNext) {
+               return SUCCESS;
+       } else {
+               return FAILURE;
+       }
+}
+
+
 ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
 {
        HashPosition *current = pos ? pos : &ht->pInternalPointer;
index e1f0beccea0c74c4cfdd98802f4fe9deccb18c0a..9aa0315c38e451d22bbac1b5ff40c87a3cc64a93 100644 (file)
@@ -164,6 +164,7 @@ ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h);
 ZEND_API ulong zend_hash_next_free_element(HashTable *ht);
 
 /* traversing */
+ZEND_API int zend_hash_has_more_elements_ex(HashTable *ht, HashPosition *pos);
 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, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos);
@@ -172,6 +173,8 @@ ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosi
 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_has_more_elements(ht) \
+       zend_hash_has_more_elements_ex(ht, NULL)
 #define zend_hash_move_forward(ht) \
        zend_hash_move_forward_ex(ht, NULL)
 #define zend_hash_move_backwards(ht) \