-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lstdel.c
More file actions
30 lines (27 loc) · 1.17 KB
/
ft_lstdel.c
File metadata and controls
30 lines (27 loc) · 1.17 KB
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_lstdel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lpetsoan <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/24 12:48:42 by lpetsoan #+# #+# */
/* Updated: 2019/05/30 09:41:45 by lpetsoan ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include "libft.h"
void ft_lstdel(t_list **node, void (*del)(void *, size_t len))
{
t_list **prev;
prev = NULL;
while (!(*node))
{
del((*node)->content, (*node)->content_size);
*prev = (*node);
(*node) = (*node)->next;
free(*prev);
*prev = NULL;
}
*prev = NULL;
}