Skip to content

Commit cb979db

Browse files
rscharfegitster
authored andcommitted
commit: use commit_list_append() instead of duplicating its code
Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 910a09a commit cb979db

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

commit.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,7 @@ struct commit_list *copy_commit_list(struct commit_list *list)
447447
struct commit_list *head = NULL;
448448
struct commit_list **pp = &head;
449449
while (list) {
450-
struct commit_list *new;
451-
new = xmalloc(sizeof(struct commit_list));
452-
new->item = list->item;
453-
new->next = NULL;
454-
*pp = new;
455-
pp = &new->next;
450+
pp = commit_list_append(list->item, pp);
456451
list = list->next;
457452
}
458453
return head;

0 commit comments

Comments
 (0)