only gets better B)
ditched GNL for ft_getline in checker norm cleanup
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/02/23 13:35:15 by tmaze #+# #+# */
|
||||
/* Updated: 2019/03/15 16:52:54 by tmaze ### ########.fr */
|
||||
/* Updated: 2019/03/17 17:24:43 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -70,19 +70,25 @@ int read_ops(t_psdata *data)
|
||||
{
|
||||
t_list *nop;
|
||||
char *buff;
|
||||
char tmp[4];
|
||||
int ret;
|
||||
|
||||
buff = NULL;
|
||||
while ((ret = get_next_line(0, &buff)) > 0)
|
||||
ft_bzero(tmp, 4);
|
||||
while ((ret = ft_getline(&buff)) > 0)
|
||||
{
|
||||
ft_strncpy(tmp, buff, 3);
|
||||
if (ft_strlen(buff) > 4 || !is_op(buff)
|
||||
|| (nop = ft_lstnew(buff, 4)) == NULL)
|
||||
|| (nop = ft_lstnew(tmp, 4)) == NULL)
|
||||
{
|
||||
ft_putendl_fd("Error", 2);
|
||||
ft_strdel(&buff);
|
||||
return (1);
|
||||
}
|
||||
ft_lstaddend(&(data->op), nop);
|
||||
ft_strdel(&buff);
|
||||
}
|
||||
ft_strdel(&buff);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -92,10 +98,10 @@ void check_stack(t_psdata *data)
|
||||
int nb;
|
||||
|
||||
ind = data->a;
|
||||
nb = ind->nb;
|
||||
while (ind)
|
||||
{
|
||||
if (ind->nb < nb)
|
||||
nb = ind->nb;
|
||||
if (ind->nb < nb || data->size_b > 0)
|
||||
{
|
||||
ft_putendl("KO");
|
||||
return ;
|
||||
@@ -103,7 +109,7 @@ void check_stack(t_psdata *data)
|
||||
nb = ind->nb;
|
||||
ind = ind->next;
|
||||
}
|
||||
if (!ind)
|
||||
if (!ind && data->size_b == 0)
|
||||
ft_putendl("OK");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user