diff options
author | Eric Wong <e@80x24.org> | 2019-10-07 02:30:27 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-07 04:20:09 +0300 |
commit | d22245a2e360d2e708ca37169be8eb5a5899b98d (patch) | |
tree | f1bde8f5da6ea424fa1f9538d6debd4b5fd6b5f4 /name-hash.c | |
parent | d0a48a0a1d0df49af2e5fd6a80b0d84776c285aa (diff) |
hashmap_entry_init takes "struct hashmap_entry *"
C compilers do type checking to make life easier for us. So
rely on that and update all hashmap_entry_init callers to take
"struct hashmap_entry *" to avoid future bugs while improving
safety and readability.
Signed-off-by: Eric Wong <e@80x24.org>
Reviewed-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'name-hash.c')
-rw-r--r-- | name-hash.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/name-hash.c b/name-hash.c index 695908609f..1ce1417f7e 100644 --- a/name-hash.c +++ b/name-hash.c @@ -33,7 +33,7 @@ static struct dir_entry *find_dir_entry__hash(struct index_state *istate, const char *name, unsigned int namelen, unsigned int hash) { struct dir_entry key; - hashmap_entry_init(&key, hash); + hashmap_entry_init(&key.ent, hash); key.namelen = namelen; return hashmap_get(&istate->dir_hash, &key, name); } @@ -68,7 +68,7 @@ static struct dir_entry *hash_dir_entry(struct index_state *istate, if (!dir) { /* not found, create it and add to hash table */ FLEX_ALLOC_MEM(dir, name, ce->name, namelen); - hashmap_entry_init(dir, memihash(ce->name, namelen)); + hashmap_entry_init(&dir->ent, memihash(ce->name, namelen)); dir->namelen = namelen; hashmap_add(&istate->dir_hash, dir); @@ -106,7 +106,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce) if (ce->ce_flags & CE_HASHED) return; ce->ce_flags |= CE_HASHED; - hashmap_entry_init(ce, memihash(ce->name, ce_namelen(ce))); + hashmap_entry_init(&ce->ent, memihash(ce->name, ce_namelen(ce))); hashmap_add(&istate->name_hash, ce); if (ignore_case) @@ -280,7 +280,7 @@ static struct dir_entry *hash_dir_entry_with_parent_and_prefix( dir = find_dir_entry__hash(istate, prefix->buf, prefix->len, hash); if (!dir) { FLEX_ALLOC_MEM(dir, name, prefix->buf, prefix->len); - hashmap_entry_init(dir, hash); + hashmap_entry_init(&dir->ent, hash); dir->namelen = prefix->len; dir->parent = parent; hashmap_add(&istate->dir_hash, dir); @@ -472,7 +472,7 @@ static void *lazy_name_thread_proc(void *_data) for (k = 0; k < d->istate->cache_nr; k++) { struct cache_entry *ce_k = d->istate->cache[k]; ce_k->ce_flags |= CE_HASHED; - hashmap_entry_init(ce_k, d->lazy_entries[k].hash_name); + hashmap_entry_init(&ce_k->ent, d->lazy_entries[k].hash_name); hashmap_add(&d->istate->name_hash, ce_k); } |