summaryrefslogtreecommitdiff
path: root/main/snprintf.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-12-06 21:37:15 +0100
committerAnatol Belski <ab@php.net>2014-12-06 21:37:15 +0100
commitba35b22bc4a7af791ff2ab7c2ca8e9f4aa6d64df (patch)
tree92d7a7d9dd424b53e50a194af06ec3cfb514633e /main/snprintf.c
parent88bb9fedc4b5fc750524a7b00be1d46fde2f5929 (diff)
parentaa52fcf179d9e233075e4d213d5708cc5b5e1ae2 (diff)
downloadphp-git-ba35b22bc4a7af791ff2ab7c2ca8e9f4aa6d64df.tar.gz
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (35 commits) Fixed bug #68398 msooxml matches too many archives Fix zpp call in apache_getenv() Drop unnecessary zval containers fixed test C89 compat add include for missing localeconv_r proto updated NEWS Fixed bug #65230 setting locale randomly broken Fix compilation error (ref #68424) Removed useless handlers Move checks for references into slow paths of operator functions. Remove duplicate opcode handlers. Revert unintentional docblock change Restored zip/oci8 PHP 4 code, add PHP 7 checks Note macro removal in UPGRADING.INTERNALS Removed ZEND_ENGINE_2 checks (and ZE1 code, it's been a decade!) Zend Engine 3 Updated NEWS Updated NEWS Updated NEWS Start adding new attribute to control multi statements ...
Diffstat (limited to 'main/snprintf.c')
-rw-r--r--main/snprintf.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/main/snprintf.c b/main/snprintf.c
index 0b9182b614..7e4d8a11ab 100644
--- a/main/snprintf.c
+++ b/main/snprintf.c
@@ -38,7 +38,12 @@
#ifdef HAVE_LOCALE_H
#include <locale.h>
+#ifdef ZTS
+#include "ext/standard/php_string.h"
+#define LCONV_DECIMAL_POINT (*lconv.decimal_point)
+#else
#define LCONV_DECIMAL_POINT (*lconv->decimal_point)
+#endif
#else
#define LCONV_DECIMAL_POINT '.'
#endif
@@ -607,8 +612,12 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
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
@@ -1017,10 +1026,14 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
s_len = 3;
} else {
#ifdef HAVE_LOCALE_H
+#ifdef ZTS
+ localeconv_r(&lconv);
+#else
if (!lconv) {
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:'.',
@@ -1074,10 +1087,14 @@ 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
if (!lconv) {
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++;