Skip to content

Commit 783a86c

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9f5a9de commit 783a86c

23 files changed

+41
-26
lines changed

archive-tar.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ static struct archiver *find_tar_filter(const char *name, size_t len)
366366
return NULL;
367367
}
368368

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))
370371
{
371372
struct archiver *ar;
372373
const char *name;

archive-zip.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@ static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time)
612612
*dos_time = tm.tm_sec / 2 + tm.tm_min * 32 + tm.tm_hour * 2048;
613613
}
614614

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))
616617
{
617618
return userdiff_config(var, value);
618619
}

builtin/am.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,7 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
23012301
return 0;
23022302
}
23032303

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))
23052305
{
23062306
int status;
23072307

builtin/commit-graph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static int write_option_max_new_filters(const struct option *opt,
179179
}
180180

181181
static int git_commit_graph_write_config(const char *var, const char *value,
182-
void *cb)
182+
void *UNUSED(cb))
183183
{
184184
if (!strcmp(var, "commitgraph.maxnewfilters"))
185185
write_opts.max_new_filters = git_config_int(var, value);

builtin/config.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ static void show_config_scope(struct strbuf *buf)
207207
strbuf_addch(buf, term);
208208
}
209209

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))
211212
{
212213
if (show_origin || show_scope) {
213214
struct strbuf buf = STRBUF_INIT;
@@ -458,7 +459,8 @@ static const char *get_color_slot;
458459
static const char *get_colorbool_slot;
459460
static char parsed_color[COLOR_MAXLEN];
460461

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))
462464
{
463465
if (!strcmp(var, get_color_slot)) {
464466
if (!value)
@@ -490,7 +492,7 @@ static int get_colorbool_found;
490492
static int get_diff_color_found;
491493
static int get_color_ui_found;
492494
static int git_get_colorbool_config(const char *var, const char *value,
493-
void *cb)
495+
void *UNUSED(data))
494496
{
495497
if (!strcmp(var, get_colorbool_slot))
496498
get_colorbool_found = git_config_colorbool(var, value);

builtin/multi-pack-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static struct option *add_common_options(struct option *prev)
7878
}
7979

8080
static int git_multi_pack_index_write_config(const char *var, const char *value,
81-
void *cb)
81+
void *UNUSED(cb))
8282
{
8383
if (!strcmp(var, "pack.writebitmaphashcache")) {
8484
if (git_config_bool(var, value))

builtin/remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ static int prune(int argc, const char **argv)
14861486
return result;
14871487
}
14881488

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)
14901490
{
14911491
if (strcmp(key, "remotes.default") == 0) {
14921492
int *found = priv;

color.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ int want_color_fd(int fd, int var)
415415
return var;
416416
}
417417

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))
419419
{
420420
if (!strcmp(var, "color.ui")) {
421421
git_use_color_default = git_config_colorbool(var, value);

config.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@ static void populate_remote_urls(struct config_include_data *inc)
362362
current_parsing_scope = store_scope;
363363
}
364364

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))
366367
{
367368
const char *remote_name;
368369
size_t remote_name_len;

convert.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ static int apply_filter(const char *path, const char *src, size_t len,
10081008
return 0;
10091009
}
10101010

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))
10121012
{
10131013
const char *key, *name;
10141014
size_t namelen;

0 commit comments

Comments
 (0)