[asterisk-commits] trunk r10766 - in /trunk: apps/app_voicemail.c include/asterisk/linkedlists.h

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Feb 22 13:13:06 MST 2006


Author: mogorman
Date: Wed Feb 22 14:13:05 2006
New Revision: 10766

URL: http://svn.digium.com/view/asterisk?rev=10766&view=rev
Log:
bug in the linkedlists macros where the prev node 
was improperly managed when doing removals or insertions.
also solved issues with app_voicemail init. and reload
solves bug #6557

Modified:
    trunk/apps/app_voicemail.c
    trunk/include/asterisk/linkedlists.h

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?rev=10766&r1=10765&r2=10766&view=diff
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Wed Feb 22 14:13:05 2006
@@ -5898,7 +5898,6 @@
 	}
 	zones = NULL;
 	zonesl = NULL;
-	AST_LIST_HEAD_INIT(&users);
 	memset(ext_pass_cmd, 0, sizeof(ext_pass_cmd));
 
 	if (cfg) {

Modified: trunk/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/linkedlists.h?rev=10766&r1=10765&r2=10766&view=diff
==============================================================================
--- trunk/include/asterisk/linkedlists.h (original)
+++ trunk/include/asterisk/linkedlists.h Wed Feb 22 14:13:05 2006
@@ -298,9 +298,11 @@
 #define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field) {				\
 	typeof((head)->first) __list_next;						\
 	typeof((head)->first) __list_prev = NULL;					\
-	for ((var) = (head)->first,  __list_next = (var) ? (var)->field.next : NULL;	\
+	typeof((head)->first) __new_prev = NULL;					\
+	for ((var) = (head)->first, __new_prev = (var),					\
+	      __list_next = (var) ? (var)->field.next : NULL;				\
 	     (var);									\
-	     __list_prev = (var), (var) = __list_next,					\
+	     __list_prev = __new_prev, (var) = __list_next,				\
 	     __list_next = (var) ? (var)->field.next : NULL				\
 	    )
 
@@ -316,6 +318,7 @@
   previous entry, if any).
  */
 #define AST_LIST_REMOVE_CURRENT(head, field)						\
+	__new_prev = __list_prev;							\
 	if (__list_prev)								\
 		__list_prev->field.next = __list_next;					\
 	else										\
@@ -340,7 +343,8 @@
 	} else {							\
 		(elm)->field.next = (head)->first;			\
 		(head)->first = (elm);					\
-	}										\
+	}								\
+	__new_prev = (elm);						\
 } while (0)
 
 /*!



More information about the asterisk-commits mailing list