-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstdel.c
32 lines (29 loc) · 1.14 KB
/
ft_lstdel.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoptere <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/01/21 16:26:26 by asoptere #+# #+# */
/* Updated: 2018/01/21 16:35:47 by asoptere ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstdel(t_list **alst, void (*del)(void *, size_t))
{
t_list *nod1;
t_list *nod2;
if (*alst)
{
nod1 = *alst;
while (nod1)
{
nod2 = nod1->next;
del(nod1->content, nod1->content_size);
free(nod1);
nod1 = nod2;
}
*alst = 0;
}
}