update: normed the rest output

This commit is contained in:
maix0 2024-09-19 17:52:19 +02:00
parent 4a6ea68d08
commit bec1320c5f
26 changed files with 332 additions and 382 deletions

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/06 10:58:20 by maiboyer #+# #+# */
/* Updated: 2024/09/19 15:20:55 by rparodi ### ########.fr */
/* Updated: 2024/09/19 17:50:02 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,15 +17,14 @@
#include "me/types.h"
#include <stdlib.h>
t_hashmap_env *hmap_env_new(\
t_hash_env_fn hfunc, t_eq_env_fn cfunc, t_free_env_fn free)
t_hashmap_env *hmap_env_new(t_hash_env_fn hfunc, t_eq_env_fn cfunc,
t_free_env_fn free)
{
return (
hmap_env_new_with_buckets(hfunc, cfunc, free, DEFAULT_BUCKETS));
return (hmap_env_new_with_buckets(hfunc, cfunc, free, DEFAULT_BUCKETS));
}
t_hashmap_env *hmap_env_new_with_buckets(\
t_hash_env_fn hfunc, t_eq_env_fn cfunc, t_free_env_fn free, t_usize buckets)
t_hashmap_env *hmap_env_new_with_buckets(t_hash_env_fn hfunc,
t_eq_env_fn cfunc, t_free_env_fn free, t_usize buckets)
{
t_hashmap_env *hmap;
@ -67,8 +66,8 @@ void hmap_env_free(t_hashmap_env *hmap)
mem_free(hmap);
}
t_entry_env *hmap_env_get_entry(\
t_hashmap_env *hmap, t_usize hashed_key, t_str *key, t_entry_env **prev)
t_entry_env *hmap_env_get_entry(t_hashmap_env *hmap, t_usize hashed_key,
t_str *key, t_entry_env **prev)
{
t_entry_env *entry;
@ -88,8 +87,7 @@ t_entry_env *hmap_env_get_entry(\
return (NULL);
}
bool hmap_env_insert(\
t_hashmap_env *hmap, t_str key, t_str value)
bool hmap_env_insert(t_hashmap_env *hmap, t_str key, t_str value)
{
t_usize hashed_key;
t_entry_env *prev;
@ -114,8 +112,6 @@ bool hmap_env_insert(\
else
{
hmap->free(entry->kv);
entry->kv.key = key;
entry->kv.val = value;
return (true);
return (entry->kv = (typeof(entry->kv)){key, value}, true);
}
}