From: Lukas Jiriste Date: Thu, 1 Aug 2024 13:53:02 +0000 (+0200) Subject: Simplify t_redirection X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=b6bcddcc4bfc9adcd12c044613e2070f6715698c;p=42%2Fminishell.git Simplify t_redirection Due to changes in f561c16753dcf7649b222c9b2e0fe6ca2445b6b9 it is possible to get rid of created attribute of t_redirection. It was included because of the same confusion as was talked in that commit. --- diff --git a/inc/minishell.h b/inc/minishell.h index ebfa49e..2320422 100644 --- a/inc/minishell.h +++ b/inc/minishell.h @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/02 13:22:57 by ljiriste #+# #+# */ -/* Updated: 2024/07/21 21:33:24 by ljiriste ### ########.fr */ +/* Updated: 2024/08/01 15:47:47 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,7 +24,6 @@ typedef struct s_vars typedef struct s_redirection { int from_to_fds[2]; - size_t created; } t_redirection; typedef struct s_execution_env @@ -33,7 +32,6 @@ typedef struct s_execution_env int stdout_fd; int ret_val; t_vars *vars; - t_vec redirections; } t_execution_env; typedef t_parse_tree_node t_tree; diff --git a/src/execution.c b/src/execution.c index 0369008..5813b7a 100644 --- a/src/execution.c +++ b/src/execution.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/21 08:57:54 by ljiriste #+# #+# */ -/* Updated: 2024/08/01 15:43:00 by ljiriste ### ########.fr */ +/* Updated: 2024/08/01 15:51:03 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -143,7 +143,7 @@ int add_redirection_file(t_vec *redirections, t_parse_tree_node *io_file, int fd free(filename); return (1); } - redir = (t_redirection){.from_to_fds[0] = fd, .from_to_fds[1] = sec_fd, .created = 0}; + redir = (t_redirection){.from_to_fds[0] = fd, .from_to_fds[1] = sec_fd}; } else { @@ -158,7 +158,7 @@ int add_redirection_file(t_vec *redirections, t_parse_tree_node *io_file, int fd free(filename); return (1); } - redir = (t_redirection){.from_to_fds[0] = fd, .from_to_fds[1] = sec_fd, .created = 1}; + redir = (t_redirection){.from_to_fds[0] = fd, .from_to_fds[1] = sec_fd}; } free(filename); return (ft_vec_append(redirections, &redir) != success); @@ -321,7 +321,7 @@ int add_redirection_here(t_vec *redirections, t_parse_tree_node *io_here, int fd free(delimiter); if (err) return (1); - redir = (t_redirection){.from_to_fds[0] = fd, .from_to_fds[1] = pipe_fds[0], .created = 1}; + redir = (t_redirection){.from_to_fds[0] = fd, .from_to_fds[1] = pipe_fds[0]}; return (ft_vec_append(redirections, &redir) != success); }