-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils_table.c
43 lines (38 loc) · 1.22 KB
/
utils_table.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils_table.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zhabri <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/10 11:22:00 by zhabri #+# #+# */
/* Updated: 2023/01/10 13:04:27 by zhabri ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
char **tab_dup(char **tab, int tab_len)
{
int i;
char **t;
t = ft_calloc(tab_len + 1, sizeof(char *));
i = 0;
while (i < tab_len)
{
t[i] = ft_strdup(tab[i]);
i++;
}
return (t);
}
void free_tab_bis(void *t)
{
int i;
char **tab;
i = 1;
tab = (char **)t;
while (tab[i])
{
free(tab[i]);
i++;
}
free(tab);
}