-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstclear_bonus.c
24 lines (22 loc) · 1.09 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstclear_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tchevrie <tchevrie@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/19 16:59:36 by tchevrie #+# #+# */
/* Updated: 2022/10/05 05:07:42 by tchevrie ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstclear(t_list **lst, void (*del)(void *))
{
if (!lst || !(*lst) || !del)
return ;
if ((*lst)->next)
ft_lstclear((&(*lst)->next), del);
del((*lst)->content);
free(*lst);
*lst = NULL;
}