diff --git a/hashmap.c b/hashmap.c index 845978b..e18af5e 100644 --- a/hashmap.c +++ b/hashmap.c @@ -64,7 +64,7 @@ static void *bucket_item(struct bucket *entry) { return ((char*)entry)+sizeof(struct bucket); } -static uint64_t get_hash(struct hashmap *map, void *key) { +static uint64_t get_hash(struct hashmap *map, const void *key) { return map->hash(key, map->seed0, map->seed1) << 16 >> 16; } @@ -275,7 +275,7 @@ void *hashmap_set(struct hashmap *map, void *item) { // hashmap_get returns the item based on the provided key. If the item is not // found then NULL is returned. -void *hashmap_get(struct hashmap *map, void *key) { +void *hashmap_get(struct hashmap *map, const void *key) { if (!key) { panic("key is null"); } diff --git a/hashmap.h b/hashmap.h index 9d83906..f2211b7 100644 --- a/hashmap.h +++ b/hashmap.h @@ -33,7 +33,7 @@ void hashmap_free(struct hashmap *map); 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, void *item); +void *hashmap_get(struct hashmap *map, const void *item); void *hashmap_set(struct hashmap *map, void *item); void *hashmap_delete(struct hashmap *map, void *item); void *hashmap_probe(struct hashmap *map, uint64_t position);