ft_lstclear.c
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* ft_lstclear.c :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: gychoi <marvin@42.fr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2022/07/12 15:16:32 by gychoi #+# #+# */ 9 /* Updated: 2022/07/13 16:26:30 by gychoi ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #include "libft.h" 14 15 void ft_lstclear(t_list **lst, void (*del)(void *)) 16 { 17 t_list *next; 18 19 if (!lst || !del) 20 return ; 21 while (*lst != NULL) 22 { 23 next = (*lst)->next; 24 ft_lstdelone(*lst, del); 25 *lst = next; 26 } 27 }