From 1fd608288ee47c2c560817f12f14b21069fed2f6 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Sat, 28 Dec 2024 16:47:43 -0800 Subject: makefile and directory structure change completely to build client and server --- src/common/hash_table.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/common/hash_table.c (limited to 'src/common/hash_table.c') diff --git a/src/common/hash_table.c b/src/common/hash_table.c new file mode 100644 index 0000000..2f66d45 --- /dev/null +++ b/src/common/hash_table.c @@ -0,0 +1,12 @@ +#include "../include/hash_table.h" +#include "../include/helpers.h" + +#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