-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstdel.c
32 lines (29 loc) · 1.17 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: vportell <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 13:58:22 by vportell #+# #+# */
/* Updated: 2016/11/03 23:24:44 by vportell ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstdel(t_list **alst, void (*del)(void *, size_t))
{
t_list *list;
t_list *previous;
if (*alst)
{
list = *alst;
while (list)
{
previous = list;
list = list->next;
del(previous->content, previous->content_size);
free(previous);
}
}
*alst = NULL;
}