Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv26364/include/asterisk
Modified Files:
linkedlists.h
Log Message:
make AST_LIST_REMOVE_HEAD safer to use
Index: linkedlists.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/linkedlists.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- linkedlists.h 8 Jul 2005 21:14:34 -0000 1.15
+++ linkedlists.h 24 Aug 2005 23:10:06 -0000 1.16
@@ -305,14 +305,15 @@
\param field This is the name of the field (declared using AST_LIST_ENTRY())
used to link entries of this list together.
- Removes the head entry from the list, and returns a pointer to it. The
- forward-link pointer in the returned entry is \b not cleared. This macro
- is safe to call on an empty list.
+ Removes the head entry from the list, and returns a pointer to it.
+ This macro is safe to call on an empty list.
*/
#define AST_LIST_REMOVE_HEAD(head, field) ({ \
typeof((head)->first) cur = (head)->first; \
- if (cur) \
+ if (cur) { \
(head)->first = cur->field.next; \
+ cur->field.next = NULL; \
+ } \
cur; \
})
_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs