]> git.saurik.com Git - apple/libc.git/blobdiff - gdtoa/FreeBSD/gdtoa-strtof.c
Libc-825.24.tar.gz
[apple/libc.git] / gdtoa / FreeBSD / gdtoa-strtof.c
index a8beb3520a018728f5565f39c06479e3088c787d..fc29f597be0bc3b906f2cee8f80dd02161d3631a 100644 (file)
@@ -29,13 +29,15 @@ THIS SOFTWARE.
 /* 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"
 
  float
 #ifdef KR_headers
-strtof(s, sp) CONST char *s; char **sp;
+strtof_l(s, sp, loc) CONST char *s; char **sp; locale_t loc;
 #else
-strtof(CONST char *s, char **sp)
+strtof_l(CONST char *s, char **sp, locale_t loc)
 #endif
 {
        static FPI fpi0 = { 24, 1-127-24+1,  254-127-24+1, 1, SI };
@@ -49,9 +51,13 @@ strtof(CONST char *s, char **sp)
 #define fpi &fpi0
 #endif
 
-       k = strtodg(s, sp, fpi, &exp, bits);
+       NORMALIZE_LOCALE(loc);
+       k = strtodg(s, sp, fpi, &exp, bits, loc);
        switch(k & STRTOG_Retmask) {
          case STRTOG_NoNumber:
+               u.L[0] = 0;
+               return u.f; // avoid setting sign
+
          case STRTOG_Zero:
                u.L[0] = 0;
                break;
@@ -76,3 +82,13 @@ strtof(CONST char *s, char **sp)
                u.L[0] |= 0x80000000L;
        return u.f;
        }
+
+ float
+#ifdef KR_headers
+strtof(s, sp) CONST char *s; char **sp;
+#else
+strtof(CONST char *s, char **sp)
+#endif
+{
+       return strtof_l(s, sp, __current_locale());
+}