ps_stop fonctionne
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
void is_valid(int ac, char **av)
|
||||
{
|
||||
if (ac < 2)
|
||||
ps_error(1);
|
||||
ps_stop(NULL, NULL, NULL, 1);
|
||||
(void)av;
|
||||
// check more error
|
||||
}
|
||||
@@ -18,7 +18,7 @@ t_stack *init_stack(int ac, char **av)
|
||||
while (--ac)
|
||||
{
|
||||
if (!(start = ft_calloc(1, sizeof(t_stack))))
|
||||
ps_clean(start, 2);
|
||||
ps_stop(start, NULL, NULL, 2);
|
||||
start->n = ft_atoi(av[ac]);
|
||||
start->next = tmp;
|
||||
tmp = start;
|
||||
@@ -26,19 +26,6 @@ t_stack *init_stack(int ac, char **av)
|
||||
return (start);
|
||||
}
|
||||
|
||||
void print_stack(t_stack *stack)
|
||||
{
|
||||
ft_putstr("[");
|
||||
while (stack)
|
||||
{
|
||||
ft_printf("%i", stack->n);
|
||||
stack = stack->next;
|
||||
if (stack)
|
||||
ft_putstr("; ");
|
||||
}
|
||||
ft_putstr("]\n");
|
||||
}
|
||||
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
t_stack *stack;
|
||||
@@ -49,6 +36,6 @@ int main(int ac, char **av)
|
||||
print_stack(stack);
|
||||
result = sort_algo(stack);
|
||||
ft_printf("%s\n", result->content);
|
||||
ps_clean(stack, 1);
|
||||
ps_stop(stack, NULL, result, 0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user