aboutsummaryrefslogtreecommitdiff
path: root/libft/src/lst/ft_lstdelone.c
diff options
context:
space:
mode:
Diffstat (limited to 'libft/src/lst/ft_lstdelone.c')
-rw-r--r--libft/src/lst/ft_lstdelone.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/libft/src/lst/ft_lstdelone.c b/libft/src/lst/ft_lstdelone.c
new file mode 100644
index 0000000..3dfbbbb
--- /dev/null
+++ b/libft/src/lst/ft_lstdelone.c
@@ -0,0 +1,27 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_lstdelone.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/09 09:03:02 by cacharle #+# #+# */
+/* Updated: 2019/11/20 04:02:31 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft_lst.h"
+
+/*
+** \brief Delete list node
+** \param del Delete function for node's data
+*/
+
+void ft_lstdelone(t_ftlst *lst, void (*del)(void *))
+{
+ if (lst == NULL)
+ return ;
+ if (del != NULL)
+ (*del)(lst->data);
+ free(lst);
+}