]> granicus.if.org Git - php/commitdiff
Make it a macro
authorMarcus Boerger <helly@php.net>
Sun, 20 Jul 2003 12:23:46 +0000 (12:23 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 20 Jul 2003 12:23:46 +0000 (12:23 +0000)
Zend/zend_hash.c
Zend/zend_hash.h

index 2081bd6ce45e690b4f9f4196932bf28aa5c5fc86..08ca21ad3147229d8188395b0a21e118146ca011 100644 (file)
@@ -1005,20 +1005,6 @@ 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) {
-               return SUCCESS;
-       } else {
-               return FAILURE;
-       }
-}
-
-
 ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
 {
        HashPosition *current = pos ? pos : &ht->pInternalPointer;
index 9aa0315c38e451d22bbac1b5ff40c87a3cc64a93..976ec72dc5791e5d2e1dc1f4e47714d4ea77ad8d 100644 (file)
@@ -164,7 +164,8 @@ 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);
+#define zend_hash_has_more_elements_ex(ht, pos) \
+       (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTANT ? FAILURE : SUCCESS)
 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);