no more from pop_stack and ast_free

This commit is contained in:
Antoine Riard 2017-03-18 17:38:26 +01:00
parent da0d97b23f
commit 3a58fcd715
11 changed files with 53 additions and 18 deletions

View file

@ -291,6 +291,7 @@ parser/push_stack.c\
parser/read_stack.c\
parser/redir_init.c\
parser/stack_init.c\
parser/sym_free.c\
parser/tree_wrapper.c
SRCS = $(addprefix $(SRC_DIR), $(SRC_BASE))

17
42sh/file Normal file
View file

@ -0,0 +1,17 @@
42sh
42shelltest-tmp
Makefile
STDBUG
TESTSHELL
auteur
donovan_segaults_06-02
file
includes
libft
objs
pdf
sample
scriptheader.sh
src
test_framework.sh
update_makefile.sh

View file

@ -144,6 +144,7 @@ int isbang_sep(t_btree **ast, t_list **lst);
int join_ast(t_btree **ast, t_btree **new_node);
int gen_node(t_btree **ast);
int superflous_token(t_btree **ast, t_list **list);
void sym_free(void *data, size_t size);
struct s_distrostree
{
@ -170,8 +171,6 @@ struct s_cmd
union u_astdata
{
t_cmd cmd;
char **sstr;
char *str;
};
struct s_astnode

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/14 18:06:24 by jhalford #+# #+# */
/* Updated: 2016/12/06 20:10:51 by jhalford ### ########.fr */
/* Updated: 2017/03/18 17:33:49 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/05 13:39:33 by jhalford #+# #+# */
/* Updated: 2017/03/13 15:31:10 by jhalford ### ########.fr */
/* Updated: 2017/03/18 17:17:50 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/05 11:50:51 by jhalford #+# #+# */
/* Updated: 2017/03/15 19:18:02 by ariard ### ########.fr */
/* Updated: 2017/03/18 17:34:46 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -26,11 +26,7 @@ void ast_free(void *data, size_t content_size)
(void)content_size;
node = data;
if (node->type == CMD)
{
ft_ld_clear(&node->data.cmd.token, &ft_tabdel);
// ft_lstdel(&node->data.cmd.redir, &redir_free);
}
// if (node->type == WORDLIST)
// do clear
ft_lstdel(&node->data.cmd.redir, &redir_free);
free(node);
}

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/03 18:12:57 by ariard #+# #+# */
/* Updated: 2017/03/08 12:40:34 by jhalford ### ########.fr */
/* Updated: 2017/03/18 17:27:56 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/11 15:58:38 by ariard #+# #+# */
/* Updated: 2017/03/18 15:52:52 by ariard ### ########.fr */
/* Updated: 2017/03/18 17:28:43 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/11 16:17:38 by ariard #+# #+# */
/* Updated: 2017/03/18 15:46:49 by ariard ### ########.fr */
/* Updated: 2017/03/18 17:08:53 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/09 19:12:44 by ariard #+# #+# */
/* Updated: 2017/03/11 16:21:01 by ariard ### ########.fr */
/* Updated: 2017/03/18 17:16:00 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -22,13 +22,13 @@ int pop_stack(t_list **stack, t_sym erase_sym)
{
temp = *stack;
(*stack) = (*stack)->next;
ft_lstdelone(&temp, NULL);
ft_lstdelone(&temp, &sym_free);
}
if ((*stack) && *(head = (*stack)->content) != TERMINUS)
{
temp = *stack;
(*stack) = (*stack)->next;
ft_lstdelone(&temp, NULL);
ft_lstdelone(&temp, &sym_free);
}
else
return (1);

View file

@ -0,0 +1,22 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sym_free.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/18 17:13:31 by ariard #+# #+# */
/* Updated: 2017/03/18 17:15:11 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void sym_free(void *data, size_t size)
{
t_sym *sym;
(void)size;
sym = data;
free(sym);
}