From b94e5c1df674eb4ec8fdeaaae1ad8df552cb5d70 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Oct 2019 23:30:29 +0000 Subject: 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 Reviewed-by: Derrick Stolee Signed-off-by: Junio C Hamano --- hashmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hashmap.c') diff --git a/hashmap.c b/hashmap.c index c1de40eea0..9c2db3e0c8 100644 --- a/hashmap.c +++ b/hashmap.c @@ -201,12 +201,12 @@ void *hashmap_get_next(const struct hashmap *map, return NULL; } -void hashmap_add(struct hashmap *map, void *entry) +void hashmap_add(struct hashmap *map, struct hashmap_entry *entry) { unsigned int b = bucket(map, entry); /* add entry */ - ((struct hashmap_entry *) entry)->next = map->table[b]; + entry->next = map->table[b]; map->table[b] = entry; /* fix size and rehash if appropriate */ @@ -302,7 +302,7 @@ const void *memintern(const void *data, size_t len) FLEX_ALLOC_MEM(e, data, data, len); hashmap_entry_init(&e->ent, key.ent.hash); e->len = len; - hashmap_add(&map, e); + hashmap_add(&map, &e->ent); } return e->data; } -- cgit v1.2.3