From ca20ff4f4d0ac63856e538f9f4cef97197bf6465 Mon Sep 17 00:00:00 2001 From: c Date: Sun, 28 Jan 2024 21:43:37 -0500 Subject: Fixed buffer-overflow. --- src/include/lexer.h | 2 +- src/include/util.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/lexer.h b/src/include/lexer.h index 5235f3b..79a3cb6 100644 --- a/src/include/lexer.h +++ b/src/include/lexer.h @@ -53,7 +53,7 @@ void lexer_add_current_char(lexer_t* lexer, int type); Add first character of given lexer's `src` to the value of the last token in `tokenl`, if it exists. Otherwise, create new token and add it. */ -void lexer_add_current_char_to_last_token(lexer_t* lexer, int type); +void lexer_add_current_char_to_last_token(lexer_t* lexer, token_type_t type); /* Handle regular state. */ void lexer_do_reg(lexer_t* lexer); diff --git a/src/include/util.h b/src/include/util.h index 839d3e4..9f8a2b0 100644 --- a/src/include/util.h +++ b/src/include/util.h @@ -6,6 +6,13 @@ #include #include +#define MIN(a, b) (a < b ? a : b) +#define MAX(a, b) (a > b ? a : b) + +/* + TODO: Make these macros, to allow for better logging (printing __FILE__, + __func__, etc.) +*/ /* Log some debug information. */ void log_dbg(const char*, ...); /* c: */ -- cgit v1.2.3