From 7b7e72d1d25d41ee65c15ad6ca242cb6517b569d Mon Sep 17 00:00:00 2001 From: "Thies C. Arntzen" Date: Fri, 13 Jul 2001 12:05:47 +0000 Subject: the resource-lists are now destroyed backwards. this will make sure that resources get destroyed in the opposite order they were created and thereby db-cursors will always be released before their corresponding connection etc. this sould not break anything! --- Zend/zend_hash.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Zend/zend_hash.c') diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 425053fe2a..6cd2ea8e81 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -529,6 +529,30 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLen return FAILURE; } +ZEND_API void zend_hash_reverse_destroy(HashTable *ht) +{ + Bucket *p, *q; + + while (1) { + p = ht->pListTail; + if (! p) + break; + q = p->pListLast; + if (q) + q->pListNext = NULL; + ht->pListTail = q; + + if (ht->pDestructor) { + ht->pDestructor(p->pData); + } + if (!p->pDataPtr && p->pData) { + pefree(p->pData, ht->persistent); + } + pefree(p, ht->persistent); + } + pefree(ht->arBuckets, ht->persistent); +} + ZEND_API void zend_hash_destroy(HashTable *ht) { -- cgit v1.2.1