diff options
| author | Dmitry Stogov <dmitry@php.net> | 2006-12-19 13:13:29 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2006-12-19 13:13:29 +0000 |
| commit | 5d8183f0b22e72ce8fc3cb632ecfd253a634c6c3 (patch) | |
| tree | 8d76d7d19d8508eafcfc0b6a9b58730fc20cb974 /main/spprintf.c | |
| parent | d6db0ccc12f603d67c9d954087bae7fef46d261d (diff) | |
| download | php-git-5d8183f0b22e72ce8fc3cb632ecfd253a634c6c3.tar.gz | |
Support for systems without locale.h
Diffstat (limited to 'main/spprintf.c')
| -rw-r--r-- | main/spprintf.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/main/spprintf.c b/main/spprintf.c index a0d499fdf2..60c2f1b886 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -92,6 +92,9 @@ #ifdef HAVE_LOCALE_H #include <locale.h> +#define LCONV_DECIMAL_POINT (*lconv->decimal_point) +#else +#define LCONV_DECIMAL_POINT '.' #endif #include "snprintf.h" @@ -199,7 +202,9 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap) 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 @@ -554,9 +559,11 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap) 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):'.', @@ -606,9 +613,11 @@ static void xbuf_format_converter(smart_str *xbuf, const char *fmt, va_list ap) /* * * 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, *lconv->decimal_point, (*fmt == 'G')?'E':'e', &num_buf[1]); if (*s == '-') prefix_char = *s++; |
