parse-options.[ch]: make opt{bug,name}() "static"
Change these two functions to "static", the last user of "optname()" outside of parse-options.c itself went away in the preceding commit, for the reasons noted in 9440b831ad5 (parse-options: replace opterror() with optname(), 2018-11-10) we shouldn't be adding any more users of it. The "optbug()" function was never used outside of parse-options.c, but was made non-static in 1f275b7c4ca (parse-options: export opterr, optbug, 2011-08-11). I think the only external user of optname() was the commit-graph.c caller added in 09e0327f57 (builtin/commit-graph.c: introduce '--max-new-filters=<n>', 2020-09-18). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Oct 8, 2021 at 21:07 UTC
28794ec72e284ba398b562bc117e091853ef0332
2 files changed
+2
-5
parse-options.c
+2
-2
@@ -11,7 +11,7 @@ static int disallow_abbreviated_options;
11
#define OPT_SHORT 1
12
#define OPT_UNSET 2
13
14
-int optbug(const struct option *opt, const char *reason)
14
+static int optbug(const struct option *opt, const char *reason)
15
{
16
if (opt->long_name) {
17
if (opt->short_name)
@@ -22,7 +22,7 @@ int optbug(const struct option *opt, const char *reason)
22
return error("BUG: switch '%c' %s", opt->short_name, reason);
23
}
24
25
-const char *optname(const struct option *opt, int flags)
25
+static const char *optname(const struct option *opt, int flags)
26
{
27
static struct strbuf sb = STRBUF_INIT;
28
parse-options.h
-3
@@ -224,9 +224,6 @@ NORETURN void usage_msg_opt(const char *msg,
224
const char * const *usagestr,
225
const struct option *options);
226
227
-int optbug(const struct option *opt, const char *reason);
228
-const char *optname(const struct option *opt, int flags);
229
-
227
/*
228
* Use these assertions for callbacks that expect to be called with NONEG and
229
* NOARG respectively, and do not otherwise handle the "unset" and "arg"