From f52050d53e698975d6598da86ddd99100ae70fdf Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Sat, 4 Mar 2023 00:50:41 -0800 Subject: added while loop. simplified some hashtable code --- src/hashtable.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/hashtable.c') diff --git a/src/hashtable.c b/src/hashtable.c index 84676a9..bf46963 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -73,12 +73,7 @@ pair_t hashtable_get_pair(hashtable_t* hashtable, char* key) { unsigned int ha = hash + i; unsigned int ia = ha % hashtable->capacity; pair_t p = hashtable->pairs[ia]; - if (p.key != NULL && strcmp(p.key, key) == 0) { - return p; - } - else if (p.key == NULL) { - return init_pair(NULL, NULL); - } + return p; } return hashtable->pairs[(hash) % hashtable->capacity]; } -- cgit v1.3.1