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

[PATCH] diff-tree: call free_commit_list() instead of duplicating its code

From
René Scharfe <l.s.r@web.de>
Date
Jul 8, 2014, 16:21 UTC
Message-ID
<53BC1A71.2010904@web.de>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 builtin/diff-tree.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index be6417d..ce0e019 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -22,14 +22,10 @@ static int stdin_diff_commit(struct commit *commit, char *line, int len)
 	if (isspace(line[40]) && !get_sha1_hex(line+41, sha1)) {
 		/* Graft the fake parents locally to the commit */
 		int pos = 41;
-		struct commit_list **pptr, *parents;
+		struct commit_list **pptr;
 
 		/* Free the real parent list */
-		for (parents = commit->parents; parents; ) {
-			struct commit_list *tmp = parents->next;
-			free(parents);
-			parents = tmp;
-		}
+		free_commit_list(commit->parents);
 		commit->parents = NULL;
 		pptr = &(commit->parents);
 		while (line[pos] && !get_sha1_hex(line + pos, sha1)) {
-- 
2.0.0
Message 1 of 1 in “diff-tree: call free_commit_list() instead of duplicating its code”
  1. diff-tree: call free_commit_list() instead of duplicating its codeRené Scharfe, Jul 8, 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.