-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstclear_bonus.c
30 lines (27 loc) · 1.1 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.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: abdsalah <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/30 19:46:35 by abdsalah #+# #+# */
/* Updated: 2024/08/30 19:55:00 by abdsalah ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstclear(t_list **lst, void (*del)(void *))
{
t_list *cur;
t_list *temp;
cur = *lst;
temp = cur;
while (cur)
{
temp = cur->next;
del(cur->content);
free(cur);
cur = temp;
}
*lst = NULL;
}