From 0f03bd0417d663cff7c87a107044fa08e953ca37 Mon Sep 17 00:00:00 2001 From: Stefano Cossu Date: Fri, 18 Mar 2022 09:59:47 -0700 Subject: [PATCH] Make item in hashmap_set constant. --- hashmap.c | 2 +- hashmap.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hashmap.c b/hashmap.c index b05231e..554b283 100644 --- a/hashmap.c +++ b/hashmap.c @@ -248,7 +248,7 @@ static bool resize(struct hashmap *map, size_t new_cap) { // replaced then it is returned otherwise NULL is returned. This operation // may allocate memory. If the system is unable to allocate additional // memory then NULL is returned and hashmap_oom() returns true. -void *hashmap_set(struct hashmap *map, void *item) { +void *hashmap_set(struct hashmap *map, const void *item) { if (!item) { panic("item is null"); } diff --git a/hashmap.h b/hashmap.h index d5cb64a..f3d6ad1 100644 --- a/hashmap.h +++ b/hashmap.h @@ -36,7 +36,7 @@ void hashmap_clear(struct hashmap *map, bool update_cap); size_t hashmap_count(struct hashmap *map); bool hashmap_oom(struct hashmap *map); void *hashmap_get(struct hashmap *map, const void *item); -void *hashmap_set(struct hashmap *map, void *item); +void *hashmap_set(struct hashmap *map, const void *item); void *hashmap_delete(struct hashmap *map, void *item); void *hashmap_probe(struct hashmap *map, uint64_t position); bool hashmap_scan(struct hashmap *map,