aboutsummaryrefslogtreecommitdiff
path: root/src/common/hash_table.c
diff options
context:
space:
mode:
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;
+}