-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstdelone.c
30 lines (26 loc) · 1.29 KB
/
ft_lstdelone.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
25
26
27
28
29
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdelone.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zelhajou <zelhajou@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/17 20:31:28 by zelhajou #+# #+# */
/* Updated: 2022/11/19 21:29:25 by zelhajou ### ########.fr */
/* */
/* ************************************************************************** */
/*
Description : Takes as a parameter a node and frees the memory of
the node’s content using the function ’del’ given as a parameter and free
the node. The memory of ’next’ must not be freed.
lst: The node to free.
del: The address of the function used to delete the content.
*/
#include "libft.h"
void ft_lstdelone(t_list *lst, void (*del)(void*))
{
if (!lst)
return ;
del(lst->content);
free(lst);
}