woody-woodpacker/ft_printf/libft/ft_lstclear.c

29 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstclear_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: pbonilla <eirodeis.lepnj@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/12/04 16:05:21 by pbonilla #+# #+# */
/* Updated: 2020/12/04 16:05:21 by pbonilla ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstclear(t_list **lst, void (*del)(void*))
{
t_list *tmp;
if (!lst)
return ;
while (*lst)
{
tmp = (*lst)->next;
ft_lstdelone(*lst, del);
(*lst) = tmp;
}
*lst = NULL;
}