2022-09-27 11:25:41 -04:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
2022-10-04 08:21:55 -04:00
|
|
|
/* ft_lstclear.c :+: :+: :+: */
|
2022-09-27 11:25:41 -04:00
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
2022-10-04 08:21:55 -04:00
|
|
|
/* Created: 2022/09/30 00:01:05 by cchauvet #+# #+# */
|
2022-10-21 09:32:43 -04:00
|
|
|
/* Updated: 2022/10/21 14:55:37 by cchauvet ### ########.fr */
|
2022-09-27 11:25:41 -04:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "libft.h"
|
|
|
|
|
2022-10-04 08:21:55 -04:00
|
|
|
void ft_lstclear(t_list **lst, void (*del)(void *))
|
2022-09-27 11:25:41 -04:00
|
|
|
{
|
2022-10-04 08:21:55 -04:00
|
|
|
t_list *next;
|
2022-09-27 11:25:41 -04:00
|
|
|
|
2022-10-04 08:21:55 -04:00
|
|
|
if (lst == NULL || del == NULL)
|
|
|
|
return ;
|
2022-10-05 15:04:45 -04:00
|
|
|
while (*lst != NULL)
|
2022-10-04 08:21:55 -04:00
|
|
|
{
|
|
|
|
next = (*lst)->next;
|
|
|
|
ft_lstdelone(*lst, del);
|
|
|
|
*lst = next;
|
|
|
|
}
|
2022-09-27 11:25:41 -04:00
|
|
|
}
|