Does nobody know how to write a linked list properly? I mean seriously!
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@17183 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
bf4b484e62
commit
f11fb65262
1 changed files with 6 additions and 4 deletions
|
@ -478,11 +478,13 @@ struct { \
|
|||
(head)->last = NULL; \
|
||||
} else { \
|
||||
typeof(elm) curelm = (head)->first; \
|
||||
while (curelm->field.next != (elm)) \
|
||||
while (curelm && (curelm->field.next != (elm))) \
|
||||
curelm = curelm->field.next; \
|
||||
curelm->field.next = (elm)->field.next; \
|
||||
if ((head)->last == (elm)) \
|
||||
(head)->last = curelm; \
|
||||
if (curelm) { \
|
||||
curelm->field.next = (elm)->field.next; \
|
||||
if ((head)->last == (elm)) \
|
||||
(head)->last = curelm; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
|
Loading…
Reference in a new issue