diff options
| author | Zeev Suraski <zeev@php.net> | 2002-09-17 14:04:37 +0000 |
|---|---|---|
| committer | Zeev Suraski <zeev@php.net> | 2002-09-17 14:04:37 +0000 |
| commit | 91b0d03346f32fe3578638b2ad10aab8ea3f7244 (patch) | |
| tree | daa1e4b7591bf94d18d9dc3170c260657f7f91ef /Zend/zend_hash.c | |
| parent | 4e6635742d9921ae60d84cf3b2d66ed8fb2432cc (diff) | |
| download | php-git-91b0d03346f32fe3578638b2ad10aab8ea3f7244.tar.gz | |
Add tracking for hashtable allocation
Diffstat (limited to 'Zend/zend_hash.c')
| -rw-r--r-- | Zend/zend_hash.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 3b01663945..61b3b036f6 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -155,7 +155,7 @@ ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength) } -ZEND_API int zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent) +ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) { uint i = 3; @@ -169,7 +169,11 @@ ZEND_API int zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction ht->nTableMask = ht->nTableSize - 1; /* Uses ecalloc() so that Bucket* == NULL */ - ht->arBuckets = (Bucket **) pecalloc(ht->nTableSize, sizeof(Bucket *), persistent); + if (persistent) { + ht->arBuckets = (Bucket **) calloc(ht->nTableSize, sizeof(Bucket *)); + } else { + ht->arBuckets = (Bucket **) ecalloc_rel(ht->nTableSize, sizeof(Bucket *)); + } if (!ht->arBuckets) { return FAILURE; @@ -188,9 +192,9 @@ ZEND_API int zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction } -ZEND_API int zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection) +ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC) { - int retval = zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent); + int retval = _zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent ZEND_FILE_LINE_CC); ht->bApplyProtection = bApplyProtection; return retval; |
