From fd14f6fbf8206589d2a0ad8f0793845cb8faf1d7 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Thu, 26 Dec 2024 21:18:05 -0800 Subject: stuff --- src/hash_table.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/hash_table.c (limited to 'src/hash_table.c') diff --git a/src/hash_table.c b/src/hash_table.c new file mode 100644 index 0000000..cced194 --- /dev/null +++ b/src/hash_table.c @@ -0,0 +1,11 @@ +#include +#include +#include + +ht_t *init_ht(size_t size) { + ht_t *ht = safe_calloc(1, sizeof(size)); + size_t realsize = size == 0 ? DEFAULT_HT_SIZE : size; + ht->buckets = safe_calloc(realsize, sizeof(sll_t *)); + ht->size = realsize; + return ht; +} -- cgit