aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-08-08 12:47:45 +0100
committergingerBill <bill@gingerbill.org>2021-08-08 12:47:45 +0100
commita3b71268758ac93e2d46f8b3d161d5315c4c8295 (patch)
tree73ae8151939d861f04d55a4e0a09d8f8481414f1 /src/tokenizer.cpp
parent5756c8a7c6dda291ce5cdccaca26174359c3e9c2 (diff)
Simplify `init_tokenizer_with_data`
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 8e42c649f..17529382c 100644
--- a/src/tokenizer.cpp
+++ b/src/tokenizer.cpp
@@ -789,14 +789,14 @@ void advance_to_next_rune(Tokenizer *t) {
}
}
-void init_tokenizer_with_file_contents(Tokenizer *t, String const &fullpath, gbFileContents *fc, TokenizerFlags flags) {
+void init_tokenizer_with_data(Tokenizer *t, String const &fullpath, void *data, isize size, TokenizerFlags flags) {
t->flags = flags;
t->fullpath = fullpath;
t->line_count = 1;
- t->start = cast(u8 *)fc->data;
+ t->start = cast(u8 *)data;
t->read_curr = t->curr = t->start;
- t->end = t->start + fc->size;
+ t->end = t->start + size;
advance_to_next_rune(t);
if (t->curr_rune == GB_RUNE_BOM) {
@@ -820,7 +820,7 @@ TokenizerInitError init_tokenizer(Tokenizer *t, String const &fullpath, Tokenize
err = TokenizerInit_FileTooLarge;
gb_file_free_contents(&fc);
} else if (fc.data != nullptr) {
- init_tokenizer_with_file_contents(t, fullpath, &fc, flags);
+ init_tokenizer_with_data(t, fullpath, fc.data, fc.size, flags);
} else {
t->flags = flags;
t->fullpath = fullpath;