summaryrefslogtreecommitdiff
path: root/src/hashtable.h
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2023-02-16 14:32:56 -0800
committerKai Stevenson <kai@kaistevenson.com>2023-02-16 14:32:56 -0800
commit05540fc6038f452f5dc5f18412c918c33ad96027 (patch)
treebb9f572a1cc6f3a66cbf9835593f62db87481e0a /src/hashtable.h
parent10a1f7e4ad1bc90436f58269a52cddfd0587be33 (diff)
changed project structure
Diffstat (limited to 'src/hashtable.h')
-rw-r--r--src/hashtable.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/hashtable.h b/src/hashtable.h
new file mode 100644
index 0000000..43ab23a
--- /dev/null
+++ b/src/hashtable.h
@@ -0,0 +1,19 @@
+#ifndef HASHTABLE
+#define HASHTABLE
+
+typedef struct HashPair {
+ char* key;
+ void* value;
+} pair_t;
+pair_t* init_pair(char* key, void* value);
+typedef struct HashTable {
+ pair_t** pairs;
+ int capacity;
+ int itemCount;
+} hashtable_t;
+hashtable_t* init_hashtable(unsigned int capacity);
+unsigned int get_hash(char* str);
+unsigned int hashtable_add_pair(hashtable_t* hashtable, pair_t* pair);
+pair_t* hashtable_get_pair(hashtable_t* hashtable, char* key);
+
+#endif