-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfree_bib.c
More file actions
54 lines (47 loc) · 1.37 KB
/
free_bib.c
File metadata and controls
54 lines (47 loc) · 1.37 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free_bib.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbeaufre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/12/03 16:38:03 by rbeaufre #+# #+# */
/* Updated: 2019/12/03 17:11:39 by rbeaufre ### ########.fr */
/* */
/* ************************************************************************** */
#include "lem_in.h"
static void ft_free_list_again(t_list *bib)
{
t_list *tmp;
t_list *nxt;
tmp = bib->next;
while (tmp)
{
nxt = tmp->next;
free(tmp);
tmp = nxt;
}
}
static void ft_free_list(t_list ***bib, int i)
{
int j;
j = 0;
while (j <= i)
{
ft_free_list_again(bib[i][j]);
free(bib[i][j]);
j++;
}
}
void ft_free_bib(t_list ***bib, t_params **params)
{
int i;
i = 0;
while (i < (*params)->index_max)
{
ft_free_list(bib, i);
free(bib[i]);
i++;
}
free(bib);
}