-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstdel.c
30 lines (27 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ewilliam <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/05 09:43:17 by ewilliam #+# #+# */
/* Updated: 2016/12/06 16:06:46 by ewilliam ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstdel(t_list **alst, void (*del)(void*, size_t))
{
t_list *next;
if (!alst || !(*alst) || !del)
return ;
next = *alst;
while (next)
{
next = (*alst)->next;
del((*alst)->content, (*alst)->content_size);
ft_memdel((void**)alst);
*alst = next;
}
*alst = NULL;
}