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.
This commit is contained in:
pancake 2024-11-24 12:46:29 +01:00 committed by GitHub
parent 4ca6d9bba0
commit df44d66291
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11351,6 +11351,7 @@ static int js_ecvt(double d, int n_digits,
} }
} else { } else {
#if defined(FE_DOWNWARD) && defined(FE_TONEAREST) #if defined(FE_DOWNWARD) && defined(FE_TONEAREST)
int i;
/* generate 2 extra digits: 99% chances to avoid 2 calls */ /* generate 2 extra digits: 99% chances to avoid 2 calls */
js_ecvt1(d, n_digits + 2, dest, size, decpt); js_ecvt1(d, n_digits + 2, dest, size, decpt);
if (dest[n_digits + 1] < '5') 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 */ return n_digits; /* truncate the 2 extra digits */
} }
/* round up in the string */ /* round up in the string */
for(int i = n_digits;; i--) { for(i = n_digits;; i--) {
/* ignore the locale specific decimal point */ /* ignore the locale specific decimal point */
if (is_digit(dest[i])) { if (is_digit(dest[i])) {
if (dest[i]++ < '9') if (dest[i]++ < '9')