com php-src: Make zend_llist_remove_tail a void fun ction: Zend/zend_llist.c Zend/zend_llist.h
| From: | Nikita Popov | Date: | Sat, 13 Sep 2014 20:07:51 +0000 |
| Subject: | com php-src: Make zend_llist_remove_tail a void fun ction: Zend/zend_llist.c Zend/zend_llist.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81546@lists.php.net to get a copy of this message | ||
Commit: 21a5253ea98a20239457e3c4f785431d14d64de6
Author: Nikita Popov <nikic@php.net> Sat, 13 Sep 2014 22:05:37 +0200
Parents: 345b0f44c30d3d42f9a0088718aa712b1d0754d5
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=21a5253ea98a20239457e3c4f785431d14d64de6
Log:
Make zend_llist_remove_tail a void function
The returned data is already dtored and freed at this point.
Changed paths:
M Zend/zend_llist.c
M Zend/zend_llist.h
Diff:
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c
index ad74bd5..0fb49ab 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);
}
diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h
index b05ece8..602884c 100644
--- a/Zend/zend_llist.h
+++ b/Zend/zend_llist.h
@@ -53,7 +53,7 @@ ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element);
ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1,
void *element2));
ZEND_API void zend_llist_destroy(zend_llist *l);
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_API void zend_llist_copy(zend_llist *dst, zend_llist *src);
ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC);
ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));