RE: [PHP-DEV] Re: [PATCH] fix zend_llist_remove_tail
| From: | Andi Gutmans | Date: | Sat, 03 Feb 2007 01:19:35 +0000 |
| Subject: | RE: [PHP-DEV] Re: [PATCH] fix zend_llist_remove_tail | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-27729@lists.php.net to get a copy of this message | ||
OK we will look into it :)
> -----Original Message-----
> From: Michael Wallner [mailto:mike@php.net]
> Sent: Friday, February 02, 2007 9:19 AM
> To: internals@lists.php.net
> Subject: [PHP-DEV] Re: [PATCH] fix zend_llist_remove_tail
>
> *If* anybody's wondering... I don't have karma.
>
> Michael Wallner wrote:
> > The attached patch fixes zend_llist_remove_tail() which
> didn't reset zend_llist->head properly.
> > The diff was generated against 5_2.
> >
> > Regards,
> >
> >
> >
> ----------------------------------------------------------------------
> > --
> >
> > 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;
> > }
> >
> >
>
>
> --
> Michael
>
> --
> PHP Internals - PHP Runtime Development Mailing List To
> unsubscribe, visit: http://www.php.net/unsub.php
>