diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-10-30 13:07:03 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-10-30 13:07:03 -0700 |
commit | 0692a6c22c37e07ef07a3d2c5d39deaaa3c26ffe (patch) | |
tree | 4a25ada2e2aa20ecf3caf6e1af76e2ebf999cb85 /builtin/show-branch.c | |
parent | 23d58a00e55f0e5803e190ce861c5354cf19484a (diff) | |
parent | e510ab898865fdaf131e9bc9fd6ab6b7c4a94c9b (diff) | |
download | git-0692a6c22c37e07ef07a3d2c5d39deaaa3c26ffe.tar.gz |
Merge branch 'rs/pop-commit'
Code simplification.
* rs/pop-commit:
use pop_commit() for consuming the first entry of a struct commit_list
Diffstat (limited to 'builtin/show-branch.c')
-rw-r--r-- | builtin/show-branch.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 092b59b0b3..ac5141df80 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -53,17 +53,6 @@ static struct commit *interesting(struct commit_list *list) return NULL; } -static struct commit *pop_one_commit(struct commit_list **list_p) -{ - struct commit *commit; - struct commit_list *list; - list = *list_p; - commit = list->item; - *list_p = list->next; - free(list); - return commit; -} - struct commit_name { const char *head_name; /* which head's ancestor? */ int generation; /* how many parents away from head_name */ @@ -213,7 +202,7 @@ static void join_revs(struct commit_list **list_p, while (*list_p) { struct commit_list *parents; int still_interesting = !!interesting(*list_p); - struct commit *commit = pop_one_commit(list_p); + struct commit *commit = pop_commit(list_p); int flags = commit->object.flags & all_mask; if (!still_interesting && extra <= 0) @@ -504,7 +493,7 @@ static int show_merge_base(struct commit_list *seen, int num_rev) int exit_status = 1; while (seen) { - struct commit *commit = pop_one_commit(&seen); + struct commit *commit = pop_commit(&seen); int flags = commit->object.flags & all_mask; if (!(flags & UNINTERESTING) && ((flags & all_revs) == all_revs)) { @@ -929,7 +918,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) all_revs = all_mask & ~((1u << REV_SHIFT) - 1); while (seen) { - struct commit *commit = pop_one_commit(&seen); + struct commit *commit = pop_commit(&seen); int this_flag = commit->object.flags; int is_merge_point = ((this_flag & all_revs) == all_revs); |