From 846fa4d5b8b14bdb1d7994f09d7999e26c553fe4 Mon Sep 17 00:00:00 2001 From: adjoly Date: Thu, 1 Aug 2024 18:09:49 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=94=A8=E3=80=8D=20fix:=20fixed?= =?UTF-8?q?=20conditional=20jump=20when=20heredoc=20in=20pipe=20TODO:=20le?= =?UTF-8?q?ak=20:sob:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libft/Makefile | 4 ++-- libft/src/linked_lists/ft_lstclear.c | 7 ++++--- src/exec/heredoc.c | 2 +- src/exec/heredoc_utils.c | 6 +++--- src/parsing/get_cmd_list.c | 5 ++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libft/Makefile b/libft/Makefile index 56257f8..b4d231d 100644 --- a/libft/Makefile +++ b/libft/Makefile @@ -6,7 +6,7 @@ # By: mmoussou next; - ft_lstdelone(*lst, del); + if ((*lst)->content) + ft_lstdelone(*lst, del); *lst = tmp; } } diff --git a/src/exec/heredoc.c b/src/exec/heredoc.c index 4f2d91a..a86531c 100644 --- a/src/exec/heredoc.c +++ b/src/exec/heredoc.c @@ -6,7 +6,7 @@ /* By: mmoussou +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/10 01:14:10 by adjoly #+# #+# */ -/* Updated: 2024/07/15 17:03:12 by adjoly ### ########.fr */ +/* Updated: 2024/08/01 17:58:58 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,13 +32,13 @@ void ft_lstclear_till_nxt(t_list **lst, void (*del)(void *)) { t_list *tmp; + if (!lst || !del) + return ; if (!(*lst)->next) { free(*lst); return ; } - if (!lst || !del) - return ; while (lst && *lst && (*lst)->next && del) { tmp = (*lst)->next; diff --git a/src/parsing/get_cmd_list.c b/src/parsing/get_cmd_list.c index be14e35..90aed11 100644 --- a/src/parsing/get_cmd_list.c +++ b/src/parsing/get_cmd_list.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/31 12:47:13 by adjoly #+# #+# */ -/* Updated: 2024/07/20 17:11:41 by adjoly ### ########.fr */ +/* Updated: 2024/08/01 18:07:13 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -41,8 +41,7 @@ t_list *get_cmd_list(t_list *list) tmp = tmp->next; while (tmp) { - ft_lstadd_back(&cmd_list, ft_lstnew(get_redir_fd(tmp->content, \ - ((t_token *)tmp->content)->redirection))); + ft_lstadd_back(&cmd_list, make_lst(tmp)); if (!ft_lstlast(cmd_list)->content) { ft_lstclear(&cmd_list, &free_cmd);