Makes append_ref and show_independent void and cleans up function calls. David Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> --- builtin-show-branch.c | 33 ++++++++++++++++++--------------- 1 files changed, 18 insertions(+), 15 deletions(-) diff --git a/builtin-show-branch.c b/builtin-show-branch.c index 2a1b848..3ce1759 100644 --- a/builtin-show-branch.c +++ b/builtin-show-branch.c @@ -346,27 +346,26 @@ static void sort_ref_range(int bottom, i compare_ref_name); } -static int append_ref(const char *refname, const unsigned char *sha1) +static void append_ref(const char *refname, const unsigned char *sha1) { struct commit *commit = lookup_commit_reference_gently(sha1, 1); int i; if (!commit) - return 0; + return; /* Avoid adding the same thing twice */ for (i = 0; i < ref_name_cnt; i++) if (!strcmp(refname, ref_name[i])) - return 0; + return; if (MAX_REVS <= ref_name_cnt) { fprintf(stderr, "warning: ignoring %s; " "cannot handle more than %d refs\n", refname, MAX_REVS); - return 0; + return; } ref_name[ref_name_cnt++] = strdup(refname); ref_name[ref_name_cnt] = NULL; - return 0; } static int append_head_ref(const char *refname, const unsigned char *sha1) @@ -380,14 +379,16 @@ static int append_head_ref(const char *r */ if (get_sha1(refname + ofs, tmp) || memcmp(tmp, sha1, 20)) ofs = 5; - return append_ref(refname + ofs, sha1); + append_ref(refname + ofs, sha1); + return 0; } static int append_tag_ref(const char *refname, const unsigned char *sha1) { if (strncmp(refname, "refs/tags/", 10)) return 0; - return append_ref(refname + 5, sha1); + append_ref(refname + 5, sha1); + return 0; } static const char *match_ref_pattern = NULL; @@ -420,7 +421,8 @@ static int append_matching_ref(const cha return append_head_ref(refname, sha1); if (!strncmp("refs/tags/", refname, 10)) return append_tag_ref(refname, sha1); - return append_ref(refname, sha1); + append_ref(refname, sha1); + return 0; } static void snarf_refs(int head, int tag) @@ -473,10 +475,10 @@ static int show_merge_base(struct commit return exit_status; } -static int show_independent(struct commit **rev, - int num_rev, - char **ref_name, - unsigned int *rev_mask) +static void show_independent(struct commit **rev, + int num_rev, + char **ref_name, + unsigned int *rev_mask) { int i; @@ -488,7 +490,6 @@ static int show_independent(struct commi puts(sha1_to_hex(commit->object.sha1)); commit->object.flags |= UNINTERESTING; } - return 0; } static void append_one_rev(const char *av) @@ -706,8 +707,10 @@ int cmd_show_branch(int ac, const char * if (merge_base) return show_merge_base(seen, num_rev); - if (independent) - return show_independent(rev, num_rev, ref_name, rev_mask); + if (independent) { + show_independent(rev, num_rev, ref_name, rev_mask); + return 0; + } /* Show list; --more=-1 means list-only */ if (1 < num_rev || extra < 0) { -- 1.4.2.g89bb-dirty - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html