mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-28 15:11:12 +00:00
Merged revisions 328717 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.10 ................ r328717 | twilson | 2011-07-18 20:55:32 -0500 (Mon, 18 Jul 2011) | 14 lines 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/ ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328718 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -838,7 +838,10 @@ struct { \
|
||||
*/
|
||||
#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 @@ struct { \
|
||||
(head)->last = curelm; \
|
||||
} \
|
||||
} \
|
||||
(elm)->field.next = NULL; \
|
||||
if (__res) { \
|
||||
(__res)->field.next = NULL; \
|
||||
} \
|
||||
(__res); \
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user