From 8a973d0bb398d6d83d6c048acecc750d01bd7234 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Oct 2019 23:30:39 +0000 Subject: hashmap: hashmap_{put,remove} return hashmap_entry * And add *_entry variants to perform container_of as necessary to simplify most callers. Signed-off-by: Eric Wong Reviewed-by: Derrick Stolee Signed-off-by: Junio C Hamano --- hashmap.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'hashmap.c') diff --git a/hashmap.c b/hashmap.c index deb5fdf28c..1b60f97cf2 100644 --- a/hashmap.c +++ b/hashmap.c @@ -219,8 +219,9 @@ void hashmap_add(struct hashmap *map, struct hashmap_entry *entry) } } -void *hashmap_remove(struct hashmap *map, const struct hashmap_entry *key, - const void *keydata) +struct hashmap_entry *hashmap_remove(struct hashmap *map, + const struct hashmap_entry *key, + const void *keydata) { struct hashmap_entry *old; struct hashmap_entry **e = find_entry_ptr(map, key, keydata); @@ -242,7 +243,8 @@ void *hashmap_remove(struct hashmap *map, const struct hashmap_entry *key, return old; } -void *hashmap_put(struct hashmap *map, struct hashmap_entry *entry) +struct hashmap_entry *hashmap_put(struct hashmap *map, + struct hashmap_entry *entry) { struct hashmap_entry *old = hashmap_remove(map, entry, NULL); hashmap_add(map, entry); -- cgit v1.2.3