update stuff
This commit is contained in:
parent
24b210fe86
commit
709c124028
20 changed files with 176 additions and 64 deletions
40
output/src/hashmap/env/env_clear.c
vendored
Normal file
40
output/src/hashmap/env/env_clear.c
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* hashmap_env.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/06 11:00:22 by maiboyer #+# #+# */
|
||||
/* Updated: 2023/12/11 15:24:44 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "me/types.h"
|
||||
|
||||
|
||||
|
||||
#include "me/hashmap/hashmap_env.h"
|
||||
#include "me/mem/mem.h"
|
||||
|
||||
|
||||
void hmap_env_clear(t_hashmap_env *self)
|
||||
{
|
||||
t_usize bucket_id;
|
||||
t_entry_env *cur;
|
||||
t_entry_env *next;
|
||||
|
||||
bucket_id = 0;
|
||||
while (bucket_id < self->num_buckets)
|
||||
{
|
||||
cur = self->buckets[bucket_id];
|
||||
while (cur != NULL)
|
||||
{
|
||||
next = cur->next;
|
||||
self->free(cur->kv);
|
||||
mem_free(cur);
|
||||
cur = next;
|
||||
}
|
||||
bucket_id++;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue