summaryrefslogtreecommitdiff
path: root/Zend/zend_hash.c
diff options
context:
space:
mode:
authorThies C. Arntzen <thies@php.net>2001-07-13 12:05:47 +0000
committerThies C. Arntzen <thies@php.net>2001-07-13 12:05:47 +0000
commit7b7e72d1d25d41ee65c15ad6ca242cb6517b569d (patch)
treef91db120f37a57cc22366dff6544fadb14f2c0b3 /Zend/zend_hash.c
parent249c010d92af717fe9f76c497cf3f0003781f1f2 (diff)
downloadphp-git-7b7e72d1d25d41ee65c15ad6ca242cb6517b569d.tar.gz
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!
Diffstat (limited to 'Zend/zend_hash.c')
-rw-r--r--Zend/zend_hash.c24
1 files changed, 24 insertions, 0 deletions
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)
{