From 8680737a802539f3c21a295ad45eb9be72c73f5f Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sat, 1 Aug 2020 21:25:09 +0200 Subject: More UNIX friendly libft --- src/b_export.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/b_export.c') 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); -- cgit v1.2.3