Module Name:    src
Committed By:   joerg
Date:           Fri Apr 19 10:41:54 UTC 2013

Modified Files:
        src/lib/libc/gdtoa: gdtoaimp.h gethex.c strtod.c strtodg.c

Log Message:
Pass locale down to gethex as well.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gdtoa/gdtoaimp.h
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gdtoa/gethex.c
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/gdtoa/strtod.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/gdtoa/strtodg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gdtoa/gdtoaimp.h
diff -u src/lib/libc/gdtoa/gdtoaimp.h:1.13 src/lib/libc/gdtoa/gdtoaimp.h:1.14
--- src/lib/libc/gdtoa/gdtoaimp.h:1.13	Tue Mar 13 21:13:34 2012
+++ src/lib/libc/gdtoa/gdtoaimp.h	Fri Apr 19 10:41:53 2013
@@ -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 void memcpy_D2A ANSI((void*, cons
  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));

Index: src/lib/libc/gdtoa/gethex.c
diff -u src/lib/libc/gdtoa/gethex.c:1.5 src/lib/libc/gdtoa/gethex.c:1.6
--- src/lib/libc/gdtoa/gethex.c:1.5	Sun Mar 20 23:15:35 2011
+++ src/lib/libc/gdtoa/gethex.c	Fri Apr 19 10:41:53 2013
@@ -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 @@ THIS SOFTWARE.
 #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 @@ gethex( CONST char **sp, CONST FPI *fpi,
 	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'])

Index: src/lib/libc/gdtoa/strtod.c
diff -u src/lib/libc/gdtoa/strtod.c:1.12 src/lib/libc/gdtoa/strtod.c:1.13
--- src/lib/libc/gdtoa/strtod.c:1.12	Thu Apr 18 21:54:10 2013
+++ src/lib/libc/gdtoa/strtod.c	Fri Apr 19 10:41:53 2013
@@ -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 @@ _int_strtod_l(CONST char *s00, char **se
 #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;

Index: src/lib/libc/gdtoa/strtodg.c
diff -u src/lib/libc/gdtoa/strtodg.c:1.11 src/lib/libc/gdtoa/strtodg.c:1.12
--- src/lib/libc/gdtoa/strtodg.c:1.11	Thu Apr 18 21:54:10 2013
+++ src/lib/libc/gdtoa/strtodg.c	Fri Apr 19 10:41:53 2013
@@ -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 @@ strtodg(CONST char *s00, char **se, CONS
 		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;

Reply via email to