/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstclear.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:06:41 by rbousset #+# #+# */ /* Updated: 2020/02/14 17:06:41 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include void ft_lstclear(t_list **lst, void (*del)(void *)) { t_list *tmp; t_list *renext; if (!lst) return ; tmp = *lst; while (tmp) { renext = tmp->next; del(tmp->content); free(tmp); tmp = renext; } *lst = NULL; }