-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstclear.c
27 lines (24 loc) · 1.09 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
24
25
26
27
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstclear.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rakama <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/28 08:34:46 by rakama #+# #+# */
/* Updated: 2022/05/08 14:55:50 by rakama ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstclear(t_list **lst, void (*del)(void*))
{
t_list **p_list;
p_list = lst;
while (*p_list != NULL)
{
(*del)((*lst)->content);
free(*lst);
*p_list = (*p_list)->next;
}
lst = NULL;
}