From 33319b80a797e520e61b437fcc3f4fc9c6fce1de Mon Sep 17 00:00:00 2001 From: Vitah Lin Date: Fri, 27 Feb 2026 09:31:10 +0800 Subject: [PATCH] Fix compilation warning: Use macro for seq_buffer_max_length (#14815) ## Description This PR fixes a compilation warning in `deps/linenoise/linenoise.c` by converting the local constant variable `seq_buffer_max_length` to an enum constant `SEQ_BUFFER_MAX_LENGTH`. ### Changes Made - Replaced the local `const int seq_buffer_max_length = 8;` declaration with a macro constant. --- deps/linenoise/linenoise.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deps/linenoise/linenoise.c b/deps/linenoise/linenoise.c index 29b5a48fa..b34b8cd25 100644 --- a/deps/linenoise/linenoise.c +++ b/deps/linenoise/linenoise.c @@ -120,6 +120,7 @@ #include #include "linenoise.h" +#define SEQ_BUFFER_MAX_LENGTH 8 #define LINENOISE_DEFAULT_HISTORY_MAX_LEN 100 #define LINENOISE_MAX_LINE 4096 static char *unsupported_term[] = {"dumb","cons25","emacs",NULL}; @@ -1060,15 +1061,14 @@ static int linenoiseEdit(int stdin_fd, int stdout_fd, char *buf, size_t buflen, if (seq[1] >= '0' && seq[1] <= '9') { /* Extended escape, read additional bytes. * Examples: ESC [1;5C ESC [3~ */ - const int seq_buffer_max_length = 8; - char seq_buffer[seq_buffer_max_length]; + char seq_buffer[SEQ_BUFFER_MAX_LENGTH]; int i = 0; seq_buffer[i++] = seq[1]; /* Read more bytes until we see a CSI final byte (range @..~). - * Use seq_buffer_max_length-1 to reserve one position for '\0'. */ + * Use SEQ_BUFFER_MAX_LENGTH-1 to reserve one position for '\0'. */ char seq_char; - while (i < seq_buffer_max_length-1 && read(l.ifd, &seq_char, 1) == 1) { + while (i < SEQ_BUFFER_MAX_LENGTH - 1 && read(l.ifd, &seq_char, 1) == 1) { seq_buffer[i++] = seq_char; if (seq_char >= '@' && seq_char <= '~') break; /* CSI final byte */ }