summaryrefslogtreecommitdiff
path: root/Zend/zend_llist.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>1999-05-05 19:24:46 +0000
committerAndi Gutmans <andi@php.net>1999-05-05 19:24:46 +0000
commitc8b2bf0a1d57e5c244ddd477255a2a5c662b8e58 (patch)
treef0a59f48487b5d82dd67cc4535e59f09509e5d42 /Zend/zend_llist.c
parent537cc54acd4844624e60ed9f128155b35374b4a6 (diff)
downloadphp-git-c8b2bf0a1d57e5c244ddd477255a2a5c662b8e58.tar.gz
llist improvements
Diffstat (limited to 'Zend/zend_llist.c')
-rw-r--r--Zend/zend_llist.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c
index 2a659cef88..aabbe6ab21 100644
--- a/Zend/zend_llist.c
+++ b/Zend/zend_llist.c
@@ -72,26 +72,26 @@ ZEND_API void zend_llist_del_element(zend_llist *l, void *element)
ZEND_API void zend_llist_destroy(zend_llist *l)
{
- zend_llist_element *current, *next;
-
- if (l->dtor) {
- current = l->head;
-
- while (current) {
- l->dtor(current->data);
- current = current->next;
- }
- }
+ zend_llist_element *current=l->head, *next;
- current = l->head;
while (current) {
next = current->next;
+ if (l->dtor) {
+ l->dtor(current->data);
+ }
pefree(current, l->persistent);
current = next;
}
}
+ZEND_API void zend_llist_clean(zend_llist *l)
+{
+ zend_llist_destroy(l);
+ l->head = l->tail = NULL;
+}
+
+
ZEND_API void zend_llist_remove_tail(zend_llist *l)
{
zend_llist_element *old_tail;