diff options
author | kartofen <mladenovnasko0@gmail.com> | 2024-01-03 00:08:27 +0200 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2024-01-03 00:08:27 +0200 |
commit | fad8df848092d7f35e95c3b70b5917593df84952 (patch) | |
tree | 7300189cfd953b2571237e8e2a0fd556e1921633 /src/hashtbl.h | |
parent | c837b2bb4ea71cedb434260b11c9f356e8b34e2d (diff) |
Diffstat (limited to 'src/hashtbl.h')
-rw-r--r-- | src/hashtbl.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/hashtbl.h b/src/hashtbl.h new file mode 100644 index 0000000..a6cfa10 --- /dev/null +++ b/src/hashtbl.h @@ -0,0 +1,23 @@ +#ifndef HASHTBL_H +#define HASHTBL_H + +typedef struct hash_table *hashtbl_t; + +struct hash_table { + struct hash_item { + struct hash_item *next; + char *key; + void *data; + } **items; + + size_t cap; +}; + +hashtbl_t hashtbl_create(size_t cap); +void hashtbl_destroy(hashtbl_t hashtbl); +void hashtbl_reset(hashtbl_t hashtbl); + +int hashtbl_insert(hashtbl_t hashtbl, char *key, void *data, size_t data_sz); +int hashtbl_query(hashtbl_t hashtbl, char *key, void **dest); + +#endif |