-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstclear_bonus.c
31 lines (28 loc) · 1.14 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
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstclear_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: amacarul <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/22 15:56:52 by amacarul #+# #+# */
/* Updated: 2024/09/22 16:16:13 by amacarul ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstclear(t_list **lst, void (*del)(void *))
{
t_list *temp;
t_list *next_temp;
if (lst == NULL)
return ;
temp = *lst;
while (temp)
{
next_temp = temp->next;
del(temp->content);
free (temp);
temp = next_temp;
}
*lst = NULL;
}