summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-12-11 11:14:12 -0800
committerJunio C Hamano <gitster@pobox.com>2015-12-11 11:14:13 -0800
commit0af22d6fffe5169f641fb9815468ae97e47cd73f (patch)
treee61f2ffb0f66e0d8c5892c0795b6f8a521e4f2c9 /revision.c
parent8c0a546670a2cb2349c5baedbf4b87268e52c665 (diff)
parente510ab898865fdaf131e9bc9fd6ab6b7c4a94c9b (diff)
downloadgit-0af22d6fffe5169f641fb9815468ae97e47cd73f.tar.gz
Merge branch 'rs/pop-commit' into maint
Code simplification. * rs/pop-commit: use pop_commit() for consuming the first entry of a struct commit_list
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/revision.c b/revision.c
index af2a18ed74..351fb5b9f1 100644
--- a/revision.c
+++ b/revision.c
@@ -153,10 +153,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) {
/*
@@ -1102,14 +1099,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;
@@ -2733,10 +2726,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);
}
}
@@ -2748,10 +2738,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;
@@ -3125,11 +3112,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);