[asterisk-commits] russell: branch 1.4 r67492 -
	/branches/1.4/include/asterisk/linkedlists.h
    asterisk-commits at lists.digium.com 
    asterisk-commits at lists.digium.com
       
    Tue Jun  5 13:53:29 MST 2007
    
    
  
Author: russell
Date: Tue Jun  5 15:53:28 2007
New Revision: 67492
URL: http://svn.digium.com/view/asterisk?view=rev&rev=67492
Log:
This bug has been hanging over my head ever since I wrote this SLA code.
Every time I tried to go debug it by adding some debug output, the behavior
would change.  It turns out I wasn't crazy.  I had the following piece of code:
   if (remove)
      AST_LIST_REMOVE_CURRENT(...);
Well, AST_LIST_REMOVE_CURRENT was not wrapped in braces, so my conditional
statement didn't do much good at all.  It always ran at least all of the
macro minus the first statement, so I was seeing list entries magically
disappear when they weren't supposed to.
After many hours of debugging, I have come to this extremely irritating fix. :)
(issues #9581, #9497)
Modified:
    branches/1.4/include/asterisk/linkedlists.h
Modified: branches/1.4/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/linkedlists.h?view=diff&rev=67492&r1=67491&r2=67492
==============================================================================
--- branches/1.4/include/asterisk/linkedlists.h (original)
+++ branches/1.4/include/asterisk/linkedlists.h Tue Jun  5 15:53:28 2007
@@ -513,7 +513,7 @@
   the list traversal (and without having to re-traverse the list to modify the
   previous entry, if any).
  */
-#define AST_LIST_REMOVE_CURRENT(head, field)						\
+#define AST_LIST_REMOVE_CURRENT(head, field) do { \
 	__new_prev->field.next = NULL;							\
 	__new_prev = __list_prev;							\
 	if (__list_prev)								\
@@ -521,7 +521,8 @@
 	else										\
 		(head)->first = __list_next;						\
 	if (!__list_next)								\
-		(head)->last = __list_prev;
+		(head)->last = __list_prev; \
+	} while (0)
 
 #define AST_RWLIST_REMOVE_CURRENT AST_LIST_REMOVE_CURRENT
 
    
    
More information about the asterisk-commits
mailing list