aboutsummaryrefslogtreecommitdiff
path: root/src/common/hash_table.c
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@gmail.com>2024-12-28 16:47:43 -0800
committerPreston Pan <ret2pop@gmail.com>2024-12-28 16:47:43 -0800
commit1fd608288ee47c2c560817f12f14b21069fed2f6 (patch)
treee6460b92dba5bb0d089c8c2a4e794e3504098359 /src/common/hash_table.c
parent63f11aaec8d21844a07fd27003a992c102a3a297 (diff)
makefile and directory structure change completely to build client and server
Diffstat (limited to 'src/common/hash_table.c')
-rw-r--r--src/common/hash_table.c12
1 files changed, 12 insertions, 0 deletions
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 <stdlib.h>
+
+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;
+}