From b2c539fadfa7ea3eea2e5f7c0c37b5f5f1370c5a Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Tue, 3 Jan 2023 09:45:40 -0800 Subject: actually evaluates and prints something now! --- src/hash_table.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/hash_table.c') diff --git a/src/hash_table.c b/src/hash_table.c index 3ca6dd0..a6524ac 100644 --- a/src/hash_table.c +++ b/src/hash_table.c @@ -70,7 +70,7 @@ ast_t *sl_list_get(sl_list_t *l, char *key) { return NULL; } -bool sl_list_exists(sl_list_l, char *key) { +bool sl_list_exists(sl_list_t *l, char *key) { if (sl_list_get(l, key) != NULL) return true; return false; @@ -111,17 +111,17 @@ ast_t *hash_table_get(hash_table_t *h, char *key) { return sl_list_get(l, key); } +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); +} + void hash_table_free(hash_table_t *h) { for (int i = 0; i < h->size; i++) sl_list_free(h->buckets[i]); 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; -- cgit