From: Andrei Zmievski Date: Fri, 11 Feb 2000 21:12:49 +0000 (+0000) Subject: Made a couple of typedefs for zend_hash_apply_*() calls. X-Git-Tag: BEFORE_SAPI_POST_PATCH_17_FEB_2000~77 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94be61fde5f580b305537b54df17b0257ed1378f;p=php Made a couple of typedefs for zend_hash_apply_*() calls. --- diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index c84cba535b..2a750add64 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -683,7 +683,7 @@ ZEND_API void zend_hash_graceful_destroy(HashTable *ht) */ -ZEND_API void zend_hash_apply(HashTable *ht, int (*destruct)(void *)) +ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func) { Bucket *p; @@ -691,7 +691,7 @@ ZEND_API void zend_hash_apply(HashTable *ht, int (*destruct)(void *)) p = ht->pListHead; while (p != NULL) { - if (destruct(p->pData)) { + if (apply_func(p->pData)) { p = zend_hash_apply_deleter(ht, p); } else { p = p->pListNext; @@ -700,7 +700,7 @@ ZEND_API void zend_hash_apply(HashTable *ht, int (*destruct)(void *)) } -ZEND_API void zend_hash_apply_with_argument(HashTable *ht, int (*destruct)(void *, void *), void *argument) +ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument) { Bucket *p; @@ -708,7 +708,7 @@ ZEND_API void zend_hash_apply_with_argument(HashTable *ht, int (*destruct)(void p = ht->pListHead; while (p != NULL) { - if (destruct(p->pData, argument)) { + if (apply_func(p->pData, argument)) { p = zend_hash_apply_deleter(ht, p); } else { p = p->pListNext; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 4ec035e26b..8b85a24b67 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -37,6 +37,8 @@ typedef int (*compare_func_t)(const void *, const void *); typedef void (*sort_func_t)(void *, size_t, register size_t, compare_func_t); typedef void (*dtor_func_t)(void *pDest); +typedef int (*apply_func_t)(void *pDest); +typedef int (*apply_func_arg_t)(void *pDest, void *argument); typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength); typedef void (*copy_ctor_func_t)(void *pElement); @@ -115,8 +117,8 @@ typedef struct _zend_hash_key { int (*)(void *element, int num_args, va_list args, zend_hash_key *hash_key) ZEND_API void zend_hash_graceful_destroy(HashTable *ht); -ZEND_API void zend_hash_apply(HashTable *ht,int (*destruct)(void *)); -ZEND_API void zend_hash_apply_with_argument(HashTable *ht,int (*destruct)(void *, void *), void *); +ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func); +ZEND_API void zend_hash_apply_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *); ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, ZEND_STD_HASH_APPLIER, int, ...);