diff options
author | Nikita Popov <nikic@php.net> | 2014-09-13 22:05:37 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2014-09-13 22:07:51 +0200 |
commit | 21a5253ea98a20239457e3c4f785431d14d64de6 (patch) | |
tree | 057e545b6525c6e33f3b9183756a96e8625d359b /Zend/zend_llist.c | |
parent | 345b0f44c30d3d42f9a0088718aa712b1d0754d5 (diff) | |
download | php-git-21a5253ea98a20239457e3c4f785431d14d64de6.tar.gz |
Make zend_llist_remove_tail a void function
The returned data is already dtored and freed at this point.
Diffstat (limited to 'Zend/zend_llist.c')
-rw-r--r-- | Zend/zend_llist.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c index ad74bd56cb..0fb49abf5b 100644 --- a/Zend/zend_llist.c +++ b/Zend/zend_llist.c @@ -126,32 +126,26 @@ ZEND_API void zend_llist_clean(zend_llist *l) } -ZEND_API void *zend_llist_remove_tail(zend_llist *l) +ZEND_API void zend_llist_remove_tail(zend_llist *l) { - zend_llist_element *old_tail; - void *data; - - if ((old_tail = l->tail)) { - if (old_tail->prev) { - old_tail->prev->next = NULL; - } else { - l->head = NULL; - } - - data = old_tail->data; - - l->tail = old_tail->prev; - if (l->dtor) { - l->dtor(data); - } - pefree(old_tail, l->persistent); - - --l->count; + zend_llist_element *old_tail = l->tail; + if (!old_tail) { + return; + } - return data; + if (old_tail->prev) { + old_tail->prev->next = NULL; + } else { + l->head = NULL; } - return NULL; + l->tail = old_tail->prev; + --l->count; + + if (l->dtor) { + l->dtor(old_tail->data); + } + pefree(old_tail, l->persistent); } |