libft
Loading...
Searching...
No Matches
ft_lstclear.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* ft_lstclear_bonus.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: tspoof <tspoof@student.hive.fi> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2022/11/07 14:03:57 by tspoof #+# #+# */
9/* Updated: 2022/11/16 13:10:49 by tspoof ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "libft.h"
14
15void ft_lstclear(t_list **lst, void (*del)(void *))
16{
17 t_list *tmp;
18
19 if (!lst || !del)
20 return ;
21 tmp = *lst;
22 while (tmp)
23 {
24 *lst = (*lst)->next;
25 ft_lstdelone(tmp, del);
26 tmp = *lst;
27 }
28}
void ft_lstclear(t_list **lst, void(*del)(void *))
Clear list.
Definition ft_lstclear.c:15
void ft_lstdelone(t_list *lst, void(*del)(void *))
Delete node.
Definition libft.h:22
struct s_list * next
Definition libft.h:24