30 lines
1.1 KiB
C
30 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_lstclear.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: tosuman <timo42@proton.me> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/06/24 16:47:41 by tosuman #+# #+# */
|
|
/* Updated: 2023/06/24 17:06:04 by tosuman ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
#include <stdlib.h>
|
|
|
|
void ft_lstclear(t_list **lst, void (*del)(void *))
|
|
{
|
|
t_list *tmp;
|
|
|
|
if (!lst || !del)
|
|
return ;
|
|
tmp = *lst;
|
|
while (tmp)
|
|
{
|
|
*lst = tmp->next;
|
|
ft_lstdelone(tmp, del);
|
|
tmp = *lst;
|
|
}
|
|
}
|