diff options
author | Peter Kokot <peterkokot@gmail.com> | 2019-02-24 10:21:25 +0100 |
---|---|---|
committer | Peter Kokot <peterkokot@gmail.com> | 2019-04-07 18:32:54 +0200 |
commit | e06836a1a345d0f6975036dc6c0cf7596aa07031 (patch) | |
tree | 3e46afae0d1303c0e568875bd661c6d6480f43a3 /sapi/phpdbg/phpdbg_out.c | |
parent | 5f8915786f9fc3ec1af1089c9848f65a8d1541f5 (diff) | |
download | php-git-e06836a1a345d0f6975036dc6c0cf7596aa07031.tar.gz |
Remove checks for locale.h, setlocale, localeconv
The `<loccale.h>` header file, setlocale, and localeconv are part of the
standard C89 [1] and on current systems can be used unconditionally.
Since PHP 7.4 requires at least C89 or greater, the `HAVE_LOCALE_H`,
`HAVE_SETLOCALE`, and `HAVE_LOCALECONV` symbols defined by Autoconf in
configure.ac [2] can be ommitted and simplifed.
The bundled libmagic (file) has also been patched already in version
5.35 and up in upstream location so when it will be patched also in
php-src the check for locale.h header is still left in the configure.ac
and in windows headers definition file.
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.4
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
Omit the bundled libmagic files
Diffstat (limited to 'sapi/phpdbg/phpdbg_out.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_out.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/sapi/phpdbg/phpdbg_out.c b/sapi/phpdbg/phpdbg_out.c index 95316e77c7..95f27b3c6f 100644 --- a/sapi/phpdbg/phpdbg_out.c +++ b/sapi/phpdbg/phpdbg_out.c @@ -114,13 +114,8 @@ typedef struct buf_area buffy; */ #define PREFIX( str, length, ch ) *--str = ch ; length++ ; has_prefix = YES - -#ifdef HAVE_LOCALE_H #include <locale.h> #define LCONV_DECIMAL_POINT (*lconv->decimal_point) -#else -#define LCONV_DECIMAL_POINT '.' -#endif #define NUL '\0' #define S_NULL "(null)" #define S_NULL_LEN 6 @@ -155,9 +150,7 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool esca char num_buf[NUM_BUF_SIZE]; char char_buf[2]; /* for printing %% and %<unknown> */ -#ifdef HAVE_LOCALE_H struct lconv *lconv = NULL; -#endif /* * Flag variables @@ -621,11 +614,10 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool esca s = "INF"; s_len = 3; } else { -#ifdef HAVE_LOCALE_H if (!lconv) { lconv = localeconv(); } -#endif + s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form, (adjust_precision == NO) ? FLOAT_DIGITS : precision, (*fmt == 'f')?LCONV_DECIMAL_POINT:'.', @@ -678,11 +670,10 @@ static int format_converter(register buffy *odp, const char *fmt, zend_bool esca /* * * We use &num_buf[ 1 ], so that we have room for the sign */ -#ifdef HAVE_LOCALE_H if (!lconv) { lconv = localeconv(); } -#endif + s = php_gcvt(fp_num, precision, (*fmt=='H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]); if (*s == '-') { prefix_char = *s++; |