From 092c8e0eff5e232398f4874b85059e021445458c Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Fri, 5 Jul 2024 09:41:49 +0200 Subject: [PATCH] Fix wrong element insertion Instead of a copy the original token was inserted. This caused the elements sharing a token to be changed when only one shoud have been changed. --- ft_parse/ft_parsing_table_generate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ft_parse/ft_parsing_table_generate.c b/ft_parse/ft_parsing_table_generate.c index 2bdcf28..c2f4c6c 100644 --- a/ft_parse/ft_parsing_table_generate.c +++ b/ft_parse/ft_parsing_table_generate.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/27 11:16:53 by ljiriste #+# #+# */ -/* Updated: 2024/07/04 16:33:02 by ljiriste ### ########.fr */ +/* Updated: 2024/07/05 08:27:38 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -262,7 +262,7 @@ t_ft_stat add_first(t_vec *lookahead, const t_token *token, const t_vec *rules, if (is_terminal_token(token, tokens)) { token_copy = ft_token_dup(token); - res = ft_vec_setinsert(lookahead, token, void_cmp_token_type); + res = ft_vec_setinsert(lookahead, &token_copy, void_cmp_token_type); if (res != success) ft_free_token(&token_copy); return (res); -- 2.30.2