diff options
Diffstat (limited to 'src/hash_table.c')
-rw-r--r-- | src/hash_table.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/hash_table.c b/src/hash_table.c index 9384945..3ca6dd0 100644 --- a/src/hash_table.c +++ b/src/hash_table.c @@ -70,6 +70,12 @@ ast_t *sl_list_get(sl_list_t *l, char *key) { return NULL; } +bool sl_list_exists(sl_list_l, char *key) { + if (sl_list_get(l, key) != NULL) + return true; + return false; +} + void sl_list_free(sl_list_t *l) { sl_node_t *cur = l->head; sl_node_t *tmp; @@ -111,6 +117,11 @@ void hash_table_free(hash_table_t *h) { free(h); } +bool hash_table_exists(hash_table_t *h, char *key) { + sl_list_t *l = h->buckets[hash(key, h->size)]; + return sl_list_exists(l, key); +} + /* DJB2 HASH FUNCTION */ unsigned long hash(char *key, int size) { unsigned long hash = 5381; |