diff options
author | Zeev Suraski <zeev@php.net> | 2001-05-16 17:22:01 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2001-05-16 17:22:01 +0000 |
commit | 755207a1e63161a0ef625299fed9a2d569357f7a (patch) | |
tree | 256851fad8912a83602be6d72b82148a4384f03c /Zend/zend_hash.c | |
parent | 4c0d85ba4febd4e9c1c73a3f06647c6eadf21785 (diff) | |
download | php-git-755207a1e63161a0ef625299fed9a2d569357f7a.tar.gz |
Implement zend_hash_add_empty_element() using the existing infrastructure
Diffstat (limited to 'Zend/zend_hash.c')
-rw-r--r-- | Zend/zend_hash.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 037814ba19..b6b9156d33 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -153,11 +153,6 @@ ZEND_API ulong hashpjw(char *arKey, uint nKeyLength) } \ memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \ (p)->pData = &(p)->pDataPtr; \ - } else if (nDataSize == 0) { \ - if (!(p)->pDataPtr) { \ - pefree((p)->pData, (ht)->persistent); \ - } \ - (p)->pData = &(p)->pDataPtr; \ } else { \ if ((p)->pDataPtr) { \ (p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \ @@ -170,9 +165,6 @@ ZEND_API ulong hashpjw(char *arKey, uint nKeyLength) if (nDataSize == sizeof(void*)) { \ memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \ (p)->pData = &(p)->pDataPtr; \ - } else if (nDataSize == 0) { \ - (p)->pDataPtr = (void *) 1; \ - (p)->pData = &(p)->pDataPtr; \ } else { \ (p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \ if (!(p)->pData) { \ @@ -387,6 +379,14 @@ ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKey } +ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength) +{ + void *dummy=NULL; + + return zend_hash_add(ht, arKey, nKeyLength, &dummy, sizeof(void *), NULL); +} + + ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag) { uint nIndex; @@ -1244,6 +1244,7 @@ ZEND_API ulong zend_hash_next_free_element(HashTable *ht) } + #if ZEND_DEBUG void zend_hash_display_pListTail(HashTable *ht) { |