Remove FORMAT_CONV_MAX_PRECISION

This used to be necessary in the past because the NUM_BUF_SIZE
was set to 512, which is shorter than DOUBLE_MAX_LENGTH. Now the
value is either DOUBLE_MAX_LENGTH or larger (2048).
This commit is contained in:
Nikita Popov 2021-08-02 15:59:26 +02:00
parent d28f6e694d
commit e14fbc84ac
4 changed files with 574 additions and 593 deletions

File diff suppressed because it is too large Load diff

View file

@ -582,10 +582,6 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
precision = 0; precision = 0;
} else } else
precision = 0; precision = 0;
if (precision > FORMAT_CONV_MAX_PRECISION) {
precision = FORMAT_CONV_MAX_PRECISION;
}
} else } else
adjust_precision = false; adjust_precision = false;
} else } else

View file

@ -133,15 +133,4 @@ PHPAPI char * ap_php_conv_10(int64_t num, bool is_unsigned,
PHPAPI char * ap_php_conv_p2(uint64_t num, int nbits, PHPAPI char * ap_php_conv_p2(uint64_t num, int nbits,
char format, char *buf_end, size_t *len); char format, char *buf_end, size_t *len);
/* The maximum precision that's allowed for float conversion. Does not include
* decimal separator, exponent, sign, terminator. Currently does not affect
* the modes e/f, only g/k/H, as those have a different limit enforced at
* another level (see NDIG in php_conv_fp()).
* Applies to the formatting functions of both spprintf.c and snprintf.c, which
* use equally sized buffers of MAX_BUF_SIZE = 512 to hold the result of the
* call to zend_gcvt().
* This should be reasonably smaller than MAX_BUF_SIZE (I think MAX_BUF_SIZE - 9
* should be enough, but let's give some more space) */
#define FORMAT_CONV_MAX_PRECISION 500
#endif /* SNPRINTF_H */ #endif /* SNPRINTF_H */

View file

@ -289,10 +289,6 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
precision = -1; precision = -1;
} else } else
precision = 0; precision = 0;
if (precision > FORMAT_CONV_MAX_PRECISION) {
precision = FORMAT_CONV_MAX_PRECISION;
}
} else } else
adjust_precision = false; adjust_precision = false;
} else } else