From f7b5da260fc7b6b73b5ed6c87d3593de372db6ad Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Tue, 19 Oct 2021 17:21:28 +0200 Subject: Add generic dynamic array and change tokens to use it --- src/bootstrap/main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/bootstrap/main.c') diff --git a/src/bootstrap/main.c b/src/bootstrap/main.c index cfad9f1..22332af 100755 --- a/src/bootstrap/main.c +++ b/src/bootstrap/main.c @@ -6,6 +6,8 @@ #include #include +#include "darray.h" + #include "singletons.c" #include "environment.c" @@ -92,10 +94,10 @@ init(void) { void process_source(const StringView *source) { - Tokens tokens = tokenize(source); + Token *tokens = tokenize(source); if (errors_n != 0) { - if (tokens.buf != NULL) { - free(tokens.buf); + if (tokens != NULL) { + array_free(tokens); } return; } @@ -122,8 +124,8 @@ process_source(const StringView *source) { pop_root(); } - if (tokens.buf != NULL) { - free(tokens.buf); + if (tokens != NULL) { + array_free(tokens); } } -- cgit v1.2.1