diff options
Diffstat (limited to 'src/ft_lstclear.c')
| -rw-r--r-- | src/ft_lstclear.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ft_lstclear.c b/src/ft_lstclear.c new file mode 100644 index 0000000..4c738b7 --- /dev/null +++ b/src/ft_lstclear.c @@ -0,0 +1,19 @@ +#include "libft.h" +#include <stdlib.h> + +void +ft_lstclear (t_list **lst, void (*del) (void *)) +{ + t_list *cur; + t_list *next; + + cur = *lst; + while (cur) + { + next = cur->next; + del (cur->content); + free (cur); + cur = next; + } + *lst = NULL; +} |
