]> Kevux Git Server - rit/commitdiff
config: mark unused callback parameters
authorJeff King <peff@peff.net>
Fri, 19 Aug 2022 10:08:44 +0000 (06:08 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Aug 2022 19:18:55 +0000 (12:18 -0700)
The callback passed to git_config() must conform to a particular
interface. But most callbacks don't actually look at the extra "void
*data" parameter. Let's mark the unused parameters to make
-Wunused-parameter happy.

Note there's one unusual case here in get_remote_default() where we
actually ignore the "value" parameter. That's because it's only checking
whether the option is found at all, and not parsing its value.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 files changed:
archive-tar.c
archive-zip.c
builtin/am.c
builtin/commit-graph.c
builtin/config.c
builtin/multi-pack-index.c
builtin/remote.c
color.c
config.c
convert.c
delta-islands.c
diff.c
git-compat-util.h
gpg-interface.c
ident.c
ll-merge.c
ls-refs.c
pager.c
pretty.c
submodule.c
t/helper/test-config.c
t/helper/test-userdiff.c
trailer.c

index 3d77e0f..45e5d91 100644 (file)
@@ -366,7 +366,8 @@ static struct archiver *find_tar_filter(const char *name, size_t len)
        return NULL;
 }
 
-static int tar_filter_config(const char *var, const char *value, void *data)
+static int tar_filter_config(const char *var, const char *value,
+                            void *UNUSED(data))
 {
        struct archiver *ar;
        const char *name;
index 9fe43d7..854bceb 100644 (file)
@@ -612,7 +612,8 @@ static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time)
        *dos_time = tm.tm_sec / 2 + tm.tm_min * 32 + tm.tm_hour * 2048;
 }
 
-static int archive_zip_config(const char *var, const char *value, void *data)
+static int archive_zip_config(const char *var, const char *value,
+                             void *UNUSED(data))
 {
        return userdiff_config(var, value);
 }
index 93bec62..0811b9f 100644 (file)
@@ -2301,7 +2301,7 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
        return 0;
 }
 
-static int git_am_config(const char *k, const char *v, void *cb)
+static int git_am_config(const char *k, const char *v, void *UNUSED(cb))
 {
        int status;
 
index 51c4040..ea923ea 100644 (file)
@@ -179,7 +179,7 @@ static int write_option_max_new_filters(const struct option *opt,
 }
 
 static int git_commit_graph_write_config(const char *var, const char *value,
-                                        void *cb)
+                                        void *UNUSED(cb))
 {
        if (!strcmp(var, "commitgraph.maxnewfilters"))
                write_opts.max_new_filters = git_config_int(var, value);
index e7b88a9..bdc8b1d 100644 (file)
@@ -207,7 +207,8 @@ static void show_config_scope(struct strbuf *buf)
        strbuf_addch(buf, term);
 }
 
-static int show_all_config(const char *key_, const char *value_, void *cb)
+static int show_all_config(const char *key_, const char *value_,
+                          void *UNUSED(cb))
 {
        if (show_origin || show_scope) {
                struct strbuf buf = STRBUF_INIT;
@@ -458,7 +459,8 @@ static const char *get_color_slot;
 static const char *get_colorbool_slot;
 static char parsed_color[COLOR_MAXLEN];
 
-static int git_get_color_config(const char *var, const char *value, void *cb)
+static int git_get_color_config(const char *var, const char *value,
+                               void *UNUSED(cb))
 {
        if (!strcmp(var, get_color_slot)) {
                if (!value)
@@ -490,7 +492,7 @@ static int get_colorbool_found;
 static int get_diff_color_found;
 static int get_color_ui_found;
 static int git_get_colorbool_config(const char *var, const char *value,
-               void *cb)
+                                   void *UNUSED(data))
 {
        if (!strcmp(var, get_colorbool_slot))
                get_colorbool_found = git_config_colorbool(var, value);
index 8f24d59..8d15676 100644 (file)
@@ -78,7 +78,7 @@ static struct option *add_common_options(struct option *prev)
 }
 
 static int git_multi_pack_index_write_config(const char *var, const char *value,
-                                            void *cb)
+                                            void *UNUSED(cb))
 {
        if (!strcmp(var, "pack.writebitmaphashcache")) {
                if (git_config_bool(var, value))
index b390360..87dda7c 100644 (file)
@@ -1486,7 +1486,7 @@ static int prune(int argc, const char **argv)
        return result;
 }
 
-static int get_remote_default(const char *key, const char *value, void *priv)
+static int get_remote_default(const char *key, const char *UNUSED(value), void *priv)
 {
        if (strcmp(key, "remotes.default") == 0) {
                int *found = priv;
diff --git a/color.c b/color.c
index 4f884c6..04ad0a8 100644 (file)
--- a/color.c
+++ b/color.c
@@ -415,7 +415,7 @@ int want_color_fd(int fd, int var)
        return var;
 }
 
-int git_color_config(const char *var, const char *value, void *cb)
+int git_color_config(const char *var, const char *value, void *UNUSED(cb))
 {
        if (!strcmp(var, "color.ui")) {
                git_use_color_default = git_config_colorbool(var, value);
index e8ebef7..589dec9 100644 (file)
--- a/config.c
+++ b/config.c
@@ -362,7 +362,8 @@ static void populate_remote_urls(struct config_include_data *inc)
        current_parsing_scope = store_scope;
 }
 
-static int forbid_remote_url(const char *var, const char *value, void *data)
+static int forbid_remote_url(const char *var, const char *UNUSED(value),
+                            void *UNUSED(data))
 {
        const char *remote_name;
        size_t remote_name_len;
index 4d15372..b31a25b 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -1008,7 +1008,7 @@ static int apply_filter(const char *path, const char *src, size_t len,
        return 0;
 }
 
-static int read_convert_config(const char *var, const char *value, void *cb)
+static int read_convert_config(const char *var, const char *value, void *UNUSED(cb))
 {
        const char *key, *name;
        size_t namelen;
index 13eb96e..c64333f 100644 (file)
@@ -316,7 +316,7 @@ static regex_t *island_regexes;
 static unsigned int island_regexes_alloc, island_regexes_nr;
 static const char *core_island_name;
 
-static int island_config_callback(const char *k, const char *v, void *cb)
+static int island_config_callback(const char *k, const char *v, void *UNUSED(cb))
 {
        if (!strcmp(k, "pack.island")) {
                struct strbuf re = STRBUF_INIT;
diff --git a/diff.c b/diff.c
index 974626a..8a9c908 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -264,7 +264,8 @@ void init_diff_ui_defaults(void)
        diff_detect_rename_default = DIFF_DETECT_RENAME;
 }
 
-int git_diff_heuristic_config(const char *var, const char *value, void *cb)
+int git_diff_heuristic_config(const char *var, const char *value,
+                             void *UNUSED(cb))
 {
        if (!strcmp(var, "diff.indentheuristic"))
                diff_indent_heuristic = git_config_bool(var, value);
index c6669db..12239fe 100644 (file)
@@ -403,7 +403,9 @@ typedef uintmax_t timestamp_t;
 #endif
 
 #ifndef platform_core_config
-static inline int noop_core_config(const char *var, const char *value, void *cb)
+static inline int noop_core_config(const char *UNUSED(var),
+                                  const char *UNUSED(value),
+                                  void *UNUSED(cb))
 {
        return 0;
 }
index 6dff241..721d69b 100644 (file)
@@ -699,7 +699,7 @@ void set_signing_key(const char *key)
        configured_signing_key = xstrdup(key);
 }
 
-int git_gpg_config(const char *var, const char *value, void *cb)
+int git_gpg_config(const char *var, const char *value, void *UNUSED(cb))
 {
        struct gpg_format *fmt = NULL;
        char *fmtname = NULL;
diff --git a/ident.c b/ident.c
index 7f66bed..48745a1 100644 (file)
--- a/ident.c
+++ b/ident.c
@@ -668,7 +668,7 @@ static int set_ident(const char *var, const char *value)
        return 0;
 }
 
-int git_ident_config(const char *var, const char *value, void *data)
+int git_ident_config(const char *var, const char *value, void *UNUSED(data))
 {
        if (!strcmp(var, "user.useconfigonly")) {
                ident_use_config_only = git_config_bool(var, value);
index 14b8362..9f3ae1f 100644 (file)
@@ -249,7 +249,8 @@ static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn,
 static struct ll_merge_driver *ll_user_merge, **ll_user_merge_tail;
 static const char *default_ll_merge;
 
-static int read_merge_config(const char *var, const char *value, void *cb)
+static int read_merge_config(const char *var, const char *value,
+                            void *UNUSED(cb))
 {
        struct ll_merge_driver *fn;
        const char *key, *name;
index 98e6937..e54b883 100644 (file)
--- a/ls-refs.c
+++ b/ls-refs.c
@@ -136,7 +136,8 @@ static void send_possibly_unborn_head(struct ls_refs_data *data)
        strbuf_release(&namespaced);
 }
 
-static int ls_refs_config(const char *var, const char *value, void *data)
+static int ls_refs_config(const char *var, const char *value,
+                         void *UNUSED(data))
 {
        /*
         * We only serve fetches over v2 for now, so respect only "uploadpack"
diff --git a/pager.c b/pager.c
index 5cfe23b..19c016f 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -38,7 +38,8 @@ static void wait_for_pager_signal(int signo)
        raise(signo);
 }
 
-static int core_pager_config(const char *var, const char *value, void *data)
+static int core_pager_config(const char *var, const char *value,
+                            void *UNUSED(data))
 {
        if (!strcmp(var, "core.pager"))
                return git_config_string(&pager_program, var, value);
index 6d81910..584026b 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -43,7 +43,8 @@ static void save_user_format(struct rev_info *rev, const char *cp, int is_tforma
        rev->commit_format = CMIT_FMT_USERFORMAT;
 }
 
-static int git_pretty_formats_config(const char *var, const char *value, void *cb)
+static int git_pretty_formats_config(const char *var, const char *value,
+                                    void *UNUSED(cb))
 {
        struct cmt_fmt_map *commit_format = NULL;
        const char *name;
index d99c978..597a347 100644 (file)
@@ -213,7 +213,8 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
 }
 
 /* Cheap function that only determines if we're interested in submodules at all */
-int git_default_submodule_config(const char *var, const char *value, void *cb)
+int git_default_submodule_config(const char *var, const char *value,
+                                void *UNUSED(cb))
 {
        if (!strcmp(var, "submodule.recurse")) {
                int v = git_config_bool(var, value) ?
index a6e9367..ddd538b 100644 (file)
@@ -37,7 +37,7 @@
  *
  */
 
-static int iterate_cb(const char *var, const char *value, void *data)
+static int iterate_cb(const char *var, const char *value, void *UNUSED(data))
 {
        static int nr;
 
index f013f8a..64538a0 100644 (file)
@@ -12,7 +12,7 @@ static int driver_cb(struct userdiff_driver *driver,
        return 0;
 }
 
-static int cmd__userdiff_config(const char *var, const char *value, void *cb)
+static int cmd__userdiff_config(const char *var, const char *value, void *UNUSED(cb))
 {
        if (userdiff_config(var, value) < 0)
                return -1;
index d419c20..a1e8047 100644 (file)
--- a/trailer.c
+++ b/trailer.c
@@ -478,7 +478,8 @@ static struct {
        { "ifmissing", TRAILER_IF_MISSING }
 };
 
-static int git_trailer_default_config(const char *conf_key, const char *value, void *cb)
+static int git_trailer_default_config(const char *conf_key, const char *value,
+                                     void *UNUSED(cb))
 {
        const char *trailer_item, *variable_name;
 
@@ -509,7 +510,8 @@ static int git_trailer_default_config(const char *conf_key, const char *value, v
        return 0;
 }
 
-static int git_trailer_config(const char *conf_key, const char *value, void *cb)
+static int git_trailer_config(const char *conf_key, const char *value,
+                             void *UNUSED(cb))
 {
        const char *trailer_item, *variable_name;
        struct arg_item *item;