-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstdelone_bonus.c
24 lines (21 loc) · 1.23 KB
/
ft_lstdelone_bonus.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdelone_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dolvin17 <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/03 19:35:39 by ghuertas #+# #+# */
/* Updated: 2022/04/20 21:36:37 by dolvin17 ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/* toma un elemento y libera la memoria y el elemento */
void ft_lstdelone(t_list *lst, void (*del) (void *))
{
if (!lst) //si el nodo no existe
return ; //no hago nada.
if (del) //si del es distinto de null.
del(lst->content); //aplico del al contenido del nodo actual.
free(lst);//libero la memoria tras eliminar el contenido.
}