[PATCH 6/6] do_for_each_extra_ref(): simplify signature
From: <hidden>
Date: 2016-06-15 22:52:38
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Michael Haggerty <redacted> Now that do_for_each_extra_ref() is only called from one place, it can be less general. Signed-off-by: Michael Haggerty <redacted> --- refs.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/refs.c b/refs.c
index f52d8b5..4b2ba3f 100644
--- a/refs.c
+++ b/refs.c@@ -706,19 +706,15 @@ fallback: return -1; } -static int do_for_each_extra_ref(const char *base, each_ref_fn fn, - int trim, void *cb_data) +static int do_for_each_extra_ref(each_ref_fn fn, void *cb_data) { struct extra_ref *extra; current_ref = NULL; for (extra = extra_refs; extra; extra = extra->next) { - if (!prefixcmp(extra->name, base)) { - int retval = fn(extra->name + trim, extra->sha1, - 0, cb_data); - if (retval) - return retval; - } + int retval = fn(extra->name, extra->sha1, 0, cb_data); + if (retval) + return retval; } return 0; }
@@ -794,7 +790,7 @@ int head_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data) int for_each_ref(each_ref_fn fn, void *cb_data) { - int retval = do_for_each_extra_ref("", fn, 0, cb_data); + int retval = do_for_each_extra_ref(fn, cb_data); if (retval) return retval; return do_for_each_ref(NULL, "", fn, 0, 0, cb_data);
--
1.7.8