From f8ed290adaa4aa27e6e723fd70d5e8c9a871a6bc Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Thu, 1 Aug 2024 15:43:26 +0200 Subject: [PATCH] Remove redirections from the environment The redirections got handled in another way so this is not needed. --- src/env.c | 8 +------- src/execution.c | 5 +---- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/env.c b/src/env.c index 8d6829c..236cfdf 100644 --- a/src/env.c +++ b/src/env.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/21 21:24:52 by ljiriste #+# #+# */ -/* Updated: 2024/07/21 23:46:03 by ljiriste ### ########.fr */ +/* Updated: 2024/08/02 10:46:15 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,14 +19,9 @@ int init_env(t_execution_env *env, char **envp) env->stdin_fd = STDIN_FILENO; env->stdout_fd = STDOUT_FILENO; env->ret_val = 0; - if (ft_vec_init(&env->redirections, sizeof(t_redirection))) - return (1); env->vars = malloc(sizeof(t_vars)); if (!env->vars) - { - ft_vec_free(&env->redirections, NULL); return (1); - } return (init_vars(env->vars, envp)); } @@ -34,6 +29,5 @@ void clean_env(t_execution_env *env) { clean_vars(env->vars); free(env->vars); - ft_vec_free(&env->redirections, NULL); return ; } diff --git a/src/execution.c b/src/execution.c index c0b835c..0369008 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:30:29 by ljiriste ### ########.fr */ +/* Updated: 2024/08/01 15:43:00 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -814,7 +814,6 @@ int copy_env(t_execution_env *copy, const t_execution_env *env) ft_vec_init(©->vars->other, sizeof(char *)); ft_vec_copy(©->vars->exported, &env->vars->exported, v_strcopy, free); ft_vec_copy(©->vars->other, &env->vars->other, v_strcopy, free); - ft_vec_copy(©->redirections, &env->redirections, v_copy_redir, NULL); return (0); } @@ -822,7 +821,6 @@ void free_env(t_execution_env *env) { clean_vars(env->vars); free(env->vars); - ft_vec_free(&env->redirections, NULL); return ; } @@ -900,6 +898,5 @@ int execute(t_tree *parse_tree, t_execution_env *env) int res; res = ex_program(parse_tree, env); - ft_vec_forget_range(&env->redirections, env->redirections.size, 0); return (res); } -- 2.30.2