diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-10-15 14:15:25 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-10-15 15:01:35 +0200 |
| commit | bebdb6929703ebdf9d3f65f19fd29780ac39cab3 (patch) | |
| tree | 158ced4ccae46cd537ec22e57cb361e1d3e1ebf5 /ft_lstclear_bonus.c | |
| parent | f23592ea0c122a0da2723d4253c47ca227529f79 (diff) | |
| download | libft-bebdb6929703ebdf9d3f65f19fd29780ac39cab3.tar.gz libft-bebdb6929703ebdf9d3f65f19fd29780ac39cab3.tar.bz2 libft-bebdb6929703ebdf9d3f65f19fd29780ac39cab3.zip | |
Removed libft_bonus.h
bonus rule in Makefile remove guard close in libft.h
to declare t_list struct and ft_lst* prototypes.
Fixed ft_lstclear with recursion.
Diffstat (limited to 'ft_lstclear_bonus.c')
| -rw-r--r-- | ft_lstclear_bonus.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/ft_lstclear_bonus.c b/ft_lstclear_bonus.c index f8fad93..b5829c7 100644 --- a/ft_lstclear_bonus.c +++ b/ft_lstclear_bonus.c @@ -6,22 +6,18 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/09 09:02:39 by cacharle #+# #+# */ -/* Updated: 2019/10/09 13:30:09 by cacharle ### ########.fr */ +/* Updated: 2019/10/15 14:32:23 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include <stdlib.h> -#include "libft_bonus.h" +#include "libft.h" void ft_lstclear(t_list **lst, void (*del)(void *)) { - t_list *tmp; - - while (*lst != NULL) - { - tmp = (*lst)->next; - ft_lstdelone(*lst, del); - *lst = tmp; - } + if (*lst == NULL) + return ; + ft_lstclear(&(*lst)->next, del); + ft_lstdelone(*lst, del); *lst = NULL; } |
