threads / patch / 37094

patchcommit: use commit_list_append() instead of duplicating its code

Subject: [PATCH] commit: use commit_list_append() instead of duplicating its code

## tl;dr

One message between Jul 10, 2014 and Jul 10, 2014. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

René Scharfe· Jul 10, 2014, 09:47 UTC · lore
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 commit.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
Show changes to commit.c +1 −6
diff --git a/commit.c b/commit.c
index fb7897c..61d2e13 100644
--- 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;
-- 
2.0.0

← back to recent threads