use pop_commit() for consuming the first entry of a struct commit_list

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>
This commit is contained in:
René Scharfe
2015-10-24 18:21:31 +02:00
committed by Junio C Hamano
parent 24358560c3
commit e510ab8988
10 changed files with 31 additions and 92 deletions

View File

@ -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++) {