diff --git a/42sh/libft/src/lst/ft_lstdel.c b/42sh/libft/src/lst/ft_lstdel.c index f60ae2d0..720dd7e9 100644 --- a/42sh/libft/src/lst/ft_lstdel.c +++ b/42sh/libft/src/lst/ft_lstdel.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/03 15:18:57 by jhalford #+# #+# */ -/* Updated: 2017/03/26 21:33:45 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 21:56:50 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,7 @@ void ft_lstdel(t_list **alst, void (*del)(void *, size_t)) { - if (!(alst || *alst || del)) + if (!(alst && *alst && del)) return ; ft_lstdel(&(*alst)->next, del); ft_lstdelone(alst, del); diff --git a/42sh/src/exec/exec_destroy.c b/42sh/src/exec/exec_destroy.c index bbbdace0..1f9a068a 100644 --- a/42sh/src/exec/exec_destroy.c +++ b/42sh/src/exec/exec_destroy.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/08 14:31:42 by jhalford #+# #+# */ -/* Updated: 2017/03/26 21:40:16 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 21:56:52 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,6 +17,8 @@ int exec_destroy(t_exec *exec) t_jobc *jobc; int i; + if (!exec) + return (0); jobc = &data_singleton()->jobc; ft_lstdel(&exec->op_stack, ft_lst_cfree); ft_lstdel(&jobc->first_job, job_free); diff --git a/42sh/src/exec/exec_init.c b/42sh/src/exec/exec_init.c index 59c30110..62aec97d 100644 --- a/42sh/src/exec/exec_init.c +++ b/42sh/src/exec/exec_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/26 21:28:09 by jhalford #+# #+# */ -/* Updated: 2017/03/26 21:40:15 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 21:59:23 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/process_launch.c b/42sh/src/exec/process_launch.c index 14d5c134..6949e955 100644 --- a/42sh/src/exec/process_launch.c +++ b/42sh/src/exec/process_launch.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/13 22:21:19 by jhalford #+# #+# */ -/* Updated: 2017/03/26 21:39:39 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 21:50:39 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/history/add_str_in_history.c b/42sh/src/history/add_str_in_history.c index 0ccfaff2..bfb83140 100644 --- a/42sh/src/history/add_str_in_history.c +++ b/42sh/src/history/add_str_in_history.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/14 11:27:03 by gwojda #+# #+# */ -/* Updated: 2017/03/25 20:26:01 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 21:59:21 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/data_exit.c b/42sh/src/main/data_exit.c index d1bb2df3..42e361c3 100644 --- a/42sh/src/main/data_exit.c +++ b/42sh/src/main/data_exit.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/07 18:07:50 by jhalford #+# #+# */ -/* Updated: 2017/03/26 21:40:48 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 21:59:25 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,9 +17,8 @@ void data_exit(void) t_data *data; data = data_singleton(); - ft_strdel(&data->line.input); + /* ft_strdel(&data->line.input); */ ft_strdel(&data->binary); - exec_popfds(); ft_sstrfree(data->env); ft_sstrfree(data->local_var); ft_sstrfree(data->argv); diff --git a/42sh/src/main/data_init.c b/42sh/src/main/data_init.c index 07e91e6a..a554d48f 100644 --- a/42sh/src/main/data_init.c +++ b/42sh/src/main/data_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */ -/* Updated: 2017/03/26 21:40:49 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 21:54:19 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -83,9 +83,9 @@ int data_init(int ac, char **av, char **env) data->comp = NULL; data->opts = SH_INTERACTIVE | SH_OPTS_JOBC; data->lst_func = NULL; - exec_init(&data->exec); lexer_init(&data->lexer); parser_init(&data->parser); + exec_init(&data->exec); if ((term_name = ft_getenv(data->env, "TERM")) == NULL) term_name = "dumb"; if (tgetent(NULL, term_name) != 1) diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index a86c1fa2..73156a39 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */ -/* Updated: 2017/03/26 21:37:49 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 21:57:37 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -80,7 +80,6 @@ int main(int ac, char **av, char **env) lexer_destroy(&data->lexer); parser_destroy(&data->parser); exec_destroy(&data->exec); - /* ft_lstdel(&data_singleton()->exec.op_stack, &ft_lst_cfree); */ ft_lstdel(&token, &token_free); btree_del(&ast, &ast_free); if (ret == 1) diff --git a/42sh/src/parser/parser_destroy.c b/42sh/src/parser/parser_destroy.c index 02b4bf6e..0ca8ffcd 100644 --- a/42sh/src/parser/parser_destroy.c +++ b/42sh/src/parser/parser_destroy.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/16 19:30:17 by ariard #+# #+# */ -/* Updated: 2017/03/18 18:45:22 by ariard ### ########.fr */ +/* Updated: 2017/03/26 21:46:24 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/stack_init.c b/42sh/src/parser/stack_init.c index 391ffce8..67270a1c 100644 --- a/42sh/src/parser/stack_init.c +++ b/42sh/src/parser/stack_init.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/16 20:31:32 by ariard #+# #+# */ -/* Updated: 2017/03/26 21:37:19 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 21:47:01 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,8 +14,6 @@ int stack_init(t_parser *parser) { - ft_lstdel(&parser->stack, ft_lst_cfree); - /* parser->stack = NULL; */ push_stack(&parser->stack, TERMINUS); push_stack(&parser->stack, LINEBREAK); if (!parser->new_sym && !(parser->new_sym = ft_memalloc(sizeof(t_sym))))