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