diff options
| author | Dominik Kaiser | 2024-06-28 15:09:32 +0200 |
|---|---|---|
| committer | GitHub | 2024-06-28 15:09:32 +0200 |
| commit | 8103cadfc95fb76539bfccc893a2101ccb89ea90 (patch) | |
| tree | b46379099324f76f2496909b4de3cd71de8b772a /src/free_token.c | |
| parent | 031685832d8267acc2fa46ea9732b8e95eb34463 (diff) | |
| download | minishell-8103cadfc95fb76539bfccc893a2101ccb89ea90.tar.gz minishell-8103cadfc95fb76539bfccc893a2101ccb89ea90.zip | |
Add data structures for tokenizing and parsing
* Add data structures and helper functions for ast
* Add data structures for tokenizing
* Add helper functions for token structures
* Include token.h in minishell.h
* Add new/free functions for nodes/tokens to Makefile
* Add UNREACHABLE macro to debug_tools.h
Diffstat (limited to 'src/free_token.c')
| -rw-r--r-- | src/free_token.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/free_token.c b/src/free_token.c new file mode 100644 index 0000000..9f5c4e9 --- /dev/null +++ b/src/free_token.c @@ -0,0 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* free_token.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/06/27 14:38:57 by dkaiser #+# #+# */ +/* Updated: 2024/06/28 14:55:12 by dkaiser ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "token.h" + +void free_token(t_token *token) +{ + if (token->type == STRING_TOKEN) + free(token->content.string); + if (token->previous != NULL) + token->previous->next = NULL; + if (token->next != NULL) + token->next->previous = NULL; + free(token); +} |
