aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/interpret-trailers.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-09-13 10:07:56 -0700
committerJunio C Hamano <gitster@pobox.com>2023-09-13 10:07:56 -0700
commitc52a02a0f0025df0e83ba00dc469df0dc8838b5e (patch)
treed9f0443321dd00ead23b84b184c61476d0a15aee /builtin/interpret-trailers.c
parent94e83dcf5b5faaa22e32729305f8fd7090bfdfed (diff)
parent0058b3d5eedcf5777712e872e01f74bf8d933be7 (diff)
downloadgit-c52a02a0f0025df0e83ba00dc469df0dc8838b5e.tar.gz
Merge branch 'jk/unused-post-2.42-part2'
Unused parameters to functions are marked as such, and/or removed, in order to bring us closer to -Wunused-parameter clean. * jk/unused-post-2.42-part2: parse-options: mark unused parameters in noop callback interpret-trailers: mark unused "unset" parameters in option callbacks parse-options: add more BUG_ON() annotations merge: do not pass unused opt->value parameter parse-options: mark unused "opt" parameter in callbacks parse-options: prefer opt->value to globals in callbacks checkout-index: delay automatic setting of to_tempfile format-patch: use OPT_STRING_LIST for to/cc options merge: simplify parsing of "-n" option merge: make xopts a strvec
Diffstat (limited to 'builtin/interpret-trailers.c')
-rw-r--r--builtin/interpret-trailers.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c
index c5e8345265..a110e69f83 100644
--- a/builtin/interpret-trailers.c
+++ b/builtin/interpret-trailers.c
@@ -24,21 +24,24 @@ static enum trailer_if_exists if_exists;
static enum trailer_if_missing if_missing;
static int option_parse_where(const struct option *opt,
- const char *arg, int unset)
+ const char *arg, int unset UNUSED)
{
- return trailer_set_where(&where, arg);
+ /* unset implies NULL arg, which is handled in our helper */
+ return trailer_set_where(opt->value, arg);
}
static int option_parse_if_exists(const struct option *opt,
- const char *arg, int unset)
+ const char *arg, int unset UNUSED)
{
- return trailer_set_if_exists(&if_exists, arg);
+ /* unset implies NULL arg, which is handled in our helper */
+ return trailer_set_if_exists(opt->value, arg);
}
static int option_parse_if_missing(const struct option *opt,
- const char *arg, int unset)
+ const char *arg, int unset UNUSED)
{
- return trailer_set_if_missing(&if_missing, arg);
+ /* unset implies NULL arg, which is handled in our helper */
+ return trailer_set_if_missing(opt->value, arg);
}
static void new_trailers_clear(struct list_head *trailers)
@@ -97,11 +100,11 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix)
OPT_BOOL(0, "in-place", &opts.in_place, N_("edit files in place")),
OPT_BOOL(0, "trim-empty", &opts.trim_empty, N_("trim empty trailers")),
- OPT_CALLBACK(0, "where", NULL, N_("action"),
+ OPT_CALLBACK(0, "where", &where, N_("action"),
N_("where to place the new trailer"), option_parse_where),
- OPT_CALLBACK(0, "if-exists", NULL, N_("action"),
+ OPT_CALLBACK(0, "if-exists", &if_exists, N_("action"),
N_("action if trailer already exists"), option_parse_if_exists),
- OPT_CALLBACK(0, "if-missing", NULL, N_("action"),
+ OPT_CALLBACK(0, "if-missing", &if_missing, N_("action"),
N_("action if trailer is missing"), option_parse_if_missing),
OPT_BOOL(0, "only-trailers", &opts.only_trailers, N_("output only the trailers")),