From 6d127edfa0162219c54b10e3496a3e9530f62792 Mon Sep 17 00:00:00 2001 From: A404M Date: Mon, 10 Feb 2025 13:03:25 +0330 Subject: fix double free of code some clean up --- src/compiler/lexer.c | 5 +++++ src/compiler/lexer.h | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/lexer.c b/src/compiler/lexer.c index 70cd1fb..e69afef 100644 --- a/src/compiler/lexer.c +++ b/src/compiler/lexer.c @@ -4,6 +4,7 @@ #include "utils/memory.h" #include "utils/string.h" +#include #include #include #include @@ -75,6 +76,10 @@ const LexerToken LEXER_KEYWORD_TOKENS[] = { const size_t LEXER_KEYWORD_SIZE = sizeof(LEXER_KEYWORD_TOKENS) / sizeof(*LEXER_KEYWORD_TOKENS); +const LexerNodeArray LEXER_NODE_ARRAY_ERROR = { + .size = SIZE_MAX, +}; + bool lexerNodeArrayIsError(LexerNodeArray array) { return LEXER_NODE_ARRAY_ERROR.size == array.size; } diff --git a/src/compiler/lexer.h b/src/compiler/lexer.h index 6723cc9..656084e 100644 --- a/src/compiler/lexer.h +++ b/src/compiler/lexer.h @@ -59,9 +59,7 @@ typedef struct LexerNodeArray { size_t size; } LexerNodeArray; -constexpr LexerNodeArray LEXER_NODE_ARRAY_ERROR = { - .size = -1ULL, -}; +extern const LexerNodeArray LEXER_NODE_ARRAY_ERROR; extern bool lexerNodeArrayIsError(LexerNodeArray array); extern void lexerNodeArrayPrint(LexerNodeArray array); -- cgit v1.2.3