git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
René Scharfe <l.s.r@web.de>
Date
Jul 10, 2014, 09:47 UTC
Message-ID
<53BE6143.1000507@web.de>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 commit.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
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
Message 1 of 1 in “commit: use commit_list_append() instead of duplicating its code”
  1. commit: use commit_list_append() instead of duplicating its codeRené Scharfe, Jul 10, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.