-
Notifications
You must be signed in to change notification settings - Fork 0
/
free_all_the_shit.c
51 lines (45 loc) · 1.39 KB
/
free_all_the_shit.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free_all_the_shit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vcombey <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/06 19:18:04 by vcombey #+# #+# */
/* Updated: 2017/03/08 17:49:54 by vcombey ### ########.fr */
/* */
/* ************************************************************************** */
#include "lem_in.h"
#include "libft/libft.h"
void free_bfs(t_bfs bfs)
{
free_room(bfs.already_seen);
free_room(bfs.to_see);
free(bfs.way);
}
void free_room(t_room *r)
{
t_room *tmp;
while (r)
{
tmp = r;
if (r->name != NULL)
free(r->name);
r = r->next;
free(tmp);
}
}
void free_all_the_shit(t_ways *ways, t_anthill a, t_file f)
{
t_ways *tmp;
while (ways)
{
tmp = ways;
free_room(ways->solus);
ways = ways->next;
free(tmp);
}
free_room(a.room);
ft_tab_int_free(a.mat);
ft_tab_free(f.data);
}