aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-11-24 16:20:01 +0000
committergingerBill <bill@gingerbill.org>2021-11-24 16:20:01 +0000
commit5e2280a78704fff62d4445015af3558babe74870 (patch)
treead23a035d896ff6f2872efdbdeb00642b1ca4295 /src/tokenizer.cpp
parent275241f9b4b70b900296ee620516c1f1db5af70e (diff)
Fix `set_file_path_string` and `thread_safe_set_ast_file_from_id`
Diffstat (limited to 'src/tokenizer.cpp')
-rw-r--r--src/tokenizer.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp
index b7ade9d89..624aea2aa 100644
--- a/src/tokenizer.cpp
+++ b/src/tokenizer.cpp
@@ -295,8 +295,8 @@ void init_global_error_collector(void) {
mutex_init(&global_error_collector.string_mutex);
array_init(&global_error_collector.errors, heap_allocator());
array_init(&global_error_collector.error_buffer, heap_allocator());
- array_init(&global_file_path_strings, heap_allocator(), 4096);
- array_init(&global_files, heap_allocator(), 4096);
+ array_init(&global_file_path_strings, heap_allocator(), 1, 4096);
+ array_init(&global_files, heap_allocator(), 1, 4096);
}
@@ -306,7 +306,7 @@ bool set_file_path_string(i32 index, String const &path) {
mutex_lock(&global_error_collector.string_mutex);
if (index >= global_file_path_strings.count) {
- array_resize(&global_file_path_strings, index);
+ array_resize(&global_file_path_strings, index+1);
}
String prev = global_file_path_strings[index];
if (prev.len == 0) {
@@ -324,7 +324,7 @@ bool thread_safe_set_ast_file_from_id(i32 index, AstFile *file) {
mutex_lock(&global_error_collector.string_mutex);
if (index >= global_files.count) {
- array_resize(&global_files, index);
+ array_resize(&global_files, index+1);
}
AstFile *prev = global_files[index];
if (prev == nullptr) {