From 95a16d2d88c8628ab0ae76f3ae04dfebee566950 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Thu, 27 Aug 2020 19:13:28 +0200 Subject: Fising tok_lst_new uninitialized next, Added tok_lst_debug, Fixing parse_cmd --- src/lexer/tok_lst.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/lexer/tok_lst.c') diff --git a/src/lexer/tok_lst.c b/src/lexer/tok_lst.c index 8d29bb5..a620aa5 100644 --- a/src/lexer/tok_lst.c +++ b/src/lexer/tok_lst.c @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/08/27 09:32:58 by charles #+# #+# */ -/* Updated: 2020/08/27 18:40:05 by charles ### ########.fr */ +/* Updated: 2020/08/27 20:54:35 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -31,6 +31,7 @@ t_tok_lst *tok_lst_new_until(enum e_tok tag, char *content, size_t n) return (NULL); } ret->tag = tag; + ret->next = NULL; return (ret); } @@ -57,3 +58,15 @@ t_tok_lst *tok_lst_last(t_tok_lst *tokens) { return ((t_tok_lst*)ft_lstlast((t_ftlst*)tokens)); } + +t_tok_lst *tok_lst_pop_front(t_tok_lst **tokens) +{ + t_tok_lst *poped; + + if (tokens == NULL || *tokens == NULL) + return (NULL); + poped = *tokens; + *tokens = poped->next; + poped->next = NULL; + return (poped); +} -- cgit