From d38eea93365879b5bff8b649d8dbb4dc1b849e56 Mon Sep 17 00:00:00 2001 From: Nick Vatamaniuc Date: Tue, 24 Mar 2026 00:46:16 -0400 Subject: [PATCH] Avoid initializer-string warning for the digits array Some newer compilers emit this warning: ``` warning: initializer-string for character array is too long, array size is 36 but initializer has size 37 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Wunterminated-string-initialization] 12146 | static char const digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz"; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` To avoid the warning initialize the array as individual characters --- quickjs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/quickjs.c b/quickjs.c index 2b33bfa..7b5d654 100644 --- a/quickjs.c +++ b/quickjs.c @@ -12143,7 +12143,11 @@ static JSBigInt *js_bigint_from_string(JSContext *ctx, } /* 2 <= base <= 36 */ -static char const digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz"; +static char const digits[36] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', + 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' +}; /* special version going backwards */ /* XXX: use dtoa.c */