31 lines
1.1 KiB
C
31 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_lstdel.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/12/04 18:48:08 by gtertysh #+# #+# */
|
|
/* Updated: 2016/12/05 18:50:39 by gtertysh ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
void ft_lstdel(t_list **alst, void (*del)(void *, size_t))
|
|
{
|
|
t_list *tmp;
|
|
|
|
tmp = NULL;
|
|
if (alst)
|
|
{
|
|
while (*alst)
|
|
{
|
|
tmp = (*alst)->next;
|
|
del((*alst)->content, (*alst)->content_size);
|
|
free(*alst);
|
|
*alst = tmp;
|
|
}
|
|
*alst = NULL;
|
|
}
|
|
}
|