ft_lstclear - gabrielcoelhodacunha-old/42sp-libft GitHub Wiki

Description

Deletes lst and its successive elements by using the function del and sets lst to a null pointer.

Implementation

void	ft_lstclear(t_list **lst, void (*del)(void *))
{
	t_list	*next;

	next = *lst;
	while (next)
	{
		next = next->next;
		ft_lstdelone(*lst, del);
		*lst = next;
	}
	lst = NULL;
}

References