[Asterisk-cvs] asterisk/include/asterisk linkedlists.h,1.2,1.3

markster at lists.digium.com markster at lists.digium.com
Thu Jan 29 10:22:17 CST 2004


Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv17372/include/asterisk

Modified Files:
	linkedlists.h 
Log Message:
Fix linked lists tail (bug #951)


Index: linkedlists.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/linkedlists.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- linkedlists.h	13 Aug 2003 15:25:16 -0000	1.2
+++ linkedlists.h	29 Jan 2004 16:14:25 -0000	1.3
@@ -55,10 +55,14 @@
 
 #define AST_LIST_INSERT_TAIL(head, elm, type, field) do {             \
       struct type *curelm = (head)->first;                            \
-      while ( curelm->field.next!=NULL ) {                            \
-              curelm=curelm->field.next;                              \
+      if(!curelm) {                                                   \
+              AST_LIST_INSERT_HEAD(head, elm, field);                 \
+      } else {                                                        \
+              while ( curelm->field.next!=NULL ) {                    \
+                      curelm=curelm->field.next;                      \
+              }                                                       \
+              AST_LIST_INSERT_AFTER(curelm,elm,field);                \
       }                                                               \
-      AST_LIST_INSERT_AFTER(curelm,elm,field);                        \
 } while (0)
 
 




More information about the svn-commits mailing list