[asterisk-commits] trunk r17183 -
	/trunk/include/asterisk/linkedlists.h
    asterisk-commits at lists.digium.com 
    asterisk-commits at lists.digium.com
       
    Mon Apr  3 22:53:49 MST 2006
    
    
  
Author: markster
Date: Tue Apr  4 00:53:48 2006
New Revision: 17183
URL: http://svn.digium.com/view/asterisk?rev=17183&view=rev
Log:
Does nobody know how to write a linked list properly? I mean seriously!
Modified:
    trunk/include/asterisk/linkedlists.h
Modified: trunk/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/linkedlists.h?rev=17183&r1=17182&r2=17183&view=diff
==============================================================================
--- trunk/include/asterisk/linkedlists.h (original)
+++ trunk/include/asterisk/linkedlists.h Tue Apr  4 00:53:48 2006
@@ -478,11 +478,13 @@
 			(head)->last = NULL;			\
 	} else {								\
 		typeof(elm) curelm = (head)->first;			\
-		while (curelm->field.next != (elm))			\
+		while (curelm && (curelm->field.next != (elm)))			\
 			curelm = curelm->field.next;			\
-		curelm->field.next = (elm)->field.next;			\
-		if ((head)->last == (elm))				\
-			(head)->last = curelm;				\
+		if (curelm) { \
+			curelm->field.next = (elm)->field.next;			\
+			if ((head)->last == (elm))				\
+				(head)->last = curelm;				\
+		} \
 	}								\
 } while (0)
 
    
    
More information about the asterisk-commits
mailing list