dect
/
asterisk
Archived
13
0
Fork 0

Does nobody know how to write a linked list properly? I mean seriously!

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@17183 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
markster 2006-04-04 05:53:48 +00:00
parent 6fa10d3955
commit 1ad6e500c4
1 changed files with 6 additions and 4 deletions

View File

@ -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)