blob: 936672d8a998183dd533abf1361141cc99205392 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_lstclear.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2019/10/13 10:19:53 by rbousset #+# ## ## #+# */
/* Updated: 2019/10/13 13:52:03 by rbousset ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include <libft.h>
#include <stdlib.h>
void
ft_lstclear(t_list **lst, void (*del)(void *))
{
t_list *tmp;
t_list *renext;
if (!lst)
return ;
tmp = *lst;
while (tmp)
{
renext = tmp->next;
del(tmp->content);
free(tmp);
tmp = renext;
}
*lst = NULL;
}
|