From df44d662912c8999ae4cf6926500b33e03b53589 Mon Sep 17 00:00:00 2001 From: pancake Date: Sun, 24 Nov 2024 12:46:29 +0100 Subject: [PATCH] Do not depend on c99 for(int NB: The project requires C11, but sicne this is the only occurrence of such kind, we let it slide. See the PR conversation. --- quickjs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quickjs.c b/quickjs.c index 2e472593..f25f86fc 100644 --- a/quickjs.c +++ b/quickjs.c @@ -11351,6 +11351,7 @@ static int js_ecvt(double d, int n_digits, } } else { #if defined(FE_DOWNWARD) && defined(FE_TONEAREST) + int i; /* generate 2 extra digits: 99% chances to avoid 2 calls */ js_ecvt1(d, n_digits + 2, dest, size, decpt); if (dest[n_digits + 1] < '5') @@ -11364,7 +11365,7 @@ static int js_ecvt(double d, int n_digits, return n_digits; /* truncate the 2 extra digits */ } /* round up in the string */ - for(int i = n_digits;; i--) { + for(i = n_digits;; i--) { /* ignore the locale specific decimal point */ if (is_digit(dest[i])) { if (dest[i]++ < '9')