-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdel_management.c
79 lines (70 loc) · 1.7 KB
/
del_management.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* del_management.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgonor <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/07/23 20:24:53 by dgonor #+# #+# */
/* Updated: 2018/07/23 20:24:57 by dgonor ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_lem.h"
void lstdel_list_way(t_way **list_way)
{
t_way *tmp;
if (*list_way)
{
while (*list_way)
{
tmp = *list_way;
free(tmp);
*list_way = (*list_way)->next;
}
}
}
void lstdel_ways(t_ways **ways)
{
t_ways *tmp_ways;
if (*ways)
{
while (*ways)
{
if ((*ways)->list_way)
lstdel_list_way(&(*ways)->list_way);
tmp_ways = *ways;
free(tmp_ways);
*ways = (*ways)->next;
}
}
}
void lstdel_one_link(t_link **link)
{
if (*link)
{
free(*link);
*link = NULL;
}
}
void lstdel_link(t_link **link)
{
t_link *tmp;
if (*link)
{
while (*link)
{
tmp = *link;
free(tmp);
*link = (*link)->next;
}
}
}
void lstdel_room(t_room **room)
{
if ((*room)->link)
lstdel_link(&((*room)->link));
if ((*room)->name)
ft_strdel(&((*room)->name));
free(*room);
*room = NULL;
}