-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.c
31 lines (28 loc) · 1.14 KB
/
init.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kakiba <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/13 12:40:02 by kakiba #+# #+# */
/* Updated: 2023/01/15 15:15:19 by kakiba ### ########.fr */
/* */
/* ************************************************************************** */
#include "pushswap.h"
int init_dlist_free_list(t_dlist **a, int n, int *list)
{
int i;
t_dlist *nd;
i = 0;
while (i < n)
{
nd = ft_dlstnew(list[i]);
if (!nd)
exit_error(a, list, NULL, "ERROR");
ft_dlstadd_back(a, nd);
++i;
}
free (list);
return (0);
}