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 9440b831ad (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 1f275b7c4c (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>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2021-10-08 21:07:44 +02:00 committed by Junio C Hamano
parent 13d9fcec29
commit 28794ec72e
2 changed files with 2 additions and 5 deletions

View File

@ -11,7 +11,7 @@ static int disallow_abbreviated_options;
#define OPT_SHORT 1
#define OPT_UNSET 2
int optbug(const struct option *opt, const char *reason)
static int optbug(const struct option *opt, const char *reason)
{
if (opt->long_name) {
if (opt->short_name)
@ -22,7 +22,7 @@ int optbug(const struct option *opt, const char *reason)
return error("BUG: switch '%c' %s", opt->short_name, reason);
}
const char *optname(const struct option *opt, int flags)
static const char *optname(const struct option *opt, int flags)
{
static struct strbuf sb = STRBUF_INIT;

View File

@ -224,9 +224,6 @@ NORETURN void usage_msg_opt(const char *msg,
const char * const *usagestr,
const struct option *options);
int optbug(const struct option *opt, const char *reason);
const char *optname(const struct option *opt, int flags);
/*
* Use these assertions for callbacks that expect to be called with NONEG and
* NOARG respectively, and do not otherwise handle the "unset" and "arg"