summaryrefslogtreecommitdiff
path: root/builtin/fmt-merge-msg.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2015-10-24 18:21:31 +0200
committerJunio C Hamano <gitster@pobox.com>2015-10-26 14:06:46 -0700
commite510ab898865fdaf131e9bc9fd6ab6b7c4a94c9b (patch)
treee189dbe7cc56b89b1d8c2e1d884db8d1da6e4a8b /builtin/fmt-merge-msg.c
parent24358560c3c0ab51c9ef8178d99f46711716f6c0 (diff)
downloadgit-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/fmt-merge-msg.c')
-rw-r--r--builtin/fmt-merge-msg.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 05f4c26311..46c92c174f 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -536,7 +536,7 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
static void find_merge_parents(struct merge_parents *result,
struct strbuf *in, unsigned char *head)
{
- struct commit_list *parents, *next;
+ struct commit_list *parents;
struct commit *head_commit;
int pos = 0, i, j;
@@ -575,13 +575,10 @@ static void find_merge_parents(struct merge_parents *result,
parents = reduce_heads(parents);
while (parents) {
+ struct commit *cmit = pop_commit(&parents);
for (i = 0; i < result->nr; i++)
- if (!hashcmp(result->item[i].commit,
- parents->item->object.sha1))
+ if (!hashcmp(result->item[i].commit, cmit->object.sha1))
result->item[i].used = 1;
- next = parents->next;
- free(parents);
- parents = next;
}
for (i = j = 0; i < result->nr; i++) {