2 +++ dtoa/include/dtoa.h
4 +extern "C" double strtod_nolocale(const char *s00, char **se);
5 --- dtoa/src/dtoa.c.orig
7 @@ -268,7 +268,7 @@ #ifndef PRIVATE_MEM
8 #define PRIVATE_MEM 2304
10 #define PRIVATE_mem ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double))
11 -static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
12 +static thread_local double private_mem[PRIVATE_mem], *pmem_next = private_mem;
16 @@ -1502,9 +1502,7 @@ static unsigned int maxthreads = 0;
20 -extern "C" double strtod(const char *s00, char **se);
21 -extern "C" char *dtoa(double d, int mode, int ndigits,
22 - int *decpt, int *sign, char **rve);
23 +extern "C" double strtod_nolocale(const char *s00, char **se);
27 @@ -1521,7 +1519,7 @@ ThInfo {
32 + static thread_local ThInfo TI0;
34 #ifdef MULTIPLE_THREADS
36 @@ -1529,7 +1527,7 @@ #ifdef MULTIPLE_THREADS
42 set_max_dtoa_threads(unsigned int n)
45 @@ -2717,7 +2715,7 @@ enum { /* rounding values: same as FLT_ROUNDS */
51 gethex( const char **sp, U *rvp, int rounding, int sign MTd)
54 @@ -3429,7 +3427,7 @@ retlow1:
55 #endif /* NO_STRTOD_BIGCOMP */
58 -strtod(const char *s00, char **se)
59 +strtod_nolocale(const char *s00, char **se)
61 int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1;
62 int esign, i, j, k, nd, nd0, nf, nz, nz0, nz1, sign;
63 @@ -4851,7 +4849,7 @@ strtod_nolocale(const char *s00, char **se)
66 #ifndef MULTIPLE_THREADS
67 - static char *dtoa_result;
68 + static thread_local char *dtoa_result;
72 @@ -4902,7 +4900,7 @@ nrv_alloc(const char *s, char *s0, size_t s0len, char **rve, int n MTd)
73 * when MULTIPLE_THREADS is not defined.
80 #ifdef MULTIPLE_THREADS
81 @@ -4951,7 +4949,7 @@ freedtoa(char *s)
87 dtoa_r(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve, char *buf, size_t blen)
89 /* Arguments ndigits, decpt, sign are similar to those
90 @@ -6184,8 +6182,8 @@ dtoa_r(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve, char
95 -dtoa(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve)
97 +dtoa_nolocale(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve)
99 /* Sufficient space is allocated to the return value
100 to hold the suppressed trailing zeros.