aboutsummaryrefslogtreecommitdiff
path: root/ft_lstclear.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-10-08 18:19:36 +0200
committerCharles <sircharlesaze@gmail.com>2019-10-08 18:19:36 +0200
commit4e2e8aac225f2a226573ae36e5327a8c4073bbbc (patch)
tree1946afb4965208899382464910ee1e4a78a65939 /ft_lstclear.c
parentc73c541621f0567c511bbcac4a0bf40e116c53d7 (diff)
downloadlibft-4e2e8aac225f2a226573ae36e5327a8c4073bbbc.tar.gz
libft-4e2e8aac225f2a226573ae36e5327a8c4073bbbc.tar.bz2
libft-4e2e8aac225f2a226573ae36e5327a8c4073bbbc.zip
Added bonus functions WIP
Diffstat (limited to 'ft_lstclear.c')
-rw-r--r--ft_lstclear.c15
1 files changed, 15 insertions, 0 deletions
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 <stdlib.h>
+#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;
+ }
+}