gdtoa-strtod.c.patch [plain text]
--- gdtoa-strtod.c.orig 2005-10-08 11:32:33.000000000 -0700
+++ gdtoa-strtod.c 2005-10-08 11:38:17.000000000 -0700
@@ -29,6 +29,8 @@
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
+#include "xlocale_private.h"
+
#include "gdtoaimp.h"
#ifndef NO_FENV_H
#include <fenv.h>
@@ -59,11 +61,11 @@
#endif
double
-strtod
+strtod_l
#ifdef KR_headers
- (s00, se) CONST char *s00; char **se;
+ (s00, se, loc) CONST char *s00; char **se; locale_t loc;
#else
- (CONST char *s00, char **se)
+ (CONST char *s00, char **se, locale_t loc)
#endif
{
#ifdef Avoid_Underflow
@@ -126,7 +128,7 @@
#else
#define fpi1 fpi
#endif
- switch((i = gethex(&s, &fpi1, &exp, &bb, sign)) & STRTOG_Retmask) {
+ switch((i = gethex(&s, &fpi1, &exp, &bb, sign, loc)) & STRTOG_Retmask) {
case STRTOG_NoNumber:
s = s00;
sign = 0;
@@ -156,8 +158,9 @@
else if (nd < 16)
z = 10*z + c - '0';
nd0 = nd;
+ NORMALIZE_LOCALE(loc);
#ifdef USE_LOCALE
- if (c == *localeconv()->decimal_point)
+ if (c == *localeconv_l(loc)->decimal_point)
#else
if (c == '.')
#endif
@@ -980,3 +983,13 @@
return sign ? -dval(rv) : dval(rv);
}
+ double
+strtod
+#ifdef KR_headers
+ (s00, se) CONST char *s00; char **se;
+#else
+ (CONST char *s00, char **se)
+#endif
+{
+ return strtod_l(s00, se, __current_locale());
+}