diff options
Diffstat (limited to 'libft/ft_lstclear.c')
-rw-r--r-- | libft/ft_lstclear.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libft/ft_lstclear.c b/libft/ft_lstclear.c new file mode 100644 index 0000000..a262722 --- /dev/null +++ b/libft/ft_lstclear.c @@ -0,0 +1,27 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstclear.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: kdx <kdx @student.42angouleme.fr +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2022/09/29 03:23:00 by kdx #+# #+# */ +/* Updated: 2022/09/29 03:26:07 by kdx ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_lstclear(t_list **lst, void (*del)(void *)) +{ + t_list *next; + + if (lst == NULL || del == NULL) + return ; + while (*lst != NULL) + { + next = (*lst)->next; + ft_lstdelone(*lst, del); + *lst = next; + } +} |