From abc749bfb38ce6c1cfb818bbc0da1cfbd0451bfe Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 27 Aug 2020 16:14:40 +0200 Subject: Freed pipe leaks on builtins --- src/s_lpipes.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/s_lpipes.c') diff --git a/src/s_lpipes.c b/src/s_lpipes.c index 9d10849..f6a6845 100644 --- a/src/s_lpipes.c +++ b/src/s_lpipes.c @@ -20,7 +20,7 @@ #include "s_struct.h" struct s_lpipes - *lpipes_last(struct s_lpipes *lpipes) + *s_lpipes_last(struct s_lpipes *lpipes) { while (lpipes->next != NULL) lpipes = lpipes->next; @@ -28,7 +28,7 @@ struct s_lpipes } void - lpipes_add_back(struct s_lpipes **alpipes, + s_lpipes_add_back(struct s_lpipes **alpipes, struct s_lpipes *new) { struct s_lpipes *tmp; @@ -37,13 +37,13 @@ void *alpipes = new; else { - tmp = lpipes_last(*alpipes); + tmp = s_lpipes_last(*alpipes); tmp->next = new; } } void - lpipes_clear(struct s_lpipes **lpipes) + s_lpipes_clear(struct s_lpipes **lpipes) { struct s_lpipes *tmp; struct s_lpipes *renext; @@ -62,12 +62,12 @@ void } struct s_lpipes - *lpipes_new(const char pipedword[], + *s_lpipes_new(const char pipedword[], t_msh *msh) { struct s_lpipes *link; - if (!(link = (struct s_lpipes*)malloc(sizeof(struct s_lpipes)))) + if ((link = (struct s_lpipes*)malloc(sizeof(struct s_lpipes))) == NULL) return (NULL); link->com = NULL; if ((link->com = s_com_new(pipedword, msh)) == NULL) @@ -79,7 +79,7 @@ struct s_lpipes } struct s_lpipes - *split_pipes(const char word[], + *s_split_pipes(const char word[], t_line *line, t_msh *msh) { @@ -92,11 +92,11 @@ struct s_lpipes i = 0; while (words[i]) { - if (!(lpipes = lpipes_new(words[i], msh))) + if (!(lpipes = s_lpipes_new(words[i], msh))) { return (NULL); } - lpipes_add_back(&line->pipes, lpipes); + s_lpipes_add_back(&line->pipes, lpipes); i++; } ft_delwords(words); -- cgit v1.2.3 From d742075e1af0c063ef9677f157263c0d45253f73 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 8 Sep 2020 19:32:40 +0200 Subject: Rework in progress --- src/s_lpipes.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/s_lpipes.c') diff --git a/src/s_lpipes.c b/src/s_lpipes.c index f6a6845..0c1a6ea 100644 --- a/src/s_lpipes.c +++ b/src/s_lpipes.c @@ -79,9 +79,7 @@ struct s_lpipes } struct s_lpipes - *s_split_pipes(const char word[], - t_line *line, - t_msh *msh) + *s_split_pipes(const char word[], t_msh *msh) { struct s_lpipes *lpipes; char **words; @@ -96,7 +94,7 @@ struct s_lpipes { return (NULL); } - s_lpipes_add_back(&line->pipes, lpipes); + s_lpipes_add_back(&msh->pipes, lpipes); i++; } ft_delwords(words); -- cgit v1.2.3 From a1120710a40fd1ac8fae1d68da9c3fe3fb407da2 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 11 Sep 2020 15:27:54 +0200 Subject: TODO update --- src/s_lpipes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/s_lpipes.c') diff --git a/src/s_lpipes.c b/src/s_lpipes.c index 0c1a6ea..04320b8 100644 --- a/src/s_lpipes.c +++ b/src/s_lpipes.c @@ -62,8 +62,7 @@ void } struct s_lpipes - *s_lpipes_new(const char pipedword[], - t_msh *msh) + *s_lpipes_new(const char pipedword[], t_msh *msh) { struct s_lpipes *link; -- cgit v1.2.3