From 4e2e8aac225f2a226573ae36e5327a8c4073bbbc Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 8 Oct 2019 18:19:36 +0200 Subject: Added bonus functions WIP --- ft_lstclear.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ft_lstclear.c (limited to 'ft_lstclear.c') diff --git a/ft_lstclear.c b/ft_lstclear.c new file mode 100644 index 0000000..b944cda --- /dev/null +++ b/ft_lstclear.c @@ -0,0 +1,15 @@ +#include +#include "libft.h" + +void ft_lstclear(t_list **lst, void (*del)(void *)) +{ + t_list *tmp; + + while (*lst != NULL) + { + tmp = (*lst)->next; + (*del)((*lst)->content); + free(*lst); + *lst = tmp; + } +} -- cgit