diff options
author | Eric Wong <e@80x24.org> | 2019-10-06 23:30:29 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-07 10:20:10 +0900 |
commit | b94e5c1df674eb4ec8fdeaaae1ad8df552cb5d70 (patch) | |
tree | 81566486743a5dafb2dddaf09de597529223f315 /name-hash.c | |
parent | f6eb6bdcf2719defc3d38e0e2712fa3e18d29e91 (diff) | |
download | git-b94e5c1df674eb4ec8fdeaaae1ad8df552cb5d70.tar.gz |
hashmap_add takes "struct hashmap_entry *"
This is less error-prone than "void *" as the compiler now
detects invalid types being passed.
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 | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/name-hash.c b/name-hash.c index 4d84326c58..faec682bc7 100644 --- a/name-hash.c +++ b/name-hash.c @@ -70,7 +70,7 @@ static struct dir_entry *hash_dir_entry(struct index_state *istate, FLEX_ALLOC_MEM(dir, name, ce->name, namelen); hashmap_entry_init(&dir->ent, memihash(ce->name, namelen)); dir->namelen = namelen; - hashmap_add(&istate->dir_hash, dir); + hashmap_add(&istate->dir_hash, &dir->ent); /* recursively add missing parent directories */ dir->parent = hash_dir_entry(istate, ce, namelen); @@ -107,7 +107,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce) return; ce->ce_flags |= CE_HASHED; hashmap_entry_init(&ce->ent, memihash(ce->name, ce_namelen(ce))); - hashmap_add(&istate->name_hash, ce); + hashmap_add(&istate->name_hash, &ce->ent); if (ignore_case) add_dir_entry(istate, ce); @@ -283,7 +283,7 @@ static struct dir_entry *hash_dir_entry_with_parent_and_prefix( hashmap_entry_init(&dir->ent, hash); dir->namelen = prefix->len; dir->parent = parent; - hashmap_add(&istate->dir_hash, dir); + hashmap_add(&istate->dir_hash, &dir->ent); if (parent) { unlock_dir_mutex(lock_nr); @@ -473,7 +473,7 @@ static void *lazy_name_thread_proc(void *_data) struct cache_entry *ce_k = d->istate->cache[k]; ce_k->ce_flags |= CE_HASHED; hashmap_entry_init(&ce_k->ent, d->lazy_entries[k].hash_name); - hashmap_add(&d->istate->name_hash, ce_k); + hashmap_add(&d->istate->name_hash, &ce_k->ent); } return NULL; |