Skip to content

Commit

Permalink
optimization for hashmap_entry_get()
Browse files Browse the repository at this point in the history
  • Loading branch information
Ximaz committed Apr 28, 2024
1 parent 8473d2f commit 2e27221
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hashmap_entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const hashmap_entry_t *hashmap_entry_get(const hashmap_t *hashmap,
hash_t hash = hashmap_hash(key);
const hashmap_entry_t *head = hashmap->buckets[hash].head;

if (NULL != head && NULL == head->next)
return head;
while (NULL != head) {
if (0 == strcmp(key, head->key))
return head;
Expand Down

0 comments on commit 2e27221

Please sign in to comment.