diff-tree: call free_commit_list() instead of duplicating its code
Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Jul 8, 2014 at 18:21 UTC
4602f1a4346c881289011810c5f76886ca0e2d0c
1 file changed
+2
-6
builtin/diff-tree.c
+2
-6
@@ -22,14 +22,10 @@ static int stdin_diff_commit(struct commit *commit, char *line, int len)
22
if (isspace(line[40]) && !get_sha1_hex(line+41, sha1)) {
23
/* Graft the fake parents locally to the commit */
24
int pos = 41;
25
- struct commit_list **pptr, *parents;
25
+ struct commit_list **pptr;
26
27
/* Free the real parent list */
28
- for (parents = commit->parents; parents; ) {
29
- struct commit_list *tmp = parents->next;
30
- free(parents);
31
- parents = tmp;
32
- }
28
+ free_commit_list(commit->parents);
29
commit->parents = NULL;
30
pptr = &(commit->parents);
31
while (line[pos] && !get_sha1_hex(line + pos, sha1)) {