push_swap/libft/ft_lstclear.c
Etienne Rey-bethbeder e35b9d3e9e Add libft
2022-12-08 18:06:06 +01:00

28 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstclear.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/09 23:56:15 by erey-bet #+# #+# */
/* Updated: 2022/10/11 22:13:45 by erey-bet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstclear(t_list **lst, void (*del)(void*))
{
t_list *temp;
if (lst == NULL || del == NULL)
return ;
while (*lst != NULL)
{
temp = (*lst)->next;
ft_lstdelone(*lst, del);
*lst = temp;
}
}