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

37
srcs/push.c Normal file
View File

@@ -0,0 +1,37 @@
#include "push_swap.h"
t_list *pa(t_stack **a, t_stack **b, t_list **solution)
{
t_stack *tmp;
if (!(tmp = ft_calloc(1, sizeof(t_stack))))
ps_stop(*a, *b, *solution, 2);
tmp->n = (*b)->n;
tmp->next = NULL;
(*a)->next = tmp;
fill_solution(solution, ft_strdup("pa"));
return (NULL);
}
t_list *pb(t_stack **dst, t_stack **src, t_list **solution)
{
t_stack *a;
t_stack *b;
t_stack *tmp;
a = *src;
b = *dst;
if (!(b = ft_calloc(1, sizeof(t_stack))))
ps_stop(a, b, *solution, 2);
b->n = a->n;
b->next = NULL;
tmp = a->next;
a->n = a->next->n;
a->next = a->next->next;
free(tmp);
fill_solution(solution, ft_strdup("pa"));
return (NULL);
}