added protection on double pipes
This commit is contained in:
parent
0495ba9e55
commit
d85e0873cb
@ -6,7 +6,7 @@
|
|||||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/03/23 17:31:19 by tmaze #+# #+# */
|
/* Created: 2019/03/23 17:31:19 by tmaze #+# #+# */
|
||||||
/* Updated: 2019/04/11 10:50:04 by tmaze ### ########.fr */
|
/* Updated: 2019/04/11 17:31:09 by tmaze ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -66,6 +66,7 @@ typedef struct s_syntax
|
|||||||
int e_error;
|
int e_error;
|
||||||
int v_error;
|
int v_error;
|
||||||
int l_error;
|
int l_error;
|
||||||
|
int gr_status;
|
||||||
int s_vert;
|
int s_vert;
|
||||||
int e_vert;
|
int e_vert;
|
||||||
int e_cmd;
|
int e_cmd;
|
||||||
@ -97,6 +98,7 @@ int lm_validate(t_syntax *synt, t_lmdata *lmdata);
|
|||||||
int lm_parser(t_syntax *synt, t_lmdata *ldata
|
int lm_parser(t_syntax *synt, t_lmdata *ldata
|
||||||
, t_holder *holder);
|
, t_holder *holder);
|
||||||
int lm_check_room_before(char **tab, t_syntax *synt);
|
int lm_check_room_before(char **tab, t_syntax *synt);
|
||||||
|
void lm_clear_unv(t_holder *holder);
|
||||||
int lm_add_vertex(t_lmdata *ldata, char *raw, char flag
|
int lm_add_vertex(t_lmdata *ldata, char *raw, char flag
|
||||||
, t_syntax *synt);
|
, t_syntax *synt);
|
||||||
int lm_ext_conn(t_holder *holder, t_lmdata *data
|
int lm_ext_conn(t_holder *holder, t_lmdata *data
|
||||||
|
@ -6,13 +6,29 @@
|
|||||||
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/03/29 07:17:06 by mndhlovu #+# #+# */
|
/* Created: 2019/03/29 07:17:06 by mndhlovu #+# #+# */
|
||||||
/* Updated: 2019/04/09 18:18:59 by tmaze ### ########.fr */
|
/* Updated: 2019/04/11 20:34:58 by tmaze ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "lem_in.h"
|
#include "lem_in.h"
|
||||||
|
|
||||||
int lm_adj_parser(t_lmdata *lmdata, t_holder *holder)
|
static int is_link_in(t_lmdata *data, int src, int dest)
|
||||||
|
{
|
||||||
|
t_ind *it;
|
||||||
|
if (src < data->nb_nodes)
|
||||||
|
{
|
||||||
|
it = data->adj[src];
|
||||||
|
while (it)
|
||||||
|
{
|
||||||
|
if (it->index == dest)
|
||||||
|
return (1);
|
||||||
|
it = it->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int lm_adj_parser(t_lmdata *lmdata, t_holder *holder)
|
||||||
{
|
{
|
||||||
t_temp *data;
|
t_temp *data;
|
||||||
|
|
||||||
@ -23,7 +39,8 @@ int lm_adj_parser(t_lmdata *lmdata, t_holder *holder)
|
|||||||
{
|
{
|
||||||
while (data)
|
while (data)
|
||||||
{
|
{
|
||||||
lst_indadd_link(lmdata, data->src_ind, data->dest_ind);
|
if (!is_link_in(lmdata, data->src_ind, data->dest_ind))
|
||||||
|
lst_indadd_link(lmdata, data->src_ind, data->dest_ind);
|
||||||
data = data->next;
|
data = data->next;
|
||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user