summaryrefslogtreecommitdiff
path: root/parse-options.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-10-08 21:07:42 +0200
committerJunio C Hamano <gitster@pobox.com>2021-10-08 14:13:11 -0700
commit3c2047a711a47fbaf0b20d8f9a551c764a6c3f34 (patch)
treeaa1b88b57ac2e820a7546171375e0573c0e43354 /parse-options.c
parent7bf7f0ba05b999e890f5738e08a7f5f70b71c633 (diff)
downloadgit-3c2047a711a47fbaf0b20d8f9a551c764a6c3f34.tar.gz
parse-options.c: move optname() earlier in the file
In preparation for making "optname" a static function move it above its first user in parse-options.c. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/parse-options.c b/parse-options.c
index e33700d6e7..9e2da8383d 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -22,6 +22,21 @@ 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 struct strbuf sb = STRBUF_INIT;
+
+ strbuf_reset(&sb);
+ if (flags & OPT_SHORT)
+ strbuf_addf(&sb, "switch `%c'", opt->short_name);
+ else if (flags & OPT_UNSET)
+ strbuf_addf(&sb, "option `no-%s'", opt->long_name);
+ else
+ strbuf_addf(&sb, "option `%s'", opt->long_name);
+
+ return sb.buf;
+}
+
static enum parse_opt_result get_arg(struct parse_opt_ctx_t *p,
const struct option *opt,
int flags, const char **arg)
@@ -1006,18 +1021,3 @@ void NORETURN usage_msg_opt(const char *msg,
fprintf(stderr, "fatal: %s\n\n", msg);
usage_with_options(usagestr, options);
}
-
-const char *optname(const struct option *opt, int flags)
-{
- static struct strbuf sb = STRBUF_INIT;
-
- strbuf_reset(&sb);
- if (flags & OPT_SHORT)
- strbuf_addf(&sb, "switch `%c'", opt->short_name);
- else if (flags & OPT_UNSET)
- strbuf_addf(&sb, "option `no-%s'", opt->long_name);
- else
- strbuf_addf(&sb, "option `%s'", opt->long_name);
-
- return sb.buf;
-}