-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstdel.c
executable file
·49 lines (42 loc) · 1.39 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jraymond <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/15 21:36:40 by jraymond #+# #+# */
/* Updated: 2017/11/16 15:31:38 by jraymond ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstdel(t_list **alst, void (*del)(void *, size_t))
{
t_list *temp;
t_list *last;
if (alst == NULL || *alst == NULL)
return ;
last = *alst;
while (last != NULL)
{
temp = last->next;
ft_lstdelone(&last, del);
last = temp;
}
*alst = NULL;
}
void ft_lstdelnocontent(t_list **alst)
{
t_list *temp;
t_list *last;
if (alst == NULL || *alst == NULL)
return ;
last = *alst;
while (last != NULL)
{
temp = last->next;
ft_memdel((void **)&last);
last = temp;
}
*alst = NULL;
}