Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gdtoa Pass locale down to gethex as well.
details: https://anonhg.NetBSD.org/src/rev/9f7c8d5222cc
branches: trunk
changeset: 786187:9f7c8d5222cc
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Apr 19 10:41:53 2013 +0000
description:
Pass locale down to gethex as well.
diffstat:
lib/libc/gdtoa/gdtoaimp.h | 4 ++--
lib/libc/gdtoa/gethex.c | 24 +++---------------------
lib/libc/gdtoa/strtod.c | 4 ++--
lib/libc/gdtoa/strtodg.c | 4 ++--
4 files changed, 9 insertions(+), 27 deletions(-)
diffs (99 lines):
diff -r 5d3f38e91ccc -r 9f7c8d5222cc lib/libc/gdtoa/gdtoaimp.h
--- a/lib/libc/gdtoa/gdtoaimp.h Fri Apr 19 05:36:16 2013 +0000
+++ b/lib/libc/gdtoa/gdtoaimp.h Fri Apr 19 10:41:53 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gdtoaimp.h,v 1.13 2012/03/13 21:13:34 christos Exp $ */
+/* $NetBSD: gdtoaimp.h,v 1.14 2013/04/19 10:41:53 joerg Exp $ */
/****************************************************************
@@ -601,7 +601,7 @@
extern char *dtoa ANSI((double d, int mode, int ndigits,
int *decpt, int *sign, char **rve));
extern char *g__fmt ANSI((char*, char*, char*, int, ULong, size_t));
- extern int gethex ANSI((CONST char**, CONST FPI*, Long*, Bigint**, int));
+ extern int gethex ANSI((CONST char**, CONST FPI*, Long*, Bigint**, int, locale_t));
extern void hexdig_init_D2A(Void);
extern int hexnan ANSI((CONST char**, CONST FPI*, ULong*));
extern int hi0bits_D2A ANSI((ULong));
diff -r 5d3f38e91ccc -r 9f7c8d5222cc lib/libc/gdtoa/gethex.c
--- a/lib/libc/gdtoa/gethex.c Fri Apr 19 05:36:16 2013 +0000
+++ b/lib/libc/gdtoa/gethex.c Fri Apr 19 10:41:53 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gethex.c,v 1.5 2011/03/20 23:15:35 christos Exp $ */
+/* $NetBSD: gethex.c,v 1.6 2013/04/19 10:41:53 joerg Exp $ */
/****************************************************************
@@ -38,12 +38,7 @@
#endif
int
-#ifdef KR_headers
-gethex(sp, fpi, expt, bp, sign)
- CONST char **sp; CONST FPI *fpi; Long *expt; Bigint **bp; int sign;
-#else
-gethex( CONST char **sp, CONST FPI *fpi, Long *expt, Bigint **bp, int sign)
-#endif
+gethex( CONST char **sp, CONST FPI *fpi, Long *expt, Bigint **bp, int sign, locale_t loc)
{
Bigint *b;
CONST char *decpt, *s, *s0, *s1;
@@ -52,20 +47,7 @@
Long e, e1;
#ifdef USE_LOCALE
int i;
-#ifdef NO_LOCALE_CACHE
- const char *decimalpoint = localeconv()->decimal_point;
-#else
- const unsigned char *decimalpoint;
- static char *decimalpoint_cache;
- if (!(s0 = decimalpoint_cache)) {
- s0 = localeconv()->decimal_point;
- if ((decimalpoint_cache = MALLOC(strlen(s0) + 1)) != NULL) {
- strcpy(decimalpoint_cache, s0);
- s0 = decimalpoint_cache;
- }
- }
- decimalpoint = __UNCONST(s0);
-#endif
+ const char *decimalpoint = localeconv_l(loc)->decimal_point;
#endif
if (!hexdig[(unsigned char)'0'])
diff -r 5d3f38e91ccc -r 9f7c8d5222cc lib/libc/gdtoa/strtod.c
--- a/lib/libc/gdtoa/strtod.c Fri Apr 19 05:36:16 2013 +0000
+++ b/lib/libc/gdtoa/strtod.c Fri Apr 19 10:41:53 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: strtod.c,v 1.12 2013/04/18 21:54:10 joerg Exp $ */
+/* $NetBSD: strtod.c,v 1.13 2013/04/19 10:41:53 joerg Exp $ */
/****************************************************************
@@ -175,7 +175,7 @@
#else
#define fpi1 fpi
#endif
- switch((i = gethex(&s, &fpi1, &expt, &bb, sign)) & STRTOG_Retmask) {
+ switch((i = gethex(&s, &fpi1, &expt, &bb, sign, loc)) & STRTOG_Retmask) {
case STRTOG_NoNumber:
s = s00;
sign = 0;
diff -r 5d3f38e91ccc -r 9f7c8d5222cc lib/libc/gdtoa/strtodg.c
--- a/lib/libc/gdtoa/strtodg.c Fri Apr 19 05:36:16 2013 +0000
+++ b/lib/libc/gdtoa/strtodg.c Fri Apr 19 10:41:53 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: strtodg.c,v 1.11 2013/04/18 21:54:10 joerg Exp $ */
+/* $NetBSD: strtodg.c,v 1.12 2013/04/19 10:41:53 joerg Exp $ */
/****************************************************************
@@ -377,7 +377,7 @@
switch(s[1]) {
case 'x':
case 'X':
- irv = gethex(&s, fpi, expt, &rvb, sign);
+ irv = gethex(&s, fpi, expt, &rvb, sign, loc);
if (irv == STRTOG_NoNumber) {
s = s00;
sign = 0;
Home |
Main Index |
Thread Index |
Old Index