diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-17 12:05:05 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-17 12:05:05 +0000 |
commit | 79501c60fca9483464a44467a80d582ffac613fb (patch) | |
tree | a4a0a0fb564fa8b5533fc4342bd6a8a8f8e262bd /include | |
parent | afa8b25ae9862c7b35b6821261f45db6769a9278 (diff) |
Merged revisions 201262 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r201262 | kpfleming | 2009-06-17 07:04:17 -0500 (Wed, 17 Jun 2009) | 15 lines
Merged revisions 201261 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r201261 | kpfleming | 2009-06-17 07:03:25 -0500 (Wed, 17 Jun 2009) | 9 lines
Correct AST_LIST_APPEND_LIST behavior when list to be appended is empty.
When the list to be appended is empty, and the list to be appended to is *not*,
AST_LIST_APPEND_LIST would actually cause the target list to become broken,
and no longer have a pointer to its last entry. This patch fixes the problem.
(reported by Stanislaw Pitucha on the asterisk-dev mailing list)
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@201263 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/linkedlists.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h index d35cfad3e..4a34e1717 100644 --- a/include/asterisk/linkedlists.h +++ b/include/asterisk/linkedlists.h @@ -730,15 +730,18 @@ struct { \ 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) { \ + if (!(list)->first) { \ + break; \ + } \ + if (!(head)->first) { \ (head)->first = (list)->first; \ (head)->last = (list)->last; \ - } else { \ + } else { \ (head)->last->field.next = (list)->first; \ (head)->last = (list)->last; \ - } \ - (list)->first = NULL; \ - (list)->last = NULL; \ + } \ + (list)->first = NULL; \ + (list)->last = NULL; \ } while (0) #define AST_RWLIST_APPEND_LIST AST_LIST_APPEND_LIST |