/* ************************************************************************** */ /* */ /* ::: o_ :::::: ::: */ /* ft_lstclear.c :+: / :+::+: :+: */ /* +:+ > +:++:+ +:+ */ /* By: whaffman +#+ +:+ +#++#++:++#++ */ /* +#+ +#+#+ +#++#+ +#+ \o/ */ /* Created: 2024/10/10 17:00:19 by whaffman #+#+# #+#+# #+# #+# | */ /* Updated: 2024/10/10 17:00:19 by whaffman ### ### ### ### / \ */ /* */ /* ************************************************************************** */ #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; } }