From 23c53fec41ef1c9b62757c73b8ff8362139f8838 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 21 Apr 2020 16:09:25 +0200 Subject: Linked list works, not memdeling --- src/ft_p_lcom.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/ft_p_lcom.c') diff --git a/src/ft_p_lcom.c b/src/ft_p_lcom.c index 6711b85..f928f5d 100644 --- a/src/ft_p_lcom.c +++ b/src/ft_p_lcom.c @@ -17,26 +17,23 @@ int8_t ft_p_lcom(const char line[], - const uint64_t count, - t_msh *msh) + const uint64_t count, + t_msh *msh) { uint64_t i; - char **words; + t_lcom *link; + char **words; i = 0; if (!(words = ft_split(line, ';'))) return (-1); while (i <= count) { - if (!(msh->lcom = ft_lcom_new(words[i]))) + if (!(link = ft_lcom_new(words[i]))) { return (-1); } - if (i < 1) - { - msh->lcom_head = msh->lcom; - } - msh->lcom = msh->lcom->next; + ft_lcom_add_back(&msh->curr, link); i++; } return (0); -- cgit v1.2.3