gestion erreurs et leaks en cours de debug
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
void is_valid(int ac, char **av)
|
||||
{
|
||||
if (ac < 2)
|
||||
ps_stop(NULL, NULL, 1);
|
||||
ps_stop(NULL, 1);
|
||||
(void)av;
|
||||
}
|
||||
|
||||
@@ -28,14 +28,23 @@ int check_flag(int *ac, char ***av)
|
||||
t_stack *fill_stack(t_stack *list, char *nb)
|
||||
{
|
||||
t_stack *new;
|
||||
long nbl;
|
||||
|
||||
new = ft_calloc(1, sizeof(t_stack));
|
||||
if (!new)
|
||||
ps_stop(NULL, NULL, 2);
|
||||
new->n = ft_atoi(nb);
|
||||
ps_stop((t_list *)list, 2);
|
||||
|
||||
/*
|
||||
if (ft_isnumber(nb) == 0)
|
||||
ps_stop((t_list *)list, 2);
|
||||
nbl = ft_atol(nb);
|
||||
if (nbl < INT_MIN || nbl > INT_MAX)
|
||||
ps_stop((t_list *)list, 2);
|
||||
new->n = nbl;
|
||||
new->limit = 0;
|
||||
new->next = list;
|
||||
list = new;
|
||||
*/
|
||||
return (list);
|
||||
}
|
||||
|
||||
@@ -76,8 +85,13 @@ t_list *launch_algo(t_stack **a, t_stack **b, int flag)
|
||||
fill_solution(solution, "start");
|
||||
mark_step(solution, "start");
|
||||
}
|
||||
hugo_sort(a, b, solution);
|
||||
// bubble_sort(a, b, solution);
|
||||
if (sublist_size(*a) <= 3)
|
||||
special_sort_3(a, solution);
|
||||
else if (sublist_size(*a) <= 5)
|
||||
special_sort_5(a, b, solution);
|
||||
else
|
||||
hugo_sort(a, b, solution);
|
||||
// bubble_sort_luke(a, b, solution);
|
||||
return (solution);
|
||||
}
|
||||
|
||||
@@ -94,6 +108,6 @@ int main(int ac, char **av)
|
||||
b = NULL;
|
||||
solution = launch_algo(&a, &b, flag);
|
||||
print_result(solution, flag);
|
||||
ps_stop(NULL, solution, 0);
|
||||
ps_stop(solution, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user