-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstclear_bonus.c
30 lines (27 loc) · 1.15 KB
/
ft_lstclear_bonus.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_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: olachgue <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/05 18:19:18 by olachgue #+# #+# */
/* Updated: 2024/11/06 18:31:32 by olachgue ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstclear(t_list **lst, void (*del)(void*))
{
t_list *current;
t_list *next;
if (!lst || !*lst || !del)
return ;
current = *lst;
while (current != NULL)
{
next = current->next;
ft_lstdelone(current, del);
current = next;
}
*lst = NULL;
}