Trying to trace the source of the segfault

I will breakdown the parser for a slight moment then relink it.
This commit is contained in:
Mthandazo Ndhlovu
2019-04-22 16:00:16 +02:00
parent a8b2e31701
commit c35deace58
15 changed files with 93 additions and 209 deletions

View File

@@ -6,7 +6,7 @@
/* By: mndhlovu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/25 06:31:37 by mndhlovu #+# #+# */
/* Updated: 2019/04/11 11:39:06 by tmaze ### ########.fr */
/* Updated: 2019/04/22 12:52:48 by mndhlovu ### ########.fr */
/* */
/* ************************************************************************** */
@@ -88,7 +88,7 @@ int lm_find_index(t_lmdata *data, char *str)
nodes = data->nodes_data;
while (nodes)
{
if (ft_strcmp(nodes->name, str) == 0)
if (ft_strequ(nodes->name, str))
return (nodes->ind);
nodes = nodes->next;
}
@@ -99,6 +99,8 @@ int lm_ext_conn(t_holder *holder, t_lmdata *data, char *raw)
{
char **tab;
t_temp *temp;
int src;
int dest;
t_temp *new;
if (!(new = (t_temp *)ft_memalloc(sizeof(t_temp))))
@@ -106,8 +108,16 @@ int lm_ext_conn(t_holder *holder, t_lmdata *data, char *raw)
tab = ft_strsplit(raw, '-');
if (tab != NULL)
{
new->src_ind = lm_find_index(data, tab[0]);
new->dest_ind = lm_find_index(data, tab[1]);
src = lm_find_index(data, tab[0]);
dest = lm_find_index(data, tab[1]);
if (src == -1 || dest == -1)
{
ft_printf("Bingo :%s\n", raw);
ft_del_words_tables(&tab);
return 0;
}
new->src_ind = src;
new->dest_ind = dest;
new->next = NULL;
if (holder->data == NULL)
holder->data = new;