You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
1.1 KiB

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: emartine <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/09 17:38:34 by emartine #+# #+# */
/* Updated: 2017/11/09 17:38:35 by emartine ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstdel(t_list **alst, void (*del)(void *, size_t))
{
t_list *next;
t_list *current;
next = *alst;
while (next != NULL)
{
current = next;
del(current->content, current->content_size);
next = current->next;
free(current);
}
*alst = NULL;
}