We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eafcbc5 commit 439ded5Copy full SHA for 439ded5
src/token.c
@@ -1,4 +1,5 @@
1
#include "include/token.h"
2
+#include "include/util/hb_arena.h"
3
#include "include/lexer.h"
4
#include "include/position.h"
5
#include "include/range.h"
@@ -14,7 +15,7 @@ size_t token_sizeof(void) {
14
15
}
16
17
token_T* token_init(const char* value, const token_type_T type, lexer_T* lexer) {
- token_T* token = calloc(1, token_sizeof());
18
+ token_T* token = hb_arena_alloc(lexer->allocator, token_sizeof());
19
20
if (type == TOKEN_NEWLINE) {
21
lexer->current_line++;
@@ -155,6 +156,4 @@ void token_free(token_T* token) {
155
156
if (!token) { return; }
157
158
if (token->value != NULL) { free(token->value); }
-
159
- free(token);
160
0 commit comments