[svn-commits] twilson: branch 1.10 r328717 - in /branches/1.10: ./ include/asterisk/ tests/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Jul 18 20:55:36 CDT 2011
Author: twilson
Date: Mon Jul 18 20:55:32 2011
New Revision: 328717
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=328717
Log:
Merged revisions 328716 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r328716 | twilson | 2011-07-18 20:35:53 -0500 (Mon, 18 Jul 2011) | 7 lines
Make AST_LIST_REMOVE safer
AST_LIST_REMOVE shouldn't modify the element passed in if it isn't found. This
commit also adds linked list unit tests.
Review: https://reviewboard.asterisk.org/r/1321/
........
Added:
branches/1.10/tests/test_linkedlists.c
- copied unchanged from r328716, branches/1.8/tests/test_linkedlists.c
Modified:
branches/1.10/ (props changed)
branches/1.10/include/asterisk/linkedlists.h
Propchange: branches/1.10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/1.10/include/asterisk/linkedlists.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.10/include/asterisk/linkedlists.h?view=diff&rev=328717&r1=328716&r2=328717
==============================================================================
--- branches/1.10/include/asterisk/linkedlists.h (original)
+++ branches/1.10/include/asterisk/linkedlists.h Mon Jul 18 20:55:32 2011
@@ -838,7 +838,10 @@
*/
#define AST_LIST_REMOVE(head, elm, field) ({ \
__typeof(elm) __res = NULL; \
- if ((head)->first == (elm)) { \
+ __typeof(elm) __tmp = elm; \
+ if (!__tmp) { \
+ __res = NULL; \
+ } else if ((head)->first == (elm)) { \
__res = (head)->first; \
(head)->first = (elm)->field.next; \
if ((head)->last == (elm)) \
@@ -854,7 +857,9 @@
(head)->last = curelm; \
} \
} \
- (elm)->field.next = NULL; \
+ if (__res) { \
+ (__res)->field.next = NULL; \
+ } \
(__res); \
})
More information about the svn-commits
mailing list