[PHP-DEV] Re: [PATCH] fix zend_llist_remove_tail

2007-02-02 Thread Michael Wallner
*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 -   1.35.2.1.2.1
 +++ Zend/zend_llist.c 27 Jan 2007 17:31:36 -
 @@ -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



RE: [PHP-DEV] Re: [PATCH] fix zend_llist_remove_tail

2007-02-02 Thread Andi Gutmans
OK we will look into it :)
 

 -Original Message-
 From: Michael Wallner [mailto:[EMAIL PROTECTED] 
 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 -   
 1.35.2.1.2.1
  +++ Zend/zend_llist.c   27 Jan 2007 17:31:36 -
  @@ -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
 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php