commit: use commit_list_append() instead of duplicating its code
authorRené Scharfe <l.s.r@web.de>
Thu, 10 Jul 2014 09:47:47 +0000 (11:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 10 Jul 2014 21:07:22 +0000 (14:07 -0700)
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c
index fb7897c2a4cef3298c014cbac86081b1d6adc837..61d2e13f4870a47be3f48b7cebeee8ba4ceaee1b 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -447,12 +447,7 @@ struct commit_list *copy_commit_list(struct commit_list *list)
        struct commit_list *head = NULL;
        struct commit_list **pp = &head;
        while (list) {
-               struct commit_list *new;
-               new = xmalloc(sizeof(struct commit_list));
-               new->item = list->item;
-               new->next = NULL;
-               *pp = new;
-               pp = &new->next;
+               pp = commit_list_append(list->item, pp);
                list = list->next;
        }
        return head;