-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_lstclear.c
23 lines (21 loc) · 1.07 KB
/
ft_lstclear.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstclear_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yuotsuka <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/18 21:01:34 by yuotsuka #+# #+# */
/* Updated: 2024/04/29 19:12:14 by yuotsuka ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstclear(t_list **lst, void (*del)(void*))
{
if (!lst || !del || !(*lst))
return ;
ft_lstclear(&(*lst)->next, del);
(del)((*lst)->content);
free(*lst);
*lst = NULL;
}