OSDN Git Service

buildsys: switch libc to kbuild-style
[uclinux-h8/uClibc.git] / libc / stdlib / _strtod.c
index 1b2adc9..c4c79e5 100644 (file)
@@ -36,7 +36,7 @@
  */
 
 /**********************************************************************/
-/*                                                     OPTIONS                                                                   */
+/*                      OPTIONS                                       */
 /**********************************************************************/
 
 /* Defined if we want to recognize "nan", "inf", and "infinity". (C99) */
@@ -79,7 +79,7 @@
 #define _STRTOD_ZERO_CHECK        1
 
 /**********************************************************************/
-/* Don't change anything that follows.                                                                    */
+/* Don't change anything that follows.                                */
 /**********************************************************************/
 
 #ifdef _STRTOD_ERRNO
@@ -95,7 +95,6 @@
 
 /**********************************************************************/
 
-#define _ISOC99_SOURCE 1
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #include <locale.h>
 
 #ifdef __UCLIBC_HAS_WCHAR__
-
-#include <wchar.h>
-#include <wctype.h>
-#include <bits/uClibc_uwchar.h>
-libc_hidden_proto(iswspace)
+# include <wchar.h>
+# include <wctype.h>
+# include <bits/uClibc_uwchar.h>
 #endif
 
-#ifdef __UCLIBC_HAS_XLOCALE__
-#include <xlocale.h>
-libc_hidden_proto(iswspace_l)
-#endif /* __UCLIBC_HAS_XLOCALE__ */
-
 /* Handle _STRTOD_HEXADECIMAL_FLOATS via uClibc config now. */
 #undef _STRTOD_HEXADECIMAL_FLOATS
 #ifdef __UCLIBC_HAS_HEXADECIMAL_FLOATS__
-#define _STRTOD_HEXADECIMAL_FLOATS 1
-#endif /* __UCLIBC_HAS_HEXADECIMAL_FLOATS__ */
+# define _STRTOD_HEXADECIMAL_FLOATS 1
+#endif
 
 /**********************************************************************/
 
@@ -175,13 +167,6 @@ extern void __fp_range_check(__fpmax_t y, __fpmax_t x) attribute_hidden;
 /**********************************************************************/
 #if defined(L___strtofpmax) || defined(L___strtofpmax_l) || defined(L___wcstofpmax) || defined(L___wcstofpmax_l)
 
-#ifdef __UCLIBC_HAS_XLOCALE__
-libc_hidden_proto(__ctype_b_loc)
-#elif defined __UCLIBC_HAS_CTYPE_TABLES__
-libc_hidden_proto(__ctype_b)
-libc_hidden_proto(__ctype_tolower)
-#endif
-
 #if defined(L___wcstofpmax) || defined(L___wcstofpmax_l)
 
 #define __strtofpmax    __wcstofpmax
@@ -215,7 +200,6 @@ __fpmax_t attribute_hidden __strtofpmax(const Wchar *str, Wchar **endptr, int ex
 
 #else  /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
 
-/* Experimentally off - libc_hidden_proto(memcmp) */
 
 __fpmax_t attribute_hidden __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endptr, int exponent_power
                                                                 __LOCALE_PARAM )
@@ -348,16 +332,11 @@ __fpmax_t attribute_hidden __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endp
                        static const char nan_inf_str[] = "\05nan\0\012infinity\0\05inf\0";
                        int i = 0;
 
-#ifdef __UCLIBC_HAS_LOCALE__
-                       /* Avoid tolower problems for INFINITY in the tr_TR locale. (yuk)*/
-#undef _tolower
-#define _tolower(C)     ((C)|0x20)
-#endif /* __UCLIBC_HAS_LOCALE__ */
-
                        do {
                                /* Unfortunately, we have no memcasecmp(). */
                                int j = 0;
-                               while (_tolower(pos[j]) == nan_inf_str[i+1+j]) {
+                               /* | 0x20 is a cheap lowercasing (valid for ASCII letters and numbers only) */
+                               while ((pos[j] | 0x20) == nan_inf_str[i+1+j]) {
                                        ++j;
                                        if (!nan_inf_str[i+1+j]) {
                                                number = i / 0.;
@@ -525,7 +504,6 @@ void attribute_hidden __fp_range_check(__fpmax_t y, __fpmax_t x)
 #endif
 
 
-libc_hidden_proto(__XL_NPP(strtof))
 float __XL_NPP(strtof)(const Wchar *str, Wchar **endptr   __LOCALE_PARAM )
 {
 #if FPMAX_TYPE == 1
@@ -542,7 +520,6 @@ float __XL_NPP(strtof)(const Wchar *str, Wchar **endptr   __LOCALE_PARAM )
        return y;
 #endif
 }
-libc_hidden_def(__XL_NPP(strtof))
 
 #endif
 #endif
@@ -560,7 +537,6 @@ libc_hidden_def(__XL_NPP(strtof))
 #define Wchar char
 #endif
 
-libc_hidden_proto(__XL_NPP(strtod))
 double __XL_NPP(strtod)(const Wchar *__restrict str,
                                        Wchar **__restrict endptr   __LOCALE_PARAM )
 {
@@ -578,7 +554,9 @@ double __XL_NPP(strtod)(const Wchar *__restrict str,
        return y;
 #endif
 }
-libc_hidden_def(__XL_NPP(strtod))
+#ifdef L_strtod
+libc_hidden_def(strtod)
+#endif
 
 #endif
 #endif
@@ -596,7 +574,6 @@ libc_hidden_def(__XL_NPP(strtod))
 #define Wchar char
 #endif
 
-libc_hidden_proto(__XL_NPP(strtold))
 long double __XL_NPP(strtold) (const Wchar *str, Wchar **endptr   __LOCALE_PARAM )
 {
 #if FPMAX_TYPE == 3
@@ -613,7 +590,6 @@ long double __XL_NPP(strtold) (const Wchar *str, Wchar **endptr   __LOCALE_PARAM
        return y;
 #endif
 }
-libc_hidden_def(__XL_NPP(strtold))
 
 #endif
 #endif