From a3b71268758ac93e2d46f8b3d161d5315c4c8295 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 8 Aug 2021 12:47:45 +0100 Subject: Simplify `init_tokenizer_with_data` --- src/tokenizer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/tokenizer.cpp') 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; -- cgit v1.2.3