config: mark unused callback parameters
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>
Jeff King committed
Aug 19, 2022 at 06:08 UTC
783a86c1427637d71fb2710291e677360ab5dc09
23 files changed
+41
-26
archive-tar.c
+2
-1
@@ -366,7 +366,8 @@ static struct archiver *find_tar_filter(const char *name, size_t len)
366
return NULL;
367
}
368
369
-static int tar_filter_config(const char *var, const char *value, void *data)
369
+static int tar_filter_config(const char *var, const char *value,
370
+ void *UNUSED(data))
371
{
372
struct archiver *ar;
373
const char *name;
archive-zip.c
+2
-1
@@ -612,7 +612,8 @@ static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time)
612
*dos_time = tm.tm_sec / 2 + tm.tm_min * 32 + tm.tm_hour * 2048;
613
}
614
615
-static int archive_zip_config(const char *var, const char *value, void *data)
615
+static int archive_zip_config(const char *var, const char *value,
616
+ void *UNUSED(data))
617
{
618
return userdiff_config(var, value);
619
}
builtin/am.c
+1
-1
@@ -2301,7 +2301,7 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
2301
return 0;
2302
}
2303
2304
-static int git_am_config(const char *k, const char *v, void *cb)
2304
+static int git_am_config(const char *k, const char *v, void *UNUSED(cb))
2305
{
2306
int status;
2307
builtin/commit-graph.c
+1
-1
@@ -179,7 +179,7 @@ static int write_option_max_new_filters(const struct option *opt,
179
}
180
181
static int git_commit_graph_write_config(const char *var, const char *value,
182
- void *cb)
182
+ void *UNUSED(cb))
183
{
184
if (!strcmp(var, "commitgraph.maxnewfilters"))
185
write_opts.max_new_filters = git_config_int(var, value);
builtin/config.c
+5
-3
@@ -207,7 +207,8 @@ static void show_config_scope(struct strbuf *buf)
207
strbuf_addch(buf, term);
208
}
209
210
-static int show_all_config(const char *key_, const char *value_, void *cb)
210
+static int show_all_config(const char *key_, const char *value_,
211
+ void *UNUSED(cb))
212
{
213
if (show_origin || show_scope) {
214
struct strbuf buf = STRBUF_INIT;
@@ -458,7 +459,8 @@ static const char *get_color_slot;
459
static const char *get_colorbool_slot;
460
static char parsed_color[COLOR_MAXLEN];
461
461
-static int git_get_color_config(const char *var, const char *value, void *cb)
462
+static int git_get_color_config(const char *var, const char *value,
463
+ void *UNUSED(cb))
464
{
465
if (!strcmp(var, get_color_slot)) {
466
if (!value)
@@ -490,7 +492,7 @@ static int get_colorbool_found;
492
static int get_diff_color_found;
493
static int get_color_ui_found;
494
static int git_get_colorbool_config(const char *var, const char *value,
493
- void *cb)
495
+ void *UNUSED(data))
496
{
497
if (!strcmp(var, get_colorbool_slot))
498
get_colorbool_found = git_config_colorbool(var, value);
builtin/multi-pack-index.c
+1
-1
@@ -78,7 +78,7 @@ static struct option *add_common_options(struct option *prev)
78
}
79
80
static int git_multi_pack_index_write_config(const char *var, const char *value,
81
- void *cb)
81
+ void *UNUSED(cb))
82
{
83
if (!strcmp(var, "pack.writebitmaphashcache")) {
84
if (git_config_bool(var, value))
builtin/remote.c
+1
-1
@@ -1486,7 +1486,7 @@ static int prune(int argc, const char **argv)
1486
return result;
1487
}
1488
1489
-static int get_remote_default(const char *key, const char *value, void *priv)
1489
+static int get_remote_default(const char *key, const char *UNUSED(value), void *priv)
1490
{
1491
if (strcmp(key, "remotes.default") == 0) {
1492
int *found = priv;
color.c
+1
-1
@@ -415,7 +415,7 @@ int want_color_fd(int fd, int var)
415
return var;
416
}
417
418
-int git_color_config(const char *var, const char *value, void *cb)
418
+int git_color_config(const char *var, const char *value, void *UNUSED(cb))
419
{
420
if (!strcmp(var, "color.ui")) {
421
git_use_color_default = git_config_colorbool(var, value);
config.c
+2
-1
@@ -362,7 +362,8 @@ static void populate_remote_urls(struct config_include_data *inc)
362
current_parsing_scope = store_scope;
363
}
364
365
-static int forbid_remote_url(const char *var, const char *value, void *data)
365
+static int forbid_remote_url(const char *var, const char *UNUSED(value),
366
+ void *UNUSED(data))
367
{
368
const char *remote_name;
369
size_t remote_name_len;
convert.c
+1
-1
@@ -1008,7 +1008,7 @@ static int apply_filter(const char *path, const char *src, size_t len,
1008
return 0;
1009
}
1010
1011
-static int read_convert_config(const char *var, const char *value, void *cb)
1011
+static int read_convert_config(const char *var, const char *value, void *UNUSED(cb))
1012
{
1013
const char *key, *name;
1014
size_t namelen;
delta-islands.c
+1
-1
@@ -316,7 +316,7 @@ static regex_t *island_regexes;
316
static unsigned int island_regexes_alloc, island_regexes_nr;
317
static const char *core_island_name;
318
319
-static int island_config_callback(const char *k, const char *v, void *cb)
319
+static int island_config_callback(const char *k, const char *v, void *UNUSED(cb))
320
{
321
if (!strcmp(k, "pack.island")) {
322
struct strbuf re = STRBUF_INIT;
diff.c
+2
-1
@@ -264,7 +264,8 @@ void init_diff_ui_defaults(void)
264
diff_detect_rename_default = DIFF_DETECT_RENAME;
265
}
266
267
-int git_diff_heuristic_config(const char *var, const char *value, void *cb)
267
+int git_diff_heuristic_config(const char *var, const char *value,
268
+ void *UNUSED(cb))
269
{
270
if (!strcmp(var, "diff.indentheuristic"))
271
diff_indent_heuristic = git_config_bool(var, value);
git-compat-util.h
+3
-1
@@ -403,7 +403,9 @@ typedef uintmax_t timestamp_t;
403
#endif
404
405
#ifndef platform_core_config
406
-static inline int noop_core_config(const char *var, const char *value, void *cb)
406
+static inline int noop_core_config(const char *UNUSED(var),
407
+ const char *UNUSED(value),
408
+ void *UNUSED(cb))
409
{
410
return 0;
411
}
gpg-interface.c
+1
-1
@@ -699,7 +699,7 @@ void set_signing_key(const char *key)
699
configured_signing_key = xstrdup(key);
700
}
701
702
-int git_gpg_config(const char *var, const char *value, void *cb)
702
+int git_gpg_config(const char *var, const char *value, void *UNUSED(cb))
703
{
704
struct gpg_format *fmt = NULL;
705
char *fmtname = NULL;
ident.c
+1
-1
@@ -668,7 +668,7 @@ static int set_ident(const char *var, const char *value)
668
return 0;
669
}
670
671
-int git_ident_config(const char *var, const char *value, void *data)
671
+int git_ident_config(const char *var, const char *value, void *UNUSED(data))
672
{
673
if (!strcmp(var, "user.useconfigonly")) {
674
ident_use_config_only = git_config_bool(var, value);
ll-merge.c
+2
-1
@@ -249,7 +249,8 @@ static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn,
249
static struct ll_merge_driver *ll_user_merge, **ll_user_merge_tail;
250
static const char *default_ll_merge;
251
252
-static int read_merge_config(const char *var, const char *value, void *cb)
252
+static int read_merge_config(const char *var, const char *value,
253
+ void *UNUSED(cb))
254
{
255
struct ll_merge_driver *fn;
256
const char *key, *name;
ls-refs.c
+2
-1
@@ -136,7 +136,8 @@ static void send_possibly_unborn_head(struct ls_refs_data *data)
136
strbuf_release(&namespaced);
137
}
138
139
-static int ls_refs_config(const char *var, const char *value, void *data)
139
+static int ls_refs_config(const char *var, const char *value,
140
+ void *UNUSED(data))
141
{
142
/*
143
* We only serve fetches over v2 for now, so respect only "uploadpack"
pager.c
+2
-1
@@ -38,7 +38,8 @@ static void wait_for_pager_signal(int signo)
38
raise(signo);
39
}
40
41
-static int core_pager_config(const char *var, const char *value, void *data)
41
+static int core_pager_config(const char *var, const char *value,
42
+ void *UNUSED(data))
43
{
44
if (!strcmp(var, "core.pager"))
45
return git_config_string(&pager_program, var, value);
pretty.c
+2
-1
@@ -43,7 +43,8 @@ static void save_user_format(struct rev_info *rev, const char *cp, int is_tforma
43
rev->commit_format = CMIT_FMT_USERFORMAT;
44
}
45
46
-static int git_pretty_formats_config(const char *var, const char *value, void *cb)
46
+static int git_pretty_formats_config(const char *var, const char *value,
47
+ void *UNUSED(cb))
48
{
49
struct cmt_fmt_map *commit_format = NULL;
50
const char *name;
submodule.c
+2
-1
@@ -213,7 +213,8 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
213
}
214
215
/* Cheap function that only determines if we're interested in submodules at all */
216
-int git_default_submodule_config(const char *var, const char *value, void *cb)
216
+int git_default_submodule_config(const char *var, const char *value,
217
+ void *UNUSED(cb))
218
{
219
if (!strcmp(var, "submodule.recurse")) {
220
int v = git_config_bool(var, value) ?
t/helper/test-config.c
+1
-1
@@ -37,7 +37,7 @@
37
*
38
*/
39
40
-static int iterate_cb(const char *var, const char *value, void *data)
40
+static int iterate_cb(const char *var, const char *value, void *UNUSED(data))
41
{
42
static int nr;
43
t/helper/test-userdiff.c
+1
-1
@@ -12,7 +12,7 @@ static int driver_cb(struct userdiff_driver *driver,
12
return 0;
13
}
14
15
-static int cmd__userdiff_config(const char *var, const char *value, void *cb)
15
+static int cmd__userdiff_config(const char *var, const char *value, void *UNUSED(cb))
16
{
17
if (userdiff_config(var, value) < 0)
18
return -1;
trailer.c
+4
-2
@@ -478,7 +478,8 @@ static struct {
478
{ "ifmissing", TRAILER_IF_MISSING }
479
};
480
481
-static int git_trailer_default_config(const char *conf_key, const char *value, void *cb)
481
+static int git_trailer_default_config(const char *conf_key, const char *value,
482
+ void *UNUSED(cb))
483
{
484
const char *trailer_item, *variable_name;
485
@@ -509,7 +510,8 @@ static int git_trailer_default_config(const char *conf_key, const char *value, v
510
return 0;
511
}
512
512
-static int git_trailer_config(const char *conf_key, const char *value, void *cb)
513
+static int git_trailer_config(const char *conf_key, const char *value,
514
+ void *UNUSED(cb))
515
{
516
const char *trailer_item, *variable_name;
517
struct arg_item *item;