]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
appending one list to another should leave the first list empty, and not require...
authorKevin P. Fleming <kpfleming@digium.com>
Thu, 25 Oct 2007 23:03:11 +0000 (23:03 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Thu, 25 Oct 2007 23:03:11 +0000 (23:03 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@87069 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/linkedlists.h
main/channel.c

index 70a5cdcae699dbd8aa6d42c4ab9d3c2052889ad9..a8d90ecbe6daa41fe7134e586fdc69ece3c1b4b9 100644 (file)
@@ -686,6 +686,9 @@ struct {                                                            \
   \param list This is a pointer to the list to be appended.
   \param field This is the name of the field (declared using AST_LIST_ENTRY())
   used to link entries of this list together.
+
+  Note: The source list (the \a list parameter) will be empty after
+  calling this macro (the list entries are \b moved to the target list).
  */
 #define AST_LIST_APPEND_LIST(head, list, field) do {                   \
       if (!(head)->first) {                                            \
@@ -695,6 +698,8 @@ struct {                                                            \
                (head)->last->field.next = (list)->first;               \
                (head)->last = (list)->last;                            \
       }                                                                        \
+      (list)->first = NULL;                                            \
+      (list)->last = NULL;                                             \
 } while (0)
 
 #define AST_RWLIST_APPEND_LIST AST_LIST_APPEND_LIST
index 76e3af2903affc80e6392e411d8ea422f1483d4c..9d9da80b489a9604e1c23e4b53ac9073705d91a0 100644 (file)
@@ -3579,7 +3579,6 @@ static void clone_variables(struct ast_channel *original, struct ast_channel *cl
        /* XXX Is this always correct?  We have to in order to keep MACROS working XXX */
        if (AST_LIST_FIRST(&clone->varshead))
                AST_LIST_APPEND_LIST(&original->varshead, &clone->varshead, entries);
-       AST_LIST_HEAD_INIT_NOLOCK(&clone->varshead);
 
        /* then, dup the varshead list into the clone */