-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_lstdel.c
31 lines (28 loc) · 1.18 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vbrazas <vbrazas@student.unit.ua> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/10 17:40:59 by vbrazas #+# #+# */
/* Updated: 2017/11/12 18:22:16 by vbrazas ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstdel(t_list **alst, void (*del)(void *, size_t))
{
t_list *list;
t_list *next_list;
if (!alst || *alst == NULL || !del)
return ;
list = *alst;
while (list)
{
next_list = list->next;
del(list->content, list->content_size);
free(list);
list = next_list;
}
*alst = NULL;
}