-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstdel.c
33 lines (30 loc) · 1.22 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
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vvenance <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/12/12 17:06:40 by vvenance #+# #+# */
/* Updated: 2015/12/15 18:03:34 by vvenance ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstdel(t_list **alst, void (*del)(void *, size_t))
{
t_list *next_lst;
t_list *temp;
if (alst != NULL)
{
next_lst = *alst;
while (next_lst != NULL)
{
if (del != NULL)
(*del)(next_lst->content, (*next_lst).content_size);
temp = next_lst->next;
free(next_lst);
next_lst = temp;
}
*alst = NULL;
}
}