From 48108adf14a33e313ed5a5da4c843289a7fdb4f1 Mon Sep 17 00:00:00 2001 From: "Andrew V. Louis" <13123840+avlouis@users.noreply.github.com> Date: Tue, 7 Apr 2026 23:06:51 -0500 Subject: [PATCH 1/3] Move some macro definitions to header so they are shared and allow for overriding via compiler directives. --- linenoise.c | 2 -- linenoise.h | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/linenoise.c b/linenoise.c index db9b06cb..6b66de81 100644 --- a/linenoise.c +++ b/linenoise.c @@ -118,8 +118,6 @@ #include #include "linenoise.h" -#define LINENOISE_DEFAULT_HISTORY_MAX_LEN 100 -#define LINENOISE_MAX_LINE 4096 static char *unsupported_term[] = {"dumb","cons25","emacs",NULL}; static linenoiseCompletionCallback *completionCallback = NULL; static linenoiseHintsCallback *hintsCallback = NULL; diff --git a/linenoise.h b/linenoise.h index e56b6271..b084f32e 100644 --- a/linenoise.h +++ b/linenoise.h @@ -39,6 +39,14 @@ #ifndef __LINENOISE_H #define __LINENOISE_H +#ifndef LINENOISE_DEFAULT_HISTORY_MAX_LEN +#define LINENOISE_DEFAULT_HISTORY_MAX_LEN 100 +#endif + +#ifndef LINENOISE_MAX_LINE +#define LINENOISE_MAX_LINE 4096 +#endif + #ifdef __cplusplus extern "C" { #endif From a4254930ebef774c09e83b3ce1859d5d9f1561b5 Mon Sep 17 00:00:00 2001 From: "Andrew V. Louis" <13123840+avlouis@users.noreply.github.com> Date: Tue, 7 Apr 2026 23:10:02 -0500 Subject: [PATCH 2/3] Adjusting include guard macros to comply with standards. See Section 7.1.3 of https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf or other editions of the C standard. --- linenoise.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linenoise.h b/linenoise.h index b084f32e..40e15598 100644 --- a/linenoise.h +++ b/linenoise.h @@ -36,8 +36,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __LINENOISE_H -#define __LINENOISE_H +#ifndef LINENOISE_H +#define LINENOISE_H #ifndef LINENOISE_DEFAULT_HISTORY_MAX_LEN #define LINENOISE_DEFAULT_HISTORY_MAX_LEN 100 @@ -119,4 +119,4 @@ void linenoiseMaskModeDisable(void); } #endif -#endif /* __LINENOISE_H */ +#endif /* LINENOISE_H */ From 9b1e0d8c0857f867e2ea1160e0f5d543363834e7 Mon Sep 17 00:00:00 2001 From: "Andrew V. Louis" <13123840+avlouis@users.noreply.github.com> Date: Fri, 10 Apr 2026 12:33:41 -0500 Subject: [PATCH 3/3] Fixing a sign issue that prevents compilation when running -Werror=format-signedness. --- linenoise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linenoise.c b/linenoise.c index 6b66de81..a73f4e1f 100644 --- a/linenoise.c +++ b/linenoise.c @@ -1549,7 +1549,7 @@ void linenoisePrintKeyCodes(void) { if (memcmp(quit,"quit",sizeof(quit)) == 0) break; printf("'%c' %02x (%d) (type quit to exit)\n", - isprint(c) ? c : '?', (int)c, (int)c); + isprint(c) ? c : '?', (unsigned int)c, (int)c); printf("\r"); /* Go left edge manually, we are in raw mode. */ fflush(stdout); }