diff options
author | Kevin Ryde <user42@zip.com.au> | 2002-11-19 22:56:54 +0100 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2002-11-19 22:56:54 +0100 |
commit | 0e83baa85df7a45ccea7f98b7366e5f2c3011c62 (patch) | |
tree | 797dd9ec64d07902c17e2ae9aad7cb05e67edf89 /mpf/out_str.c | |
parent | 0b4ac2428ad31ded1c0e85f32b9ea75cb06eb8b7 (diff) | |
download | gmp-0e83baa85df7a45ccea7f98b7366e5f2c3011c62.tar.gz |
* gmp-impl.h (GMP_DECIMAL_POINT): New macro.
* mpf/out_str.c, mpf/set_str.c, scanf/doscan.c: Use it, and don't
bother with special code for non-locale systems.
Diffstat (limited to 'mpf/out_str.c')
-rw-r--r-- | mpf/out_str.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/mpf/out_str.c b/mpf/out_str.c index e49982913..7d2add810 100644 --- a/mpf/out_str.c +++ b/mpf/out_str.c @@ -21,11 +21,17 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define _GNU_SOURCE /* for DECIMAL_POINT in langinfo.h */ + #include "config.h" #include <stdio.h> #include <string.h> +#if HAVE_LANGINFO_H +#include <langinfo.h> /* for nl_langinfo */ +#endif + #if HAVE_LOCALE_H #include <locale.h> /* for localeconv */ #endif @@ -33,6 +39,7 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "gmp-impl.h" + size_t mpf_out_str (FILE *stream, int base, size_t n_digits, mpf_srcptr op) { @@ -67,18 +74,13 @@ mpf_out_str (FILE *stream, int base, size_t n_digits, mpf_srcptr op) n_digits--; } -#if HAVE_LOCALECONV { - const char *point = localeconv()->decimal_point; + const char *point = GMP_DECIMAL_POINT; size_t pointlen = strlen (point); putc ('0', stream); fwrite (point, 1, pointlen, stream); written += pointlen + 1; } -#else - fwrite ("0.", 1, 2, stream); - written += 2; -#endif /* Write mantissa */ { |