aboutsummaryrefslogtreecommitdiffstats
path: root/src/bootstrap/main.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-10-19 17:21:28 +0200
committerBad Diode <bd@badd10de.dev>2021-10-19 17:21:28 +0200
commitf7b5da260fc7b6b73b5ed6c87d3593de372db6ad (patch)
treec13531ae52cbe0fb6fb5ed5f45d6f718dfcc9619 /src/bootstrap/main.c
parentc0202d26b94434253fb99450734152b7cb1ae388 (diff)
downloadbdl-f7b5da260fc7b6b73b5ed6c87d3593de372db6ad.tar.gz
bdl-f7b5da260fc7b6b73b5ed6c87d3593de372db6ad.zip
Add generic dynamic array and change tokens to use it
Diffstat (limited to 'src/bootstrap/main.c')
-rwxr-xr-xsrc/bootstrap/main.c12
1 files changed, 7 insertions, 5 deletions
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 @@
6#include <stdlib.h> 6#include <stdlib.h>
7#include <string.h> 7#include <string.h>
8 8
9#include "darray.h"
10
9#include "singletons.c" 11#include "singletons.c"
10 12
11#include "environment.c" 13#include "environment.c"
@@ -92,10 +94,10 @@ init(void) {
92 94
93void 95void
94process_source(const StringView *source) { 96process_source(const StringView *source) {
95 Tokens tokens = tokenize(source); 97 Token *tokens = tokenize(source);
96 if (errors_n != 0) { 98 if (errors_n != 0) {
97 if (tokens.buf != NULL) { 99 if (tokens != NULL) {
98 free(tokens.buf); 100 array_free(tokens);
99 } 101 }
100 return; 102 return;
101 } 103 }
@@ -122,8 +124,8 @@ process_source(const StringView *source) {
122 pop_root(); 124 pop_root();
123 } 125 }
124 126
125 if (tokens.buf != NULL) { 127 if (tokens != NULL) {
126 free(tokens.buf); 128 array_free(tokens);
127 } 129 }
128} 130}
129 131