mirror of
https://github.com/php/php-src.git
synced 2024-11-27 03:44:07 +08:00
Make zend_llist_remove_tail a void function
The returned data is already dtored and freed at this point.
This commit is contained in:
parent
345b0f44c3
commit
21a5253ea9
@ -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;
|
||||
|
||||
return data;
|
||||
zend_llist_element *old_tail = l->tail;
|
||||
if (!old_tail) {
|
||||
return;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
if (old_tail->prev) {
|
||||
old_tail->prev->next = NULL;
|
||||
} else {
|
||||
l->head = NULL;
|
||||
}
|
||||
|
||||
l->tail = old_tail->prev;
|
||||
--l->count;
|
||||
|
||||
if (l->dtor) {
|
||||
l->dtor(old_tail->data);
|
||||
}
|
||||
pefree(old_tail, l->persistent);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user