From e2633d5b661fb281d9218536d16bca542b8bd346 Mon Sep 17 00:00:00 2001 From: Sylvie <35663410+Rangi42@users.noreply.github.com> Date: Fri, 17 May 2024 05:02:36 -0400 Subject: [PATCH] Use the standard stream buffer size for the lexer buffer (#1396) --- include/asm/lexer.hpp | 3 ++- src/asm/lexer.cpp | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/asm/lexer.hpp b/include/asm/lexer.hpp index f0f4b8c5..2dbc6e38 100644 --- a/include/asm/lexer.hpp +++ b/include/asm/lexer.hpp @@ -7,13 +7,14 @@ #include #include #include +#include // BUFSIZ #include #include #include #include "platform.hpp" // SSIZE_MAX -#define LEXER_BUF_SIZE 128 +#define LEXER_BUF_SIZE BUFSIZ // The buffer needs to be large enough for the maximum `lexerState->peek()` lookahead distance static_assert(LEXER_BUF_SIZE > 1, "Lexer buffer size is too small"); // This caps the size of buffer reads, and according to POSIX, passing more than SSIZE_MAX is UB diff --git a/src/asm/lexer.cpp b/src/asm/lexer.cpp index 3ca0728c..947e76e0 100644 --- a/src/asm/lexer.cpp +++ b/src/asm/lexer.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include