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,20 +6,20 @@
/* By: mndhlovu <mndhlovu@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/22 08:55:30 by mndhlovu #+# #+# */
/* Updated: 2019/05/02 13:20:38 by mndhlovu ### ########.fr */
/* Updated: 2019/05/06 07:34:46 by mndhlovu ### ########.fr */
/* */
/* ************************************************************************** */
#include "lem_in.h"
int lm_check_room_before(char **tab, t_syntax *synt)
int lm_check_room_before(char **tab, t_holder *holder)
{
if (tab[0] != NULL && tab[1] != NULL && tab[2] != NULL)
{
if (lm_validate_rooms(tab[0], tab[1], tab[2]))
return (1);
}
synt->v_error = 1;
holder->v_error = 1;
return (0);
}
@@ -62,23 +62,25 @@ void lm_clear_unv(t_holder *holder, t_lmdata *ldata)
del_map(ldata);
}
int lm_verify_links(t_holder *data, t_syntax *synt)
int lm_verify_links(t_holder *data, t_holder *hold)
{
if (!synt->l_error || (synt->l_error && data->count > 0))
if (!hold->l_error
|| (hold->l_error
&& data->count > 0))
return (1);
return (0);
}
int lm_verify_cmd(t_syntax *synt, t_holder *holder
int lm_verify_cmd(t_holder *holder
, t_lmdata *data)
{
if (synt->s_cmd && synt->e_cmd
&& !synt->e_error && !synt->s_error
&& !synt->v_error
&& synt->s_vert
&& synt->e_vert
&& synt->nb_state
&& lm_verify_links(holder, synt)
if (holder->s_cmd && holder->e_cmd
&& !holder->e_error && !holder->s_error
&& !holder->v_error
&& holder->s_vert
&& holder->e_vert
&& holder->nb_state
&& lm_verify_links(holder, holder)
&& (data->nb_nodes > 0))
return (1);
lm_clear_unv(holder, data);