diff --git a/src/builtin/builtin_router.c b/src/builtin/builtin_router.c index e6feb99..a63769a 100644 --- a/src/builtin/builtin_router.c +++ b/src/builtin/builtin_router.c @@ -27,5 +27,4 @@ int builtin_router(t_minishell *msh, t_command *cmd) if (is_builtin(cmd->args[0]) < 0) return (FALSE); return (builtin_fn[is_builtin(cmd->args[0])](msh, cmd)); - } diff --git a/src/environment/environment_print.c b/src/environment/environment_print.c index 5fcdfb7..07966a8 100644 --- a/src/environment/environment_print.c +++ b/src/environment/environment_print.c @@ -18,7 +18,7 @@ void environment_print(t_minishell *msh, int export) t_environment *env; env_list = msh->environment; - while(env_list != NULL) + while (env_list != NULL) { env = (t_environment *)env_list->content; if (export) diff --git a/src/executor/executor_child.c b/src/executor/executor_child.c index e7948bd..6b83d58 100644 --- a/src/executor/executor_child.c +++ b/src/executor/executor_child.c @@ -24,7 +24,7 @@ static int is_dir(char *path) return (S_ISDIR(path_stats.st_mode)); } -static int validate_executable_path(char *path) +static int validate_executable_path(char *path) { if (access(path, X_OK) < 0) { diff --git a/src/executor/executor_execute_pipeline.c b/src/executor/executor_execute_pipeline.c index ef2bce3..6f8925a 100644 --- a/src/executor/executor_execute_pipeline.c +++ b/src/executor/executor_execute_pipeline.c @@ -34,7 +34,7 @@ static int execute_builtin(t_minishell *msh, t_command *cmd) return (exit_status); } -static int executor_execute_command(t_minishell *msh, t_command *cmd) +static int executor_execute_command(t_minishell *msh, t_command *cmd) { if (is_builtin(cmd->args[0]) >= 0) msh->exit_status = execute_builtin(msh, cmd); diff --git a/src/lexer/lexer_parse_input.c b/src/lexer/lexer_parse_input.c index 375be79..5d05f86 100644 --- a/src/lexer/lexer_parse_input.c +++ b/src/lexer/lexer_parse_input.c @@ -41,6 +41,5 @@ t_list *ft_parse_input(t_minishell *msh) break ; } } - // ft_token_free(msh, token); return (list); } diff --git a/src/lexer/lexer_read_word.c b/src/lexer/lexer_read_word.c index 801961b..d60e43b 100644 --- a/src/lexer/lexer_read_word.c +++ b/src/lexer/lexer_read_word.c @@ -30,7 +30,6 @@ static int calculate_word_len(t_minishell *msh, t_lexer *lexer) i = lexer->pos; while (is_word_char(lexer->input[i])) { - len++; i++; } @@ -67,8 +66,6 @@ char *lexer_readword(t_minishell *msh, t_lexer *lexer) qts = (c == '"' || c == '\''); if (qts) return (lexer_parse_quotes(msh, lexer)); - // if (!match_quotes(msh, lexer, qts)) - // return (NULL); len = calculate_word_len(msh, lexer); word = read_word(msh, lexer, len); return (word); diff --git a/src/parser/parser_alloc_command.c b/src/parser/parser_alloc_command.c index cd9aee4..ecd7e1c 100644 --- a/src/parser/parser_alloc_command.c +++ b/src/parser/parser_alloc_command.c @@ -22,7 +22,6 @@ t_command *parser_alloc_command(t_minishell *msh) command->fd_out = 1; command->redirect_in = NULL; command->redirect_out = NULL; - // command->environment = NULL; command->n_fds = 0; return (command); } diff --git a/src/parser/parser_count_arguments.c b/src/parser/parser_count_arguments.c index 40f8d84..187af50 100644 --- a/src/parser/parser_count_arguments.c +++ b/src/parser/parser_count_arguments.c @@ -34,5 +34,3 @@ int parser_count_arguments(t_list *list) } return (cmds); } - - diff --git a/src/prompt/history_write.c b/src/prompt/history_write.c index 4c9b1d9..8cc3e95 100644 --- a/src/prompt/history_write.c +++ b/src/prompt/history_write.c @@ -20,7 +20,7 @@ void history_write(char *line) fd = open(".minishell_history", O_WRONLY | O_APPEND | O_CREAT, 0644); if (fd < 0) return ; - // if (*line) - // ft_putendl_fd(line, fd); + if (*line) + ft_putendl_fd(line, fd); close(fd); } diff --git a/src/utils/malloc_safe.c b/src/utils/malloc_safe.c index b4d423a..32dd747 100644 --- a/src/utils/malloc_safe.c +++ b/src/utils/malloc_safe.c @@ -15,8 +15,9 @@ void *malloc_safe(t_minishell *msh, size_t size) { void *ptr; + if (size == 0) - return (NULL); + return (NULL); ptr = malloc(size); check_malloc(msh, ptr); return (ptr);