From 404ab78e39fc74c4eb604b6003642ed264f687a6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Oct 2019 23:30:42 +0000 Subject: hashmap: remove type arg from hashmap_{get,put,remove}_entry Since these macros already take a `keyvar' pointer of a known type, we can rely on OFFSETOF_VAR to get the correct offset without relying on non-portable `__typeof__' and `offsetof'. Argument order is also rearranged, so `keyvar' and `member' are sequential as they are used as: `keyvar->member' Signed-off-by: Eric Wong Reviewed-by: Derrick Stolee Signed-off-by: Junio C Hamano --- submodule-config.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'submodule-config.c') diff --git a/submodule-config.c b/submodule-config.c index c22855cd38..401a9b2382 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -141,9 +141,7 @@ static void cache_remove_path(struct submodule_cache *cache, struct submodule_entry *removed; hashmap_entry_init(&e.ent, hash); e.config = submodule; - removed = hashmap_remove_entry(&cache->for_path, &e, NULL, - struct submodule_entry, - ent /* member name */); + removed = hashmap_remove_entry(&cache->for_path, &e, ent, NULL); free(removed); } @@ -172,8 +170,7 @@ static const struct submodule *cache_lookup_path(struct submodule_cache *cache, hashmap_entry_init(&key.ent, hash); key.config = &key_config; - entry = hashmap_get_entry(&cache->for_path, &key, NULL, - struct submodule_entry, ent); + entry = hashmap_get_entry(&cache->for_path, &key, ent, NULL); if (entry) return entry->config; return NULL; @@ -193,8 +190,7 @@ static struct submodule *cache_lookup_name(struct submodule_cache *cache, hashmap_entry_init(&key.ent, hash); key.config = &key_config; - entry = hashmap_get_entry(&cache->for_name, &key, NULL, - struct submodule_entry, ent); + entry = hashmap_get_entry(&cache->for_name, &key, ent, NULL); if (entry) return entry->config; return NULL; -- cgit 1.2.3-korg