diff options
author | René Scharfe <l.s.r@web.de> | 2015-10-24 18:21:31 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-10-26 14:06:46 -0700 |
commit | e510ab898865fdaf131e9bc9fd6ab6b7c4a94c9b (patch) | |
tree | e189dbe7cc56b89b1d8c2e1d884db8d1da6e4a8b /builtin/merge.c | |
parent | 24358560c3c0ab51c9ef8178d99f46711716f6c0 (diff) | |
download | git-e510ab898865fdaf131e9bc9fd6ab6b7c4a94c9b.tar.gz |
use pop_commit() for consuming the first entry of a struct commit_listrs/pop-commit
Instead of open-coding the function pop_commit() just call it. This
makes the intent clearer and reduces code size.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge.c')
-rw-r--r-- | builtin/merge.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/builtin/merge.c b/builtin/merge.c index 85c54dcd5a..63563b9ab0 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1019,7 +1019,7 @@ static struct commit_list *reduce_parents(struct commit *head_commit, int *head_subsumed, struct commit_list *remoteheads) { - struct commit_list *parents, *next, **remotes = &remoteheads; + struct commit_list *parents, **remotes; /* * Is the current HEAD reachable from another commit being @@ -1033,16 +1033,14 @@ static struct commit_list *reduce_parents(struct commit *head_commit, /* Find what parents to record by checking independent ones. */ parents = reduce_heads(remoteheads); - for (remoteheads = NULL, remotes = &remoteheads; - parents; - parents = next) { - struct commit *commit = parents->item; - next = parents->next; + remoteheads = NULL; + remotes = &remoteheads; + while (parents) { + struct commit *commit = pop_commit(&parents); if (commit == head_commit) *head_subsumed = 0; else remotes = &commit_list_insert(commit, remotes)->next; - free(parents); } return remoteheads; } |