-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lstclear_bonus.c
More file actions
31 lines (28 loc) · 1.11 KB
/
Copy pathft_lstclear_bonus.c
File metadata and controls
31 lines (28 loc) · 1.11 KB
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.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: spunyapr <spunyapr@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/27 17:51:19 by spunyapr #+# #+# */
/* Updated: 2024/11/29 16:11:45 by spunyapr ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstclear(t_list **lst, void (*del)(void *))
{
t_list *ptr;
t_list *tmp;
ptr = *lst;
if (!*lst || !del)
return ;
while (ptr)
{
tmp = ptr->next;
del(ptr->content);
free(ptr);
ptr = tmp;
}
*lst = NULL;
}