Bug 5965 - major bug in AST_LIST_REMOVE

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@7429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2005-12-11 01:26:51 +00:00
parent f59b27258c
commit 3b80a35a66

View File

@@ -424,15 +424,16 @@ struct { \
#define AST_LIST_REMOVE(head, elm, field) do { \
if ((head)->first == (elm)) { \
(head)->first = (elm)->field.next; \
} \
else { \
if ((head)->last = (elm)) \
(head)->last = NULL; \
} else { \
typeof(elm) curelm = (head)->first; \
while (curelm->field.next != (elm)) \
curelm = curelm->field.next; \
curelm->field.next = (elm)->field.next; \
if ((head)->last == curelm->field.next) \
(head)->last = curelm; \
} \
if ((head)->last == elm) \
(head)->last = NULL; \
} while (0)
#endif /* _ASTERISK_LINKEDLISTS_H */