/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* parsing_2.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: mteriier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/12/22 13:10:58 by mteriier #+# #+# */ /* Updated: 2025/12/22 13:11:21 by mteriier ### ########.fr */ /* */ /* ************************************************************************** */ #include "push_swap.h" #include static t_stack *parsing2(int *tab, int len) { int i; int stock; t_stack *first; t_stack *new; i = 0; first = NULL; while (i < len) { stock = tab[i]; new = new_stack(stock); if (!new && !first) return (NULL); else if (!new) { stack_clear_all(first, first); return (NULL); } stack_add_back(&first, new); i++; } return (first); } t_stacks *init_big_stacks2(int *tab, int len) { t_stacks *stacks; t_stack *a; stacks = malloc(sizeof(t_stacks)); stacks->a = NULL; stacks->b = NULL; if (!stacks) return (NULL); a = parsing2(tab, len); stacks->a = a; return (stacks); }