1 --- gdtoa-gethex.c.orig 2005-01-20 20:12:36.000000000 -0800
2 +++ gdtoa-gethex.c 2005-03-23 15:45:22.000000000 -0800
4 /* Please send bug reports to David M. Gay (dmg at acm dot org,
5 * with " at " changed at "@" and " dot " changed to "."). */
7 +#include "xlocale_private.h"
16 -gethex(sp, fpi, exp, bp, sign)
17 - CONST char **sp; FPI *fpi; Long *exp; Bigint **bp; int sign;
18 +gethex(sp, fpi, exp, bp, sign, loc)
19 + CONST char **sp; FPI *fpi; Long *exp; Bigint **bp; int sign; locale_t loc;
21 -gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
22 +gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign, locale_t loc)
27 ULong L, lostbits, *x;
30 - unsigned char decimalpoint = *localeconv()->decimal_point;
32 + unsigned char *decimalpointend = NULL;
33 + int decimalpointlen;
35 + NORMALIZE_LOCALE(loc);
36 + decimalpoint = localeconv_l(loc)->decimal_point;
37 + decimalpointlen = strlen(decimalpoint);
39 #define decimalpoint '.'
46 + if (strncmp((char *)s, decimalpoint, decimalpointlen) != 0)
47 +#else /* USE_LOCALE */
48 if (*s != decimalpoint)
49 +#endif /* USE_LOCALE */
52 + decpt = (s += decimalpointlen);
53 + decimalpointend = s - 1;
54 +#else /* USE_LOCALE */
56 +#endif /* USE_LOCALE */
64 - if (*s == decimalpoint && !decpt) {
66 + if (strncmp((char *)s, decimalpoint, decimalpointlen) == 0 && !decpt)
67 +#else /* USE_LOCALE */
68 + if (*s == decimalpoint && !decpt)
69 +#endif /* USE_LOCALE */
72 + decpt = (s += decimalpointlen);
73 + decimalpointend = s - 1;
74 +#else /* USE_LOCALE */
76 +#endif /* USE_LOCALE */
85 + if (--s1 == decimalpointend) {
86 + s1 -= decimalpointlen - 1;
89 +#else /* USE_LOCALE */
90 if (*--s1 == decimalpoint)
92 +#endif /* USE_LOCALE */