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:

committed by
Junio C Hamano

parent
24358560c3
commit
e510ab8988
27
revision.c
27
revision.c
@ -149,10 +149,7 @@ void mark_parents_uninteresting(struct commit *commit)
|
||||
commit_list_insert(l->item, &parents);
|
||||
|
||||
while (parents) {
|
||||
struct commit *commit = parents->item;
|
||||
l = parents;
|
||||
parents = parents->next;
|
||||
free(l);
|
||||
struct commit *commit = pop_commit(&parents);
|
||||
|
||||
while (commit) {
|
||||
/*
|
||||
@ -1098,14 +1095,10 @@ static int limit_list(struct rev_info *revs)
|
||||
}
|
||||
|
||||
while (list) {
|
||||
struct commit_list *entry = list;
|
||||
struct commit *commit = list->item;
|
||||
struct commit *commit = pop_commit(&list);
|
||||
struct object *obj = &commit->object;
|
||||
show_early_output_fn_t show;
|
||||
|
||||
list = list->next;
|
||||
free(entry);
|
||||
|
||||
if (commit == interesting_cache)
|
||||
interesting_cache = NULL;
|
||||
|
||||
@ -2719,10 +2712,7 @@ static void simplify_merges(struct rev_info *revs)
|
||||
yet_to_do = NULL;
|
||||
tail = &yet_to_do;
|
||||
while (list) {
|
||||
commit = list->item;
|
||||
next = list->next;
|
||||
free(list);
|
||||
list = next;
|
||||
commit = pop_commit(&list);
|
||||
tail = simplify_one(revs, commit, tail);
|
||||
}
|
||||
}
|
||||
@ -2734,10 +2724,7 @@ static void simplify_merges(struct rev_info *revs)
|
||||
while (list) {
|
||||
struct merge_simplify_state *st;
|
||||
|
||||
commit = list->item;
|
||||
next = list->next;
|
||||
free(list);
|
||||
list = next;
|
||||
commit = pop_commit(&list);
|
||||
st = locate_simplify_state(revs, commit);
|
||||
if (st->simplified == commit)
|
||||
tail = &commit_list_insert(commit, tail)->next;
|
||||
@ -3111,11 +3098,7 @@ static struct commit *get_revision_1(struct rev_info *revs)
|
||||
return NULL;
|
||||
|
||||
do {
|
||||
struct commit_list *entry = revs->commits;
|
||||
struct commit *commit = entry->item;
|
||||
|
||||
revs->commits = entry->next;
|
||||
free(entry);
|
||||
struct commit *commit = pop_commit(&revs->commits);
|
||||
|
||||
if (revs->reflog_info) {
|
||||
save_parents(revs, commit);
|
||||
|
Reference in New Issue
Block a user