This commit is contained in:
Imbus 2025-06-15 21:20:40 +02:00
parent 77a8a6bb74
commit 5274372180
4 changed files with 160 additions and 0 deletions

26
hashmap/hashmap.h Normal file
View file

@ -0,0 +1,26 @@
#pragma once
#include <stddef.h>
/*
* TODO: Make thread safe
* TODO: Resizing
* TODO: Custom hashing and eq
*/
typedef struct hashmap hashmap_t;
/** Initialize the hashmap */
hashmap_t *hashmap_create(size_t bucket_count);
/** Deallocate the map */
void hashmap_destroy(hashmap_t *map);
/** Put a new entry into the map */
void hashmap_put(hashmap_t *map, const char *key, void *value);
/** Get an entry from the map */
void *hashmap_get(hashmap_t *map, const char *key);
/** Remove entry from the map */
void hashmap_remove(hashmap_t *map, const char *key);