From 4b233e06a16bf5183223e8253b4d9ac9ee59e6a2 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 10 Aug 2020 17:56:38 +0200 Subject: Work in progress --- src/f_alloc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/f_alloc.c') diff --git a/src/f_alloc.c b/src/f_alloc.c index bfa75c3..62b7008 100644 --- a/src/f_alloc.c +++ b/src/f_alloc.c @@ -21,16 +21,20 @@ #include "s_struct.h" void - f_fail_alloc(t_msh *msh) + f_alloc_and_destroy_msh(t_msh *msh) { - ft_dprintf(STDERR_FILENO, "%s: %s\n", msh->shname, strerror(errno)); + char tmp[255]; + + lcom_clear(&msh->curr); + ft_strlcpy(tmp, msh->shname, ft_strlen(msh->shname) + 1); + s_destroy(msh); + ft_dprintf(STDERR_FILENO, "%s: %s\n", tmp, strerror(errno)); exit(FT_RET_ALLOC); } void - f_fail_alloc_and_destroy(t_msh *msh) + f_alloc_and_clear_lcom(t_msh *msh) { lcom_clear(&msh->curr); - s_destroy(msh); - f_fail_alloc(msh); + ft_dprintf(STDERR_FILENO, "%s: %s\n", msh->shname, strerror(errno)); } -- cgit v1.2.3