diff options
author | 2025-02-07 11:27:18 -0500 | |
---|---|---|
committer | 2025-02-07 11:27:18 -0500 | |
commit | 4da7be39827ea5888ef9c97b1aadf61b0d76347c (patch) | |
tree | 15d0ff8f8bcb0e871efb1b2e65c2bc8d07b17565 /mons_collections/include |
initial commit (lol)
Diffstat (limited to 'mons_collections/include')
-rw-r--r-- | mons_collections/include/hashmap.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mons_collections/include/hashmap.h b/mons_collections/include/hashmap.h new file mode 100644 index 0000000..e5e59c4 --- /dev/null +++ b/mons_collections/include/hashmap.h @@ -0,0 +1,23 @@ +#ifndef MONS_HASHMAP_H +#define MONS_HASHMAP_H + +typedef struct mons_hashmap_pair { + char *key; + void *value; + struct mons_hashmap_pair *next; +} mons_hashmap_pair; + +typedef struct mons_hashmap { + mons_hashmap_pair **data; + unsigned int bucket_count; + unsigned int member_size; + unsigned int len; +} mons_hashmap; + +mons_hashmap mons_hashmap_new(unsigned int member_size, unsigned int buckets); +void mons_hashmap_free(mons_hashmap *hashmap); +int mons_hashmap_insert(mons_hashmap *map, char *key, void *value); +int mons_hashmap_get(mons_hashmap map, char *key, void *out); +int mons_hashmap_remove(mons_hashmap *map, char *key); +int mons_hashmap_at(mons_hashmap map, unsigned int index, mons_hashmap_pair *out); +#endif |