/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstclear.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: whaffman +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/05 18:42:05 by whaffman #+# #+# */ /* Updated: 2024/07/10 17:08:53 by whaffman ### ########.fr */ /* */ /* ************************************************************************** */ #include #include "libft.h" void ft_lstclear(t_list **lst, void (*del)(void *)) { t_list *next; if (!del || !lst) return ; while (*lst) { if ((*lst)->next) next = (*lst)->next; else next = NULL; del((*lst)->content); free(*lst); *lst = next; } }