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>
This commit is contained in:
Eric Wong
2019-10-06 23:30:27 +00:00
committed by Junio C Hamano
parent d0a48a0a1d
commit d22245a2e3
23 changed files with 55 additions and 52 deletions

View File

@ -123,7 +123,7 @@ static void cache_put_path(struct submodule_cache *cache,
unsigned int hash = hash_oid_string(&submodule->gitmodules_oid,
submodule->path);
struct submodule_entry *e = xmalloc(sizeof(*e));
hashmap_entry_init(e, hash);
hashmap_entry_init(&e->ent, hash);
e->config = submodule;
hashmap_put(&cache->for_path, e);
}
@ -135,7 +135,7 @@ static void cache_remove_path(struct submodule_cache *cache,
submodule->path);
struct submodule_entry e;
struct submodule_entry *removed;
hashmap_entry_init(&e, hash);
hashmap_entry_init(&e.ent, hash);
e.config = submodule;
removed = hashmap_remove(&cache->for_path, &e, NULL);
free(removed);
@ -147,7 +147,7 @@ static void cache_add(struct submodule_cache *cache,
unsigned int hash = hash_oid_string(&submodule->gitmodules_oid,
submodule->name);
struct submodule_entry *e = xmalloc(sizeof(*e));
hashmap_entry_init(e, hash);
hashmap_entry_init(&e->ent, hash);
e->config = submodule;
hashmap_add(&cache->for_name, e);
}
@ -163,7 +163,7 @@ static const struct submodule *cache_lookup_path(struct submodule_cache *cache,
oidcpy(&key_config.gitmodules_oid, gitmodules_oid);
key_config.path = path;
hashmap_entry_init(&key, hash);
hashmap_entry_init(&key.ent, hash);
key.config = &key_config;
entry = hashmap_get(&cache->for_path, &key, NULL);
@ -183,7 +183,7 @@ static struct submodule *cache_lookup_name(struct submodule_cache *cache,
oidcpy(&key_config.gitmodules_oid, gitmodules_oid);
key_config.name = name;
hashmap_entry_init(&key, hash);
hashmap_entry_init(&key.ent, hash);
key.config = &key_config;
entry = hashmap_get(&cache->for_name, &key, NULL);