]> git.saurik.com Git - apple/libc.git/blob - gdtoa/FreeBSD/gdtoa-strtof.c.patch
Libc-594.9.5.tar.gz
[apple/libc.git] / gdtoa / FreeBSD / gdtoa-strtof.c.patch
1 --- gdtoa-strtof.c.orig 2008-10-28 12:35:19.000000000 -0700
2 +++ gdtoa-strtof.c 2008-10-28 13:19:34.000000000 -0700
3 @@ -29,13 +29,15 @@ THIS SOFTWARE.
4 /* Please send bug reports to David M. Gay (dmg at acm dot org,
5 * with " at " changed at "@" and " dot " changed to "."). */
6
7 +#include "xlocale_private.h"
8 +
9 #include "gdtoaimp.h"
10
11 float
12 #ifdef KR_headers
13 -strtof(s, sp) CONST char *s; char **sp;
14 +strtof_l(s, sp, loc) CONST char *s; char **sp; locale_t loc;
15 #else
16 -strtof(CONST char *s, char **sp)
17 +strtof_l(CONST char *s, char **sp, locale_t loc)
18 #endif
19 {
20 static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI };
21 @@ -49,9 +51,13 @@ strtof(CONST char *s, char **sp)
22 #define fpi &fpi0
23 #endif
24
25 - k = strtodg(s, sp, fpi, &exp, bits);
26 + NORMALIZE_LOCALE(loc);
27 + k = strtodg(s, sp, fpi, &exp, bits, loc);
28 switch(k & STRTOG_Retmask) {
29 case STRTOG_NoNumber:
30 + u.L[0] = 0;
31 + return u.f; // avoid setting sign
32 +
33 case STRTOG_Zero:
34 u.L[0] = 0;
35 break;
36 @@ -76,3 +82,13 @@ strtof(CONST char *s, char **sp)
37 u.L[0] |= 0x80000000L;
38 return u.f;
39 }
40 +
41 + float
42 +#ifdef KR_headers
43 +strtof(s, sp) CONST char *s; char **sp;
44 +#else
45 +strtof(CONST char *s, char **sp)
46 +#endif
47 +{
48 + return strtof_l(s, sp, __current_locale());
49 +}