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/e_line.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/e_line.c') diff --git a/src/e_line.c b/src/e_line.c index 6da7f77..f47170f 100644 --- a/src/e_line.c +++ b/src/e_line.c @@ -41,7 +41,7 @@ static void { if (ptr->pipes != NULL) { - lpipes_clear(&ptr->pipes); + s_lpipes_clear(&ptr->pipes); } } -- 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/e_line.c | 45 ++++++++++----------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) (limited to 'src/e_line.c') diff --git a/src/e_line.c b/src/e_line.c index f47170f..bb97556 100644 --- a/src/e_line.c +++ b/src/e_line.c @@ -22,8 +22,7 @@ #include "s_struct.h" static uint8_t - get_builtin_id(const char bin[], - t_msh *msh) + e_get_builtin_id(const char bin[], t_msh *msh) { uint8_t i; @@ -36,44 +35,20 @@ static uint8_t return (i); } -static void - e_line_destroy(t_line *ptr) -{ - if (ptr->pipes != NULL) - { - s_lpipes_clear(&ptr->pipes); - } -} - void e_line(t_msh *msh) { - t_line *ptr; uint8_t bu_id; - uint8_t previf; - previf = 0; - ptr = msh->curr; - while (ptr != NULL) + if (msh->pipes != NULL) + e_pipes(msh); + else if (msh->com != NULL) { - if ((previf == 0) || (previf == 1 && msh->ret == 0) || - (previf == 2 && msh->ret != 0)) - { - if (ptr->pipes != NULL) - e_pipes(ptr, msh); - else if (ptr->com != NULL) - { - if (ptr->com->bin != NULL && - (bu_id = get_builtin_id(ptr->com->bin, msh)) - < FT_BUILTINS_COUNT) - e_builtin(ptr->com, bu_id, msh); - else if (ptr->com->bin != NULL) - e_extern(ptr->com, msh); - } - } - else - e_line_destroy(ptr); - previf = ptr->nextif; - ptr = ptr->next; + if (msh->com->bin != NULL && + (bu_id = e_get_builtin_id(msh->com->bin, msh)) + < FT_BUILTINS_COUNT) + e_builtin(msh->com, bu_id, msh); + else if (msh->com->bin != NULL) + e_extern(msh->com, msh); } } -- cgit v1.2.3 From 33a5806163fb91e4a72e188a9933ada20395f4e9 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 15 Sep 2020 20:44:45 +0200 Subject: Builtins ref toked --- src/e_line.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/e_line.c') diff --git a/src/e_line.c b/src/e_line.c index bb97556..caf3d75 100644 --- a/src/e_line.c +++ b/src/e_line.c @@ -20,20 +20,7 @@ #include "s_lpipes.h" #include "s_com.h" #include "s_struct.h" - -static uint8_t - e_get_builtin_id(const char bin[], t_msh *msh) -{ - uint8_t i; - - i = 0; - while (msh->bu_ref[i] != NULL && ft_strncmp(bin, msh->bu_ref[i], - ft_strlen(msh->bu_ref[i]) + 1) != 0) - { - i++; - } - return (i); -} +#include "u_utils.h" void e_line(t_msh *msh) @@ -45,7 +32,7 @@ void else if (msh->com != NULL) { if (msh->com->bin != NULL && - (bu_id = e_get_builtin_id(msh->com->bin, msh)) + (bu_id = u_get_builtin_id(msh->com->bin)) < FT_BUILTINS_COUNT) e_builtin(msh->com, bu_id, msh); else if (msh->com->bin != NULL) -- cgit v1.2.3