-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstdelone_bonus.c
40 lines (37 loc) · 1.42 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdelone.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anamartinez <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/26 19:45:25 by anamart3 #+# #+# */
/* Updated: 2023/05/05 13:13:18 by anamartinez ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstdelone(t_list *lst, void (*del)(void *))
{
if (!lst || !del)
return ;
del(lst->content);
free(lst);
}
// void free_memory_content(void *content)
// {
// free(content);
// }
// int main(void)
// {
// t_list *my_list = NULL;
// t_list *node1 = ft_lstnew("node 1");
// ft_lstadd_front(&my_list, node1);
// while (my_list != NULL)
// {
// printf("Before: %s\n", my_list->content);
// my_list = my_list->next;
// }
// ft_lstdelone(my_list, free_memory_content);
// printf("After: %p\n", my_list);
// return (0);
// }