Hashmap
This commit is contained in:
parent
77a8a6bb74
commit
5274372180
4 changed files with 160 additions and 0 deletions
26
hashmap/hashmap.h
Normal file
26
hashmap/hashmap.h
Normal 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);
|
||||
Loading…
Add table
Add a link
Reference in a new issue