Skip to content

Commit 28794ec

Browse files
avargitster
authored andcommitted
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 9440b83 (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 1f275b7 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 13d9fce commit 28794ec

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

parse-options.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static int disallow_abbreviated_options;
1111
#define OPT_SHORT 1
1212
#define OPT_UNSET 2
1313

14-
int optbug(const struct option *opt, const char *reason)
14+
static int optbug(const struct option *opt, const char *reason)
1515
{
1616
if (opt->long_name) {
1717
if (opt->short_name)
@@ -22,7 +22,7 @@ int optbug(const struct option *opt, const char *reason)
2222
return error("BUG: switch '%c' %s", opt->short_name, reason);
2323
}
2424

25-
const char *optname(const struct option *opt, int flags)
25+
static const char *optname(const struct option *opt, int flags)
2626
{
2727
static struct strbuf sb = STRBUF_INIT;
2828

parse-options.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,6 @@ NORETURN void usage_msg_opt(const char *msg,
224224
const char * const *usagestr,
225225
const struct option *options);
226226

227-
int optbug(const struct option *opt, const char *reason);
228-
const char *optname(const struct option *opt, int flags);
229-
230227
/*
231228
* Use these assertions for callbacks that expect to be called with NONEG and
232229
* NOARG respectively, and do not otherwise handle the "unset" and "arg"

0 commit comments

Comments
 (0)