-
Notifications
You must be signed in to change notification settings - Fork 0
/
free.c
45 lines (40 loc) · 1.17 KB
/
free.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vburton <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/06 14:38:24 by victor #+# #+# */
/* Updated: 2023/03/22 15:50:00 by vburton ### ########.fr */
/* */
/* ************************************************************************** */
#include "pipex.h"
void ft_free_split(char **array)
{
int i;
i = 0;
if (array)
{
while (array[i])
{
free(array[i]);
i++;
}
free(array);
}
}
void ft_free(t_cmd *cmd)
{
int i;
i = 0;
if (cmd)
{
while (i < 2)
{
ft_free_split(cmd[i].array);
i++;
}
free(cmd);
}
}