/ libft / src / ft_lst / lst_clear.c
lst_clear.c
 1  /* ************************************************************************** */
 2  /*                                                                            */
 3  /*                                                        :::      ::::::::   */
 4  /*   lst_clear.c                                       :+:      :+:    :+:   */
 5  /*                                                    +:+ +:+         +:+     */
 6  /*   By: ll-hotel <ll-hotel@student.42lyon.fr>      +#+  +:+       +#+        */
 7  /*                                                +#+#+#+#+#+   +#+           */
 8  /*   Created: 2024/04/17 19:53:49 by ll-hotel          #+#    #+#             */
 9  /*   Updated: 2024/04/27 16:07:47 by ll-hotel         ###   ########.fr       */
10  /*                                                                            */
11  /* ************************************************************************** */
12  
13  #include "ft_lst.h"
14  
15  void	lst_clear(t_lst_head *lst, void (*__free)(void *))
16  {
17  	if (!lst)
18  		return ;
19  	while (lst->first)
20  		lst_delone(lst, __free);
21  }