summaryrefslogtreecommitdiff
path: root/libft/ft_lstdelone.c
diff options
context:
space:
mode:
Diffstat (limited to 'libft/ft_lstdelone.c')
-rw-r--r--libft/ft_lstdelone.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libft/ft_lstdelone.c b/libft/ft_lstdelone.c
new file mode 100644
index 0000000..6975f88
--- /dev/null
+++ b/libft/ft_lstdelone.c
@@ -0,0 +1,25 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_lstdelone.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: kdx <kdx @student.42angouleme.fr +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2022/09/29 03:11:51 by kdx #+# #+# */
+/* Updated: 2022/09/29 03:21:01 by kdx ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+void ft_lstdelone(t_list *lst, void (*del)(void *))
+{
+ if (del == NULL || lst == NULL)
+ return ;
+ if (lst != NULL)
+ {
+ if (lst->content != NULL)
+ del(lst->content);
+ free(lst);
+ }
+}