segfaults have been eliminated
This commit is contained in:
@@ -6,30 +6,32 @@
|
||||
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/04 09:24:45 by mndhlovu #+# #+# */
|
||||
/* Updated: 2019/04/24 09:47:29 by tmaze ### ########.fr */
|
||||
/* Updated: 2019/04/26 11:51:12 by mndhlovu ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "lem_in.h"
|
||||
|
||||
int lm_check_ant_no(char *line)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = ft_strlen(line);
|
||||
if (len > 0)
|
||||
{
|
||||
if (len == 1 && ft_isdigit(*line))
|
||||
return (*line - '0');
|
||||
else if (len > 1 && len < 19 && ft_isnumeric(line))
|
||||
return (ft_atoi(line));
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
int lm_get_value(char *line)
|
||||
{
|
||||
int index;
|
||||
|
||||
if (line != NULL)
|
||||
{
|
||||
index = ft_atoi(line);
|
||||
if (index > INT_MIN && index < INT_MAX)
|
||||
{
|
||||
if (index > 0)
|
||||
return (index);
|
||||
else
|
||||
{
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (-1);
|
||||
return (lm_check_ant_no(line));
|
||||
return (0);
|
||||
}
|
||||
|
||||
void lm_get_cmd_vert(int count, t_syntax *synt
|
||||
@@ -63,23 +65,17 @@ void lm_get_vert_link(int count, t_syntax *synt, t_lmdata *ldata
|
||||
, t_holder *holder, char *line)
|
||||
{
|
||||
if (count > 0 && (count != synt->s_vert && count != synt->e_vert)
|
||||
&& (count != synt->s_pos && count != synt->e_pos))
|
||||
&& (count != synt->s_pos && count != synt->e_pos && line != NULL))
|
||||
{
|
||||
if (lm_check_forbiden_chars(line, 0))
|
||||
{
|
||||
ft_printf("Bingo 7 %s\n", line);
|
||||
if (!(lm_add_vertex(ldata, line, 'v', synt)))
|
||||
{
|
||||
synt->v_error = 1;
|
||||
}
|
||||
synt->v_error = 1;
|
||||
}
|
||||
if (lm_check_forbiden_chars(line, 3))
|
||||
{
|
||||
if (!(lm_ext_conn(holder, ldata, line)))
|
||||
{
|
||||
synt->l_error = 1;
|
||||
return ;
|
||||
}
|
||||
synt->l_error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user