Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-mior committed Feb 1, 2024
1 parent 8bfe157 commit dbea18a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ hash_map_balance(HashMap *old_map) {
iterator = iterator->next;

while (iterator) {
void *aux;
uint32 hash = iterator->hash;
uint32 index = hash % new_map->capacity;
hash_map_insert_pre_calc(new_map, iterator->key,
hash, index, iterator->value);

void *aux = iterator;
aux = iterator;
iterator = iterator->next;
free(aux);
}
Expand All @@ -112,7 +113,7 @@ hash_map_balance(HashMap *old_map) {

void
hash_map_free_keys(HashMap *map) {
for (int i = 0; i < hash_map_capacity(map); i += 1) {
for (uint32 i = 0; i < hash_map_capacity(map); i += 1) {
Bucket *iterator = &(map->array[i]);
while (iterator) {
free(iterator->key);
Expand Down

0 comments on commit dbea18a

Please sign in to comment.