The attached patch fixes zend_llist_remove_tail() which didn't reset
zend_llist->head properly.
The diff was generated against 5_2.
Regards,
--
Michael
Index: Zend/zend_llist.c
===================================================================
RCS file: /repository/ZendEngine2/zend_llist.c,v
retrieving revision 1.35.2.1.2.1
diff -u -p -d -r1.35.2.1.2.1 zend_llist.c
--- Zend/zend_llist.c 1 Jan 2007 09:35:46 -0000 1.35.2.1.2.1
+++ Zend/zend_llist.c 27 Jan 2007 17:31:36 -0000
@@ -130,28 +130,17 @@ ZEND_API void zend_llist_clean(zend_llis
ZEND_API void *zend_llist_remove_tail(zend_llist *l)
{
- zend_llist_element *old_tail;
+ zend_llist_element *current = l->tail;
void *data;
-
- if ((old_tail = l->tail)) {
- if (l->tail->prev) {
- l->tail->prev->next = NULL;
- }
-
- data = old_tail->data;
-
- l->tail = l->tail->prev;
- if (l->dtor) {
- l->dtor(data);
- }
- pefree(old_tail, l->persistent);
-
- --l->count;
-
- return data;
+
+ if (current) {
+ data = current->data;
+ DEL_LLIST_ELEMENT(current, l);
+ } else {
+ data = NULL;
}
-
- return NULL;
+
+ return data;
}
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php