diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-10-08 20:37:31 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-10-08 20:37:31 +0100 |
| commit | b705fa7f2257e691f4056a96325d9f01bd031439 (patch) | |
| tree | 9df673b774e569b7037ae8710efeb24beff4f6dc /src/tokenizer.cpp | |
| parent | a5c6340316245f4f63e74d307f9d7c8be09360c6 (diff) | |
Change from gbArray(T) to Array<T>
Diffstat (limited to 'src/tokenizer.cpp')
| -rw-r--r-- | src/tokenizer.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 224d9bc51..c7c423512 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -292,7 +292,7 @@ struct Tokenizer { isize line_count; isize error_count; - gbArray(String) allocated_strings; + Array<String> allocated_strings; }; @@ -368,7 +368,7 @@ TokenizerInitError init_tokenizer(Tokenizer *t, String fullpath) { if (t->curr_rune == GB_RUNE_BOM) advance_to_next_rune(t); // Ignore BOM at file beginning - gb_array_init(t->allocated_strings, gb_heap_allocator()); + array_init(&t->allocated_strings, gb_heap_allocator()); return TokenizerInit_None; } @@ -397,12 +397,10 @@ gb_inline void destroy_tokenizer(Tokenizer *t) { if (t->start != NULL) { gb_free(gb_heap_allocator(), t->start); } - if (t->allocated_strings != NULL) { - gb_for_array(i, t->allocated_strings) { - gb_free(gb_heap_allocator(), t->allocated_strings[i].text); - } - gb_array_free(t->allocated_strings); + for_array(i, t->allocated_strings) { + gb_free(gb_heap_allocator(), t->allocated_strings[i].text); } + array_free(&t->allocated_strings); } void tokenizer_skip_whitespace(Tokenizer *t) { @@ -696,7 +694,7 @@ Token tokenizer_get_token(Tokenizer *t) { i32 success = unquote_string(gb_heap_allocator(), &token.string); if (success > 0) { if (success == 2) { - gb_array_append(t->allocated_strings, token.string); + array_add(&t->allocated_strings, token.string); } return token; } else { |