tgrekov-libft
HIVE libft Oct 2023
Loading...
Searching...
No Matches
ft_lstclear_bonus.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* ft_lstclear_bonus.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2023/10/28 01:38:22 by tgrekov #+# #+# */
9/* Updated: 2023/11/20 19:21:31 by tgrekov ### ########.fr */
10/* */
11/* ************************************************************************** */
12
20#include "libft.h"
21
31void ft_lstclear(t_list **lst, void (*del)(void *))
32{
33 t_list *next;
34
35 if (!lst)
36 return ;
37 while (*lst)
38 {
39 next = (*lst)->next;
40 ft_lstdelone(*lst, del);
41 *lst = next;
42 }
43}
void ft_lstclear(t_list **lst, void(*del)(void *))
Delete every node in a list along with it's content.
void ft_lstdelone(t_list *lst, void(*del)(void *))
Delete a node and it's content.
Linked list node.
Definition libft.h:44
struct s_list * next
Pointer to the next node.
Definition libft.h:46