Cleaned the seg faults and normed the code, only

lm_mem_utils has a norm error.
This commit is contained in:
Mthandazo Ndhlovu
2019-05-06 08:05:37 +02:00
parent a40b6b00e7
commit a21860983e
14 changed files with 139 additions and 10737 deletions

View File

@@ -6,7 +6,7 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/23 17:43:34 by tmaze #+# #+# */
/* Updated: 2019/05/02 12:52:26 by mndhlovu ### ########.fr */
/* Updated: 2019/05/06 07:25:15 by mndhlovu ### ########.fr */
/* */
/* ************************************************************************** */
@@ -19,52 +19,58 @@ void lm_initdata(t_lmdata *data)
data->adj = NULL;
}
void lm_check_start_vert(int count, t_syntax *synt, t_lmdata *ldata, char *line)
void lm_check_start_vert(int count, t_holder *hol
, t_lmdata *ldata, char *line)
{
if ((synt->s_pos < synt->e_pos) && lm_check_forbiden_chars(line, 0))
if ((hol->s_pos < hol->e_pos)
&& lm_check_forbiden_chars(line, 0))
{
if ((count > synt->s_pos && count < synt->e_pos)
&& (!synt->s_vert))
if ((count > hol->s_pos && count < hol->e_pos)
&& (!hol->s_vert))
{
if ((lm_add_vertex(ldata, line, 's', synt)))
synt->s_vert = count;
if ((lm_add_vertex(ldata, line, 's', hol)))
hol->s_vert = count;
else
synt->s_error = 1;
}
hol->s_error = 1;
}
}
if ((synt->s_pos > synt->e_pos) && lm_check_forbiden_chars(line, 0))
if ((hol->s_pos > hol->e_pos)
&& lm_check_forbiden_chars(line, 0))
{
if (!synt->s_vert)
if (!hol->s_vert)
{
if ((lm_add_vertex(ldata, line, 's', synt)))
synt->s_vert = count;
if ((lm_add_vertex(ldata, line, 's', hol)))
hol->s_vert = count;
else
synt->s_error = 1;
hol->s_error = 1;
}
}
}
void lm_check_end_vert(int count, t_syntax *synt, t_lmdata *ldata, char *line)
void lm_check_end_vert(int count, t_holder *hol
, t_lmdata *ldata, char *line)
{
if((synt->e_pos < synt->s_pos) && lm_check_forbiden_chars(line, 0))
if ((hol->e_pos < hol->s_pos)
&& lm_check_forbiden_chars(line, 0))
{
if ((count > synt->e_pos && count < synt->s_pos)
&& (!synt->e_vert))
if ((count > hol->e_pos && count < hol->s_pos)
&& (!hol->e_vert))
{
if ((lm_add_vertex(ldata, line, 'e', synt)))
synt->e_vert = count;
if ((lm_add_vertex(ldata, line, 'e', hol)))
hol->e_vert = count;
else
synt->e_error = 1;
hol->e_error = 1;
}
}
if ((synt->e_pos > synt->s_pos) && lm_check_forbiden_chars(line, 0))
if ((hol->e_pos > hol->s_pos)
&& lm_check_forbiden_chars(line, 0))
{
if (!synt->e_vert)
if (!hol->e_vert)
{
if ((lm_add_vertex(ldata, line, 'e', synt)))
synt->e_vert = count;
if ((lm_add_vertex(ldata, line, 'e', hol)))
hol->e_vert = count;
else
synt->e_error = 1;
hol->e_error = 1;
}
}
}