summaryrefslogtreecommitdiffstats
path: root/src/ft_p_lcom.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-21 16:09:25 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-21 16:09:25 +0200
commit23c53fec41ef1c9b62757c73b8ff8362139f8838 (patch)
treee2604b61531d9e6864c3b6038d8ea6848fc02903 /src/ft_p_lcom.c
parentGood (diff)
download42-minishell-23c53fec41ef1c9b62757c73b8ff8362139f8838.tar.gz
42-minishell-23c53fec41ef1c9b62757c73b8ff8362139f8838.tar.bz2
42-minishell-23c53fec41ef1c9b62757c73b8ff8362139f8838.tar.xz
42-minishell-23c53fec41ef1c9b62757c73b8ff8362139f8838.tar.zst
42-minishell-23c53fec41ef1c9b62757c73b8ff8362139f8838.zip
Linked list works, not memdeling
Diffstat (limited to '')
-rw-r--r--src/ft_p_lcom.c15
1 files changed, 6 insertions, 9 deletions
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);