pile b ne fonctionne pas

This commit is contained in:
hugogogo
2021-06-15 02:54:06 +02:00
parent 825b82905b
commit aeb5b57725
21 changed files with 110 additions and 13 deletions

View File

@@ -49,7 +49,10 @@ t_stack *init_stack(int ac, char **av)
/*
** this function creates the stack b and the list solution
** then it init the list solution with initial values of stack a (in case of flag -p)
** then it init the list solution with :
** - first element : pointer to stack a
** - secnd element : pointer to stack b
** - third element : initial values of stack a (in case of flag -p)
** then it calls the sorting algorithm
** then it calls ps_stop() to free everything that needs to be freed
*/
@@ -58,11 +61,13 @@ t_list *launch_algo(t_stack *a)
t_stack *b;
t_list *solution;
if(!(b = ft_calloc(1, sizeof(t_stack))))
ps_stop(a, b, NULL, 2);
b = NULL;
solution = NULL;
fill_solution(a, NULL, &solution, ft_strdup("start"));
ft_lstadd_back(&solution, ft_lstnew(a));
ft_lstadd_back(&solution, ft_lstnew(b));
fill_solution(&solution, ft_strdup("start"));
hugo_sort(&a, &b, &solution);
//bubble_sort(&a, &b, solution);
ps_stop(NULL, b, NULL, -1);
return (solution);
}