// htab_find.c // Řešení IJC-DU2, příklad b), 22.4.2024 // Autor: Roman Nečas, FIT // Přeloženo: gcc 11.4.0 #include #include "htab.h" #include "htab_struct.h" htab_pair_t *htab_find(const htab_t *t, htab_key_t key) { size_t idx = htab_hash_function(key) % t->arr_size; struct htab_item *item = t->arr_ptr[idx]; while (item != NULL) { if (strcmp(item->pair.key, key) == 0) return &item->pair; item = item->next; } return NULL; }