leaks and leaks with errors should be ok
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
#include "push_swap.h"
|
||||
|
||||
// check more error
|
||||
void is_valid(int ac, char **av)
|
||||
{
|
||||
if (ac < 2)
|
||||
ps_stop(NULL, 1);
|
||||
(void)av;
|
||||
}
|
||||
|
||||
int check_flag(int *ac, char ***av)
|
||||
{
|
||||
if (ft_strcmp((*av)[1], "-p") == 0)
|
||||
@@ -32,19 +24,16 @@ t_stack *fill_stack(t_stack *list, char *nb)
|
||||
|
||||
new = ft_calloc(1, sizeof(t_stack));
|
||||
if (!new)
|
||||
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;
|
||||
ps_stop((t_list *)list, 3);
|
||||
new->next = list;
|
||||
list = new;
|
||||
*/
|
||||
if (ft_isnumber(nb) == 0)
|
||||
ps_stop((t_list *)list, 3);
|
||||
nbl = ft_atol(nb);
|
||||
if (nbl < INT_MIN || nbl > INT_MAX)
|
||||
ps_stop((t_list *)list, 3);
|
||||
list->n = nbl;
|
||||
list->limit = 0;
|
||||
return (list);
|
||||
}
|
||||
|
||||
@@ -102,7 +91,8 @@ int main(int ac, char **av)
|
||||
t_list *solution;
|
||||
int flag;
|
||||
|
||||
is_valid(ac, av);
|
||||
if (ac < 2)
|
||||
ps_stop(NULL, 1);
|
||||
flag = check_flag(&ac, &av);
|
||||
a = init_stack(ac, av);
|
||||
b = NULL;
|
||||
|
||||
Reference in New Issue
Block a user