Skip to content

Commit 02c3c59

Browse files
peffgitster
authored andcommitted
hashmap: mark unused callback parameters
Hashmap comparison functions must conform to a particular callback interface, but many don't use all of their parameters. Especially the void cmp_data pointer, but some do not use keydata either (because they can easily form a full struct to pass when doing lookups). Let's mark these to make -Wunused-parameter happy. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 783a86c commit 02c3c59

29 files changed

+59
-56
lines changed

add-interactive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ struct pathname_entry {
430430
struct file_item *item;
431431
};
432432

433-
static int pathname_entry_cmp(const void *unused_cmp_data,
433+
static int pathname_entry_cmp(const void *UNUSED(cmp_data),
434434
const struct hashmap_entry *he1,
435435
const struct hashmap_entry *he2,
436436
const void *name)

attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ struct attr_hash_entry {
6161
};
6262

6363
/* attr_hashmap comparison function */
64-
static int attr_hash_entry_cmp(const void *unused_cmp_data,
64+
static int attr_hash_entry_cmp(const void *UNUSED(cmp_data),
6565
const struct hashmap_entry *eptr,
6666
const struct hashmap_entry *entry_or_key,
67-
const void *unused_keydata)
67+
const void *UNUSED(keydata))
6868
{
6969
const struct attr_hash_entry *a, *b;
7070

bloom.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ void init_bloom_filters(void)
163163
init_bloom_filter_slab(&bloom_filters);
164164
}
165165

166-
static int pathmap_cmp(const void *hashmap_cmp_fn_data,
166+
static int pathmap_cmp(const void *UNUSED(hashmap_cmp_fn_data),
167167
const struct hashmap_entry *eptr,
168168
const struct hashmap_entry *entry_or_key,
169-
const void *keydata)
169+
const void *UNUSED(keydata))
170170
{
171171
const struct pathmap_hash_entry *e1, *e2;
172172

builtin/describe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static const char *prio_names[] = {
6363
N_("head"), N_("lightweight"), N_("annotated"),
6464
};
6565

66-
static int commit_name_neq(const void *unused_cmp_data,
66+
static int commit_name_neq(const void *UNUSED(cmp_data),
6767
const struct hashmap_entry *eptr,
6868
const struct hashmap_entry *entry_or_key,
6969
const void *peeled)

builtin/difftool.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ struct working_tree_entry {
125125
char path[FLEX_ARRAY];
126126
};
127127

128-
static int working_tree_entry_cmp(const void *unused_cmp_data,
128+
static int working_tree_entry_cmp(const void *UNUSED(cmp_data),
129129
const struct hashmap_entry *eptr,
130130
const struct hashmap_entry *entry_or_key,
131-
const void *unused_keydata)
131+
const void *UNUSED(keydata))
132132
{
133133
const struct working_tree_entry *a, *b;
134134

@@ -148,10 +148,10 @@ struct pair_entry {
148148
const char path[FLEX_ARRAY];
149149
};
150150

151-
static int pair_cmp(const void *unused_cmp_data,
151+
static int pair_cmp(const void *UNUSED(cmp_data),
152152
const struct hashmap_entry *eptr,
153153
const struct hashmap_entry *entry_or_key,
154-
const void *unused_keydata)
154+
const void *UNUSED(keydata))
155155
{
156156
const struct pair_entry *a, *b;
157157

@@ -184,7 +184,7 @@ struct path_entry {
184184
char path[FLEX_ARRAY];
185185
};
186186

187-
static int path_entry_cmp(const void *unused_cmp_data,
187+
static int path_entry_cmp(const void *UNUSED(cmp_data),
188188
const struct hashmap_entry *eptr,
189189
const struct hashmap_entry *entry_or_key,
190190
const void *key)

builtin/fast-export.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ struct anonymized_entry_key {
119119
size_t orig_len;
120120
};
121121

122-
static int anonymized_entry_cmp(const void *unused_cmp_data,
122+
static int anonymized_entry_cmp(const void *UNUSED(cmp_data),
123123
const struct hashmap_entry *eptr,
124124
const struct hashmap_entry *entry_or_key,
125125
const void *keydata)

builtin/fast-import.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct object_entry {
4646
depth : DEPTH_BITS;
4747
};
4848

49-
static int object_entry_hashcmp(const void *map_data,
49+
static int object_entry_hashcmp(const void *UNUSED(map_data),
5050
const struct hashmap_entry *eptr,
5151
const struct hashmap_entry *entry_or_key,
5252
const void *keydata)

builtin/fetch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ struct refname_hash_entry {
301301
char refname[FLEX_ARRAY];
302302
};
303303

304-
static int refname_hash_entry_cmp(const void *hashmap_cmp_fn_data,
304+
static int refname_hash_entry_cmp(const void *UNUSED(hashmap_cmp_fn_data),
305305
const struct hashmap_entry *eptr,
306306
const struct hashmap_entry *entry_or_key,
307307
const void *keydata)

compat/terminal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ struct escape_sequence_entry {
477477
char sequence[FLEX_ARRAY];
478478
};
479479

480-
static int sequence_entry_cmp(const void *hashmap_cmp_fn_data,
480+
static int sequence_entry_cmp(const void *UNUSED(hashmap_cmp_fn_data),
481481
const struct escape_sequence_entry *e1,
482482
const struct escape_sequence_entry *e2,
483483
const void *keydata)

config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,10 +2338,10 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
23382338
return 0;
23392339
}
23402340

2341-
static int config_set_element_cmp(const void *unused_cmp_data,
2341+
static int config_set_element_cmp(const void *UNUSED(cmp_data),
23422342
const struct hashmap_entry *eptr,
23432343
const struct hashmap_entry *entry_or_key,
2344-
const void *unused_keydata)
2344+
const void *UNUSED(keydata))
23452345
{
23462346
const struct config_set_element *e1, *e2;
23472347

0 commit comments

Comments
 (0)