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 /main/snprintf.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 'main/snprintf.c')
| -rw-r--r-- | main/snprintf.c | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/main/snprintf.c b/main/snprintf.c index 15ed08175e..e3e0993ab5 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -34,7 +34,6 @@ #include <inttypes.h> #endif -#ifdef HAVE_LOCALE_H #include <locale.h> #ifdef ZTS #include "ext/standard/php_string.h" @@ -42,9 +41,6 @@ #else #define LCONV_DECIMAL_POINT (*lconv->decimal_point) #endif -#else -#define LCONV_DECIMAL_POINT '.' -#endif /* * Copyright (c) 2002, 2006 Todd C. Miller <Todd.Miller@courtesan.com> @@ -612,13 +608,11 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / char num_buf[NUM_BUF_SIZE]; char char_buf[2]; /* for printing %% and %<unknown> */ -#ifdef HAVE_LOCALE_H #ifdef ZTS struct lconv lconv; #else struct lconv *lconv = NULL; #endif -#endif /* * Flag variables @@ -1025,7 +1019,6 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / s = "INF"; s_len = 3; } else { -#ifdef HAVE_LOCALE_H #ifdef ZTS localeconv_r(&lconv); #else @@ -1033,7 +1026,6 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / lconv = localeconv(); } #endif -#endif s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form, (adjust_precision == NO) ? FLOAT_DIGITS : precision, (*fmt == 'f')?LCONV_DECIMAL_POINT:'.', @@ -1086,7 +1078,6 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / /* * * We use &num_buf[ 1 ], so that we have room for the sign */ -#ifdef HAVE_LOCALE_H #ifdef ZTS localeconv_r(&lconv); #else @@ -1094,7 +1085,6 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / lconv = localeconv(); } #endif -#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++; |
