From a680cf09a3fa4b7c6adc38e4297ee5535172826b Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Thu, 27 Aug 2020 18:47:16 +0200 Subject: Updated preprocessing, redir, ast to use t_tok_lst instead of t_ftlst --- src/ast.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/ast.c') diff --git a/src/ast.c b/src/ast.c index 4e67c52..e2c4017 100644 --- a/src/ast.c +++ b/src/ast.c @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:05:42 by charles #+# #+# */ -/* Updated: 2020/06/18 14:46:07 by nahaddac ### ########.fr */ +/* Updated: 2020/08/27 18:39:31 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,7 +23,7 @@ ** \return Created node or NULL on error */ -t_ast *ast_new(enum e_ast_tag tag) +t_ast *ast_new(enum e_ast tag) { t_ast *ast; @@ -46,16 +46,17 @@ void ast_destroy(t_ast *ast) { if (ast == NULL) return ; - //ft_lstdestroy(&ast->cmd_argv, (void (*)(void*))token_destroy); if (ast->tag == AST_CMD) { - ft_lstdestroy(&ast->cmd_argv, (void (*)(void*))token_destroy); - ft_lstdestroy(&ast->redirs, (void (*)(void*))token_destroy); + tok_lst_destroy(&ast->cmd_argv, free); + tok_lst_destroy(&ast->redirs, free); } else if (ast->tag == AST_OP) { ast_destroy(ast->op.left); ast_destroy(ast->op.right); } + else if (ast->tag == AST_PARENT) + ast_destroy(ast->parent_ast); free(ast); } -- cgit