Simplify t_redirection
authorLukas Jiriste <ljiriste@student.42prague.com>
Thu, 1 Aug 2024 13:53:02 +0000 (15:53 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Fri, 2 Aug 2024 12:37:34 +0000 (14:37 +0200)
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.

inc/minishell.h
src/execution.c

index ebfa49ec91821be495bcf6f88a3ee80b531c5801..2320422b514048d7dc0131513dfb36f96020d59a 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   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;
index 0369008d34a0fc709527742bf2c8755294122dd7..5813b7acc5055dfc195a000bdfe3227a370bbf1b 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   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);
 }