From 20dc8e0afb21490b1b7ee2bfa49e184bc056fef9 Mon Sep 17 00:00:00 2001 From: Tanguy MAZE Date: Tue, 12 Jun 2018 01:52:39 +0200 Subject: [PATCH] protected ft_lstdel && changed -g flag --- Makefile | 4 ++-- ft_lstdel.c | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3948f37..5b995ea 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: tmaze +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2018/04/07 12:47:06 by tmaze #+# #+# # -# Updated: 2018/06/07 16:59:16 by tmaze ### ########.fr # +# Updated: 2018/06/12 01:46:55 by tmaze ### ########.fr # # # #******************************************************************************# @@ -32,7 +32,7 @@ $(NAME): $(OBJS) ar rcs $(NAME) $(OBJS) %.o: %.c libft.h - $(CC) $(CCFLAGS) $(CCSTD) $(INCLS) -g -c $< -o $@ + $(CC) $(CCFLAGS) $(CCSTD) $(INCLS) -c $< -o $@ clean: rm -f $(OBJS) diff --git a/ft_lstdel.c b/ft_lstdel.c index d80380c..c5e6cc9 100644 --- a/ft_lstdel.c +++ b/ft_lstdel.c @@ -6,7 +6,7 @@ /* By: tmaze +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/04/08 17:19:32 by tmaze #+# #+# */ -/* Updated: 2018/04/19 14:36:46 by tmaze ### ########.fr */ +/* Updated: 2018/06/12 00:33:45 by tmaze ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,10 @@ void ft_lstdel(t_list **alst, void (*del)(void*, size_t)) { - if ((*alst)->next != NULL) - ft_lstdel(&((*alst)->next), del); - ft_lstdelone(alst, del); + if (*alst) + { + if ((*alst)->next != NULL) + ft_lstdel(&((*alst)->next), del); + ft_lstdelone(alst, del); + } }