-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstclear.c
30 lines (27 loc) · 1.16 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstclear.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: f██████ <f██████@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/02 16:09:35 by f██████ #+# #+# */
/* Updated: 2021/11/22 10:27:59 by f██████ ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstclear(t_list **lst, void (*del)(void *))
{
t_list *lst1;
t_list *lst2;
if (!lst || !del)
return ;
lst1 = *lst;
while (lst1)
{
lst2 = lst1->next;
ft_lstdelone(lst1, del);
lst1 = lst2;
}
*lst = NULL;
}