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

@ -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;
}