f3-basic-hash-tabel #21

Merged
Mineplay merged 12 commits from f3-basic-hash-tabel into main 2025-05-02 06:24:05 -05:00
3 changed files with 7 additions and 0 deletions
Showing only changes of commit 448f37521d - Show all commits

View file

@ -50,4 +50,6 @@ FledastyError fledasty_hash_table_insert(FledastyHashTable *current_hash_table,
void *fledasty_hash_table_get(FledastyHashTable *current_hash_table, void *key);
FledastyError fledasty_hash_table_remove(FledastyHashTable *current_hash_table, void *key);
static inline bool fledasty_hash_table_is_empty(FledastyHashTable *current_hash_table) { return current_hash_table->size == 0; }
#endif

View file

@ -135,6 +135,7 @@ FledastyError fledasty_hash_table_remove(FledastyHashTable *current_hash_table,
hallocy_free(value->value);
fledasty_dynamic_array_remove_at_index(&current_hash_table->Table[index], list_index);
current_hash_table->size -= 1;
return FLEDASTY_ERROR_NONE;
}

View file

@ -206,6 +206,10 @@ int main() {
printf("Hash table get: %d\n", *hash_table_value);
}
if (fledasty_hash_table_is_empty(&test_hash_table)) {
printf("Hash table is empty\n");
}
fledasty_hash_table_destroy(&test_hash_table);
printf("Done\n");
return 0;