diff options
Diffstat (limited to 'Zend/zend_llist.c')
-rw-r--r-- | Zend/zend_llist.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c index 20f847c781..0fb49abf5b 100644 --- a/Zend/zend_llist.c +++ b/Zend/zend_llist.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) | +----------------------------------------------------------------------+ | This source file is subject to version 2.00 of the Zend license, | | that is bundled with this package in the file LICENSE, and is | @@ -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); } |