gdtoa-strtod.c.patch [plain text]
--- gdtoa-strtod.c.orig 2005-01-20 20:12:37.000000000 -0800
+++ gdtoa-strtod.c 2005-02-17 01:31:26.000000000 -0800
@@ -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"
#ifdef USE_LOCALE
@@ -56,11 +58,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
@@ -112,7 +114,7 @@
switch(s[1]) {
case 'x':
case 'X':
- switch((i = gethex(&s, &fpi, &exp, &bb, sign)) & STRTOG_Retmask) {
+ switch((i = gethex(&s, &fpi, &exp, &bb, sign, loc)) & STRTOG_Retmask) {
case STRTOG_NoNumber:
s = s00;
sign = 0;
@@ -142,8 +144,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
@@ -966,3 +969,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());
+}