-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lsttotab.c
executable file
·36 lines (33 loc) · 1.24 KB
/
ft_lsttotab.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lsttotab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tseguier <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/06/26 18:17:43 by tseguier #+# #+# */
/* Updated: 2014/06/26 18:33:49 by tseguier ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
char **ft_lsttotab(t_ldcd l)
{
char **tab;
int size;
t_ldcd_cell iter;
if (!l)
return (NULL);
size = ft_ldcdsize(l);
tab = (char **)ft_memalloc(sizeof(char *) * (size + 1));
if (!tab)
return (NULL);
tab[size] = NULL;
iter = l->tail;
while (iter)
{
tab[--size] = iter->content;
iter = iter->prev;
}
return (tab);
}