added protection on double pipes

This commit is contained in:
Tanguy MAZE 2019-04-11 22:34:35 +02:00
parent 0495ba9e55
commit d85e0873cb
2 changed files with 23 additions and 4 deletions

View File

@ -6,7 +6,7 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 v_error;
int l_error;
int gr_status;
int s_vert;
int e_vert;
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
, t_holder *holder);
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
, t_syntax *synt);
int lm_ext_conn(t_holder *holder, t_lmdata *data

View File

@ -6,12 +6,28 @@
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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"
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;
@ -23,6 +39,7 @@ int lm_adj_parser(t_lmdata *lmdata, t_holder *holder)
{
while (data)
{
if (!is_link_in(lmdata, data->src_ind, data->dest_ind))
lst_indadd_link(lmdata, data->src_ind, data->dest_ind);
data = data->next;
}