/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_list_clear.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: scebula +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/02/16 20:34:53 by scebula #+# #+# */ /* Updated: 2016/02/16 20:34:55 by scebula ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void ft_list_clear(t_list **begin_list) { t_list *tmp; t_list *list; list = *begin_list; tmp = NULL; while (list) { if (list->next) tmp = list->next; else tmp = NULL; free(list->content); list->content = NULL; list->next = NULL; free(list); list = tmp; } }