35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_list_clear.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: scebula <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* 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;
|
|
}
|
|
}
|