From 840957aee277e7c426647cc133b2a41e7cecd9a9 Mon Sep 17 00:00:00 2001 From: Cabergs Charles Date: Wed, 9 Oct 2019 09:12:43 +0200 Subject: Normed, Makefile bonus rule - bonus rule to add the *_bonus files to libft.a - normed memmove, calloc and bonus --- ft_lstclear_bonus.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ft_lstclear_bonus.c (limited to 'ft_lstclear_bonus.c') diff --git a/ft_lstclear_bonus.c b/ft_lstclear_bonus.c new file mode 100644 index 0000000..933b6d5 --- /dev/null +++ b/ft_lstclear_bonus.c @@ -0,0 +1,27 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstclear_bonus.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/10/09 09:02:39 by cacharle #+# #+# */ +/* Updated: 2019/10/09 09:08:22 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "libft_bonus.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