]> git.ipfire.org Git - thirdparty/git.git/commitdiff
parse-options.[ch]: make opt{bug,name}() "static"
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 8 Oct 2021 19:07:44 +0000 (21:07 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Oct 2021 21:13:11 +0000 (14:13 -0700)
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>
parse-options.c
parse-options.h

index 9e2da8383d7468c5c1f82e1003076a359a287701..64bd4c32854095b347f7915e40daad0fb7d58419 100644 (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;
 
index 74b66ba6e935e6d7213c5861e1d89124c756afa7..dd79c9c566f8d7642bbdf67adc89b957788c58af 100644 (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"