-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathft_lstclear.c
32 lines (29 loc) · 1.15 KB
/
ft_lstclear.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstclear.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gamarcha <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/04/15 21:16:58 by gamarcha #+# #+# */
/* Updated: 2021/04/15 21:16:58 by gamarcha ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstclear(t_list **lst, void (*del)(void*))
{
t_list *tmp;
t_list *node;
if (!*lst)
return ;
node = *lst;
while (node)
{
tmp = node;
node = node->next;
if (del)
del(tmp->content);
free(tmp);
}
*lst = 0;
}