From c6a8d45f4370b7c79355c94b04c8095ef28a49d1 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" <kpfleming@digium.com> Date: Thu, 25 Oct 2007 23:11:28 +0000 Subject: [PATCH] Merged revisions 87069 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r87069 | kpfleming | 2007-10-25 18:03:11 -0500 (Thu, 25 Oct 2007) | 2 lines appending one list to another should leave the first list empty, and not require the user to do that ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@87070 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/linkedlists.h | 5 +++++ main/channel.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index b503f5b757..21e38761a6 100644 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -693,6 +693,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) { \ @@ -702,6 +705,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 diff --git a/main/channel.c b/main/channel.c index ace4d4eb06..843c1dd278 100644 --- a/main/channel.c +++ b/main/channel.c @@ -3512,7 +3512,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 */ -- GitLab