🔨」 fix(builtins/export): fixed double values when empty + leaks

This commit is contained in:
yosyo
2024-07-13 16:12:20 +02:00
parent d7c5e9611b
commit 47b8806eec
3 changed files with 19 additions and 8 deletions

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/11 18:59:27 by mmoussou #+# #+# */
/* Updated: 2024/07/11 18:59:42 by mmoussou ### ########.fr */
/* Updated: 2024/07/13 16:10:28 by mmoussou ### ########.fr */
/* */
/* ************************************************************************** */
@ -51,3 +51,15 @@ char **env_get_list(t_env *env)
}
return (ar);
}
void add_to_env(char *name, char *content, t_env *env)
{
if (!content)
content = ft_calloc(1, 1);
if (!content)
return ;
if (env_get_value(name, env))
env_edit(name, content, env);
else
ft_envadd_back(&env, ft_envnew(name, content));
}