aboutsummaryrefslogtreecommitdiff
path: root/ft_lstclear.c
blob: b944cda70d4dbf591fb44779c4a983becaf53463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdlib.h>
#include "libft.h"

void ft_lstclear(t_list **lst, void (*del)(void *))
{
    t_list *tmp;

    while (*lst != NULL)
    {
        tmp = (*lst)->next;
        (*del)((*lst)->content);
        free(*lst);
        *lst = tmp;
    }
}