summaryrefslogtreecommitdiffstats
path: root/src/b_export.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-01 21:25:09 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-01 21:25:09 +0200
commit8680737a802539f3c21a295ad45eb9be72c73f5f (patch)
tree337018ce1574f425847d5f1c089694f3e0996b1c /src/b_export.c
parentMakefile update (diff)
download42-minishell-8680737a802539f3c21a295ad45eb9be72c73f5f.tar.gz
42-minishell-8680737a802539f3c21a295ad45eb9be72c73f5f.tar.bz2
42-minishell-8680737a802539f3c21a295ad45eb9be72c73f5f.tar.xz
42-minishell-8680737a802539f3c21a295ad45eb9be72c73f5f.tar.zst
42-minishell-8680737a802539f3c21a295ad45eb9be72c73f5f.zip
More UNIX friendly libft
Diffstat (limited to '')
-rw-r--r--src/b_export.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/b_export.c b/src/b_export.c
index 9fe5709..9a7c37d 100644
--- a/src/b_export.c
+++ b/src/b_export.c
@@ -64,28 +64,16 @@ static void
while (msh->envp[i] != NULL)
i++;
if (!(nenvp = (char**)malloc((i + 2) * sizeof(char*))))
- {
- lcom_clear(&msh->curr);
- s_destroy(msh);
- f_fail_alloc(msh);
- }
+ f_fail_alloc_and_destroy(msh);
i = 0;
while (msh->envp[i] != NULL)
{
if (!(nenvp[i] = ft_strdup(msh->envp[i])))
- {
- lcom_clear(&msh->curr);
- s_destroy(msh);
- f_fail_alloc(msh);
- }
+ f_fail_alloc_and_destroy(msh);
i++;
}
if (!(nenvp[i] = ft_strdup(var)))
- {
- lcom_clear(&msh->curr);
- s_destroy(msh);
- f_fail_alloc(msh);
- }
+ f_fail_alloc_and_destroy(msh);
nenvp[i + 1] = 0;
ft_delwords(msh->envp);
lvars_delone(&msh->vars, varname);