Libft
42 Libft library documentation
Loading...
Searching...
No Matches
ft_lstclear.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_lstclear.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: raphalme <raphalme@student.42.fr> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2025/12/29 19:21:00 by raphalme #+# #+# */
9
/* Updated: 2026/04/14 10:36:21 by raphalme ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "../includes/libft.h"
14
#include "../includes/types.h"
15
25
void
ft_lstclear
(
t_list
**lst,
void
(*del)(
void
*))
26
{
27
t_list
*tmp;
28
29
if
(!lst || !del)
30
return ;
31
while
(*lst)
32
{
33
tmp = (*lst)->
next
;
34
ft_lstdelone
(*lst, del);
35
*lst = tmp;
36
}
37
}
ft_lstclear
void ft_lstclear(t_list **lst, void(*del)(void *))
Clears a linked list. This function takes a pointer to the first element of a linked list and a funct...
Definition
ft_lstclear.c:25
ft_lstdelone
void ft_lstdelone(t_list *lst, void(*del)(void *))
Deletes and frees a single element from a linked list. This function takes an element from a linked l...
Definition
ft_lstdelone.c:24
s_list
Definition
types.h:4
s_list::next
struct s_list * next
Definition
types.h:6
src
ft_lstclear.c
Generated by
1.9.8