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: https://origsvn.digium.com/svn/asterisk/branches/1.4@201261 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2009-06-17 12:03:25 +00:00
parent 94fa4d11b5
commit b8417b571b

View File

@@ -691,6 +691,9 @@ struct { \
calling this macro (the list entries are \b moved to the target list).
*/
#define AST_LIST_APPEND_LIST(head, list, field) do { \
if (!(list)->first) { \
break; \
} \
if (!(head)->first) { \
(head)->first = (list)->first; \
(head)->last = (list)->last; \