text: /* ************************************************************************** */
  /*                                                                            */
  /*                                                        :::      ::::::::   */
  /*   ft_lstdel.c                                        :+:      :+:    :+:   */
  /*                                                    +:+ +:+         +:+     */
  /*   By: ncoden <ncoden@student.42.fr>              +#+  +:+       +#+        */
  /*                                                +#+#+#+#+#+   +#+           */
  /*   Created: 2014/11/06 17:01:49 by ncoden            #+#    #+#             */
  /*   Updated: 2015/10/02 22:31:09 by ncoden           ###   ########.fr       */
  /*                                                                            */
  /* ************************************************************************** */
  
  #include <stdlib.h>
  #include "libft/containers/list.h"
  
  void			ft_lstdel(t_lst **alst, void (*del)(void *data))
  {
  	t_lst		*lst;
  	t_lst		*next;
  
  	lst = *alst;
  	while (lst != NULL)
  	{
  		next = lst->next;
  		if (del)
  			(*del)(lst->data);
  		free(lst);
  		lst = next;
  	}
  	*alst = NULL;
  }
  