-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstdelone.c
executable file
·35 lines (30 loc) · 1.34 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
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdelone.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jchoy-me <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/20 11:42:54 by jchoy-me #+# #+# */
/* Updated: 2023/07/20 14:39:34 by jchoy-me ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
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.
PARAMETERS:
lst: The node to free.
del: The address of the function used to delete the content.
EXTERNAL FUNCTIONS:
free
*/
void ft_lstdelone(t_list *lst, void (*del)(void *))
{
if (lst == NULL || del == NULL)
return ;
del(lst->content);
free(lst);
}