diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-10-25 23:03:11 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-10-25 23:03:11 +0000 |
commit | 7343abf86992cbec54890cf2d858134f30039d59 (patch) | |
tree | e012a6e93dec6de7efb16e38233776adfa3f3184 | |
parent | 0e9e1fd41534c526d91bc5e64720cf5371783a74 (diff) |
appending one list to another should leave the first list empty, and not require the user to do that
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@87069 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | include/asterisk/linkedlists.h | 5 | ||||
-rw-r--r-- | main/channel.c | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index 70a5cdcae..a8d90ecbe 100644 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -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 diff --git a/main/channel.c b/main/channel.c index 76e3af290..9d9da80b4 100644 --- a/main/channel.c +++ b/main/channel.c @@ -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 */ |