diff options
author | Andi Gutmans <andi@php.net> | 2000-10-18 20:15:53 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2000-10-18 20:15:53 +0000 |
commit | 928da7104699a28ad1a934306d9d6cb7e63ddb18 (patch) | |
tree | 4da1ae984161562db7070d9da204d448ca3e2100 /Zend/zend_llist.c | |
parent | ffc6e72604cf3401c65f2856445cb69a3f40471a (diff) | |
download | php-git-928da7104699a28ad1a934306d9d6cb7e63ddb18.tar.gz |
- Try #2. Wasn't allowed to delete in the previous manner because we were
in the middle of an llist_apply()
Diffstat (limited to 'Zend/zend_llist.c')
-rw-r--r-- | Zend/zend_llist.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c index 5c10eee433..68d39282ff 100644 --- a/Zend/zend_llist.c +++ b/Zend/zend_llist.c @@ -139,6 +139,24 @@ ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src) } +ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data)) +{ + zend_llist_element *element, *next; + + element=l->head; + while (element) { + next = element->next; + if (func(element->data)) { + if (l->dtor) { + l->dtor(element->data); + pefree(element, l->persistent); + } + } + element = next; + } +} + + ZEND_API void zend_llist_apply(zend_llist *l, void (*func)(void *data)) { zend_llist_element *element; |