зеркало из https://github.com/microsoft/git.git
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
783a86c142
Коммит
02c3c59e62
|
@ -430,7 +430,7 @@ struct pathname_entry {
|
|||
struct file_item *item;
|
||||
};
|
||||
|
||||
static int pathname_entry_cmp(const void *unused_cmp_data,
|
||||
static int pathname_entry_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *he1,
|
||||
const struct hashmap_entry *he2,
|
||||
const void *name)
|
||||
|
|
4
attr.c
4
attr.c
|
@ -61,10 +61,10 @@ struct attr_hash_entry {
|
|||
};
|
||||
|
||||
/* attr_hashmap comparison function */
|
||||
static int attr_hash_entry_cmp(const void *unused_cmp_data,
|
||||
static int attr_hash_entry_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct attr_hash_entry *a, *b;
|
||||
|
||||
|
|
4
bloom.c
4
bloom.c
|
@ -163,10 +163,10 @@ void init_bloom_filters(void)
|
|||
init_bloom_filter_slab(&bloom_filters);
|
||||
}
|
||||
|
||||
static int pathmap_cmp(const void *hashmap_cmp_fn_data,
|
||||
static int pathmap_cmp(const void *UNUSED(hashmap_cmp_fn_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct pathmap_hash_entry *e1, *e2;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ static const char *prio_names[] = {
|
|||
N_("head"), N_("lightweight"), N_("annotated"),
|
||||
};
|
||||
|
||||
static int commit_name_neq(const void *unused_cmp_data,
|
||||
static int commit_name_neq(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *peeled)
|
||||
|
|
|
@ -125,10 +125,10 @@ struct working_tree_entry {
|
|||
char path[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
static int working_tree_entry_cmp(const void *unused_cmp_data,
|
||||
static int working_tree_entry_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct working_tree_entry *a, *b;
|
||||
|
||||
|
@ -148,10 +148,10 @@ struct pair_entry {
|
|||
const char path[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
static int pair_cmp(const void *unused_cmp_data,
|
||||
static int pair_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct pair_entry *a, *b;
|
||||
|
||||
|
@ -184,7 +184,7 @@ struct path_entry {
|
|||
char path[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
static int path_entry_cmp(const void *unused_cmp_data,
|
||||
static int path_entry_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *key)
|
||||
|
|
|
@ -119,7 +119,7 @@ struct anonymized_entry_key {
|
|||
size_t orig_len;
|
||||
};
|
||||
|
||||
static int anonymized_entry_cmp(const void *unused_cmp_data,
|
||||
static int anonymized_entry_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
|
|
|
@ -46,7 +46,7 @@ struct object_entry {
|
|||
depth : DEPTH_BITS;
|
||||
};
|
||||
|
||||
static int object_entry_hashcmp(const void *map_data,
|
||||
static int object_entry_hashcmp(const void *UNUSED(map_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
|
|
|
@ -301,7 +301,7 @@ struct refname_hash_entry {
|
|||
char refname[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
static int refname_hash_entry_cmp(const void *hashmap_cmp_fn_data,
|
||||
static int refname_hash_entry_cmp(const void *UNUSED(hashmap_cmp_fn_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
|
|
|
@ -477,7 +477,7 @@ struct escape_sequence_entry {
|
|||
char sequence[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
static int sequence_entry_cmp(const void *hashmap_cmp_fn_data,
|
||||
static int sequence_entry_cmp(const void *UNUSED(hashmap_cmp_fn_data),
|
||||
const struct escape_sequence_entry *e1,
|
||||
const struct escape_sequence_entry *e2,
|
||||
const void *keydata)
|
||||
|
|
4
config.c
4
config.c
|
@ -2338,10 +2338,10 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int config_set_element_cmp(const void *unused_cmp_data,
|
||||
static int config_set_element_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct config_set_element *e1, *e2;
|
||||
|
||||
|
|
2
diff.c
2
diff.c
|
@ -917,7 +917,7 @@ struct interned_diff_symbol {
|
|||
static int interned_diff_symbol_cmp(const void *hashmap_cmp_fn_data,
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct diff_options *diffopt = hashmap_cmp_fn_data;
|
||||
const struct emitted_diff_symbol *a, *b;
|
||||
|
|
4
dir.c
4
dir.c
|
@ -655,10 +655,10 @@ void parse_path_pattern(const char **pattern,
|
|||
*patternlen = len;
|
||||
}
|
||||
|
||||
int pl_hashmap_cmp(const void *unused_cmp_data,
|
||||
int pl_hashmap_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *a,
|
||||
const struct hashmap_entry *b,
|
||||
const void *key)
|
||||
const void *UNUSED(key))
|
||||
{
|
||||
const struct pattern_entry *ee1 =
|
||||
container_of(a, struct pattern_entry, ent);
|
||||
|
|
|
@ -333,10 +333,10 @@ static void set_git_dir_1(const char *path)
|
|||
setup_git_env(path);
|
||||
}
|
||||
|
||||
static void update_relative_gitdir(const char *name,
|
||||
static void update_relative_gitdir(const char *UNUSED(name),
|
||||
const char *old_cwd,
|
||||
const char *new_cwd,
|
||||
void *data)
|
||||
void *UNUSED(data))
|
||||
{
|
||||
char *path = reparent_relative_path(old_cwd, new_cwd, get_git_dir());
|
||||
struct tmp_objdir *tmp_objdir = tmp_objdir_unapply_primary_odb();
|
||||
|
|
10
hashmap.c
10
hashmap.c
|
@ -142,10 +142,10 @@ static inline struct hashmap_entry **find_entry_ptr(const struct hashmap *map,
|
|||
return e;
|
||||
}
|
||||
|
||||
static int always_equal(const void *unused_cmp_data,
|
||||
const struct hashmap_entry *unused1,
|
||||
const struct hashmap_entry *unused2,
|
||||
const void *unused_keydata)
|
||||
static int always_equal(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *UNUSED(entry1),
|
||||
const struct hashmap_entry *UNUSED(entry2),
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ struct pool_entry {
|
|||
unsigned char data[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
static int pool_entry_cmp(const void *unused_cmp_data,
|
||||
static int pool_entry_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
|
|
|
@ -45,7 +45,7 @@ struct path_hashmap_entry {
|
|||
char path[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
static int path_hashmap_cmp(const void *cmp_data,
|
||||
static int path_hashmap_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
|
@ -89,10 +89,10 @@ static struct dir_rename_entry *dir_rename_find_entry(struct hashmap *hashmap,
|
|||
return hashmap_get_entry(hashmap, &key, ent, NULL);
|
||||
}
|
||||
|
||||
static int dir_rename_cmp(const void *unused_cmp_data,
|
||||
static int dir_rename_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct dir_rename_entry *e1, *e2;
|
||||
|
||||
|
@ -134,10 +134,10 @@ static struct collision_entry *collision_find_entry(struct hashmap *hashmap,
|
|||
return hashmap_get_entry(hashmap, &key, ent, NULL);
|
||||
}
|
||||
|
||||
static int collision_cmp(const void *unused_cmp_data,
|
||||
static int collision_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct collision_entry *e1, *e2;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ struct dir_entry {
|
|||
char name[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
static int dir_entry_cmp(const void *unused_cmp_data,
|
||||
static int dir_entry_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
|
@ -120,7 +120,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
|
|||
add_dir_entry(istate, ce);
|
||||
}
|
||||
|
||||
static int cache_entry_cmp(const void *unused_cmp_data,
|
||||
static int cache_entry_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *remove)
|
||||
|
|
|
@ -141,7 +141,7 @@ struct packed_git {
|
|||
|
||||
struct multi_pack_index;
|
||||
|
||||
static inline int pack_map_entry_cmp(const void *unused_cmp_data,
|
||||
static inline int pack_map_entry_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *entry,
|
||||
const struct hashmap_entry *entry2,
|
||||
const void *keydata)
|
||||
|
|
2
oidmap.c
2
oidmap.c
|
@ -1,7 +1,7 @@
|
|||
#include "cache.h"
|
||||
#include "oidmap.h"
|
||||
|
||||
static int oidmap_neq(const void *hashmap_cmp_fn_data,
|
||||
static int oidmap_neq(const void *UNUSED(hashmap_cmp_fn_data),
|
||||
const struct hashmap_entry *e1,
|
||||
const struct hashmap_entry *e2,
|
||||
const void *keydata)
|
||||
|
|
|
@ -1392,7 +1392,7 @@ static int delta_base_cache_key_eq(const struct delta_base_cache_key *a,
|
|||
return a->p == b->p && a->base_offset == b->base_offset;
|
||||
}
|
||||
|
||||
static int delta_base_cache_hash_cmp(const void *unused_cmp_data,
|
||||
static int delta_base_cache_hash_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *va,
|
||||
const struct hashmap_entry *vb,
|
||||
const void *vkey)
|
||||
|
|
|
@ -38,7 +38,7 @@ int commit_patch_id(struct commit *commit, struct diff_options *options,
|
|||
static int patch_id_neq(const void *cmpfn_data,
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
/* NEEDSWORK: const correctness? */
|
||||
struct diff_options *opt = (void *)cmpfn_data;
|
||||
|
|
|
@ -224,8 +224,10 @@ cleanup:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int patch_util_cmp(const void *dummy, const struct patch_util *a,
|
||||
const struct patch_util *b, const char *keydata)
|
||||
static int patch_util_cmp(const void *UNUSED(cmp_data),
|
||||
const struct patch_util *a,
|
||||
const struct patch_util *b,
|
||||
const char *keydata)
|
||||
{
|
||||
return strcmp(a->diff, keydata ? keydata : b->diff);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ struct ref_to_worktree_entry {
|
|||
struct worktree *wt; /* key is wt->head_ref */
|
||||
};
|
||||
|
||||
static int ref_to_worktree_map_cmpfnc(const void *unused_lookupdata,
|
||||
static int ref_to_worktree_map_cmpfnc(const void *UNUSED(lookupdata),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *kptr,
|
||||
const void *keydata_aka_refname)
|
||||
|
|
2
refs.c
2
refs.c
|
@ -1815,7 +1815,7 @@ struct ref_store_hash_entry
|
|||
char name[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
static int ref_store_hash_cmp(const void *unused_cmp_data,
|
||||
static int ref_store_hash_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
|
|
4
remote.c
4
remote.c
|
@ -86,7 +86,7 @@ struct remotes_hash_key {
|
|||
int len;
|
||||
};
|
||||
|
||||
static int remotes_hash_cmp(const void *unused_cmp_data,
|
||||
static int remotes_hash_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
|
@ -170,7 +170,7 @@ struct branches_hash_key {
|
|||
int len;
|
||||
};
|
||||
|
||||
static int branches_hash_cmp(const void *unused_cmp_data,
|
||||
static int branches_hash_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
|
|
|
@ -119,10 +119,10 @@ struct path_and_oids_entry {
|
|||
struct oidset trees;
|
||||
};
|
||||
|
||||
static int path_and_oids_cmp(const void *hashmap_cmp_fn_data,
|
||||
static int path_and_oids_cmp(const void *UNUSED(hashmap_cmp_fn_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct path_and_oids_entry *e1, *e2;
|
||||
|
||||
|
|
|
@ -5254,7 +5254,8 @@ struct labels_entry {
|
|||
char label[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
static int labels_cmp(const void *fndata, const struct hashmap_entry *eptr,
|
||||
static int labels_cmp(const void *UNUSED(fndata),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key, const void *key)
|
||||
{
|
||||
const struct labels_entry *a, *b;
|
||||
|
@ -6131,7 +6132,7 @@ struct subject2item_entry {
|
|||
char subject[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
static int subject2item_cmp(const void *fndata,
|
||||
static int subject2item_cmp(const void *UNUSED(fndata),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *key)
|
||||
|
|
4
strmap.c
4
strmap.c
|
@ -2,10 +2,10 @@
|
|||
#include "strmap.h"
|
||||
#include "mem-pool.h"
|
||||
|
||||
int cmp_strmap_entry(const void *hashmap_cmp_fn_data,
|
||||
int cmp_strmap_entry(const void *UNUSED(hashmap_cmp_fn_data),
|
||||
const struct hashmap_entry *entry1,
|
||||
const struct hashmap_entry *entry2,
|
||||
const void *keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct strmap_entry *e1, *e2;
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
#include "sigchain.h"
|
||||
#include "pkt-line.h"
|
||||
|
||||
int cmd2process_cmp(const void *unused_cmp_data,
|
||||
int cmd2process_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct subprocess_entry *e1, *e2;
|
||||
|
||||
|
|
|
@ -38,10 +38,10 @@ enum lookup_type {
|
|||
lookup_path
|
||||
};
|
||||
|
||||
static int config_path_cmp(const void *unused_cmp_data,
|
||||
static int config_path_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct submodule_entry *a, *b;
|
||||
|
||||
|
@ -52,10 +52,10 @@ static int config_path_cmp(const void *unused_cmp_data,
|
|||
!oideq(&a->config->gitmodules_oid, &b->config->gitmodules_oid);
|
||||
}
|
||||
|
||||
static int config_name_cmp(const void *unused_cmp_data,
|
||||
static int config_name_cmp(const void *UNUSED(cmp_data),
|
||||
const struct hashmap_entry *eptr,
|
||||
const struct hashmap_entry *entry_or_key,
|
||||
const void *unused_keydata)
|
||||
const void *UNUSED(keydata))
|
||||
{
|
||||
const struct submodule_entry *a, *b;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче