aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-01-29 16:14:25 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-01-29 16:14:25 +0000
commitbae2099daf2a276bfc9662741ee9e344df7fa355 (patch)
tree9cc3b8252530e26ad4d13a00dafc49f2f201f529
parent76d2b23575da24ebae1ee1e66abe7ce72d7a434a (diff)
Fix linked lists tail (bug #951)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2090 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xinclude/asterisk/linkedlists.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h
index 30e09a015..01067d5f0 100755
--- a/include/asterisk/linkedlists.h
+++ b/include/asterisk/linkedlists.h
@@ -55,10 +55,14 @@ struct { \
#define AST_LIST_INSERT_TAIL(head, elm, type, field) do { \
struct type *curelm = (head)->first; \
- while ( curelm->field.next!=NULL ) { \
- curelm=curelm->field.next; \
+ if(!curelm) { \
+ AST_LIST_INSERT_HEAD(head, elm, field); \
+ } else { \
+ while ( curelm->field.next!=NULL ) { \
+ curelm=curelm->field.next; \
+ } \
+ AST_LIST_INSERT_AFTER(curelm,elm,field); \
} \
- AST_LIST_INSERT_AFTER(curelm,elm,field); \
} while (0)