aboutsummaryrefslogtreecommitdiff
path: root/src/free_token.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/free_token.c')
-rw-r--r--src/free_token.c24
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);
+}