hopefully a working allocator !

This commit is contained in:
Maix0 2024-05-10 21:40:19 +02:00
parent a149e9a860
commit b639b0c14e
8 changed files with 53 additions and 35 deletions

View file

@ -32,7 +32,9 @@ t_hashmap_env *new_hashmap_with_buckets_env(
t_drop_env_fn drop, t_usize buckets)
{
t_hashmap_env *hmap;
t_usize i;
i = 0;
hmap = mem_alloc(sizeof(*hmap));
if (hmap == NULL)
return (NULL);
@ -44,6 +46,8 @@ t_hashmap_env *new_hashmap_with_buckets_env(
hmap->drop = drop;
if (hmap->buckets == NULL)
return ((void)me_free(hmap), NULL);
while (i < buckets)
hmap->buckets[i++] = NULL;
return (hmap);
}