28 lines
1.1 KiB
C
28 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_lstclear.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/09/30 00:01:05 by cchauvet #+# #+# */
|
|
/* Updated: 2022/10/21 14:55:37 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
void ft_lstclear(t_list **lst, void (*del)(void *))
|
|
{
|
|
t_list *next;
|
|
|
|
if (lst == NULL || del == NULL)
|
|
return ;
|
|
while (*lst != NULL)
|
|
{
|
|
next = (*lst)->next;
|
|
ft_lstdelone(*lst, del);
|
|
*lst = next;
|
|
}
|
|
}
|