]> granicus.if.org Git - icu/commitdiff
ICU-10232 Updated preprocessro macro again - including xlocale.h except for windows...
authorYoshito Umaoka <y.umaoka@gmail.com>
Wed, 7 Sep 2016 07:43:38 +0000 (07:43 +0000)
committerYoshito Umaoka <y.umaoka@gmail.com>
Wed, 7 Sep 2016 07:43:38 +0000 (07:43 +0000)
X-SVN-Rev: 39144

icu4c/source/configure
icu4c/source/configure.ac
icu4c/source/i18n/digitlst.cpp

index 4cd3586d23b04421b24c36484965c9ae5cd293ac..d764fce787aeb3dd8dba630e13a353e21e03945e 100755 (executable)
@@ -7071,6 +7071,7 @@ fi
 
 if test x$ac_cv_func_strtod_l = xyes
 then
+     CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=1"
      U_HAVE_STRTOD_L=1
 else
      CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=0"
index 76aa00e1976846dec56832b54e9bbb7caaaf978c..0ac7b54d1e18122edc22ec849b988b73b426e0f5 100644 (file)
@@ -896,6 +896,7 @@ AC_SUBST(U_TIMEZONE)
 AC_CHECK_FUNC(strtod_l)
 if test x$ac_cv_func_strtod_l = xyes
 then
+     CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=1"
      U_HAVE_STRTOD_L=1
 else
      CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=0"
index 8809b86549dcb00e5f6e6dd56e0b3440c26acffc..e157a3f84c52d9fdc16c57ff7b83c4f1d2dd866d 100644 (file)
 
 #if !UCONFIG_NO_FORMATTING
 
-#if !defined(U_HAVE_STRTOD_L)
-#  if U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM_IS_LINUX_BASED || U_PLATFORM == U_PF_BSD || U_PLATFORM_HAS_WIN32_API
-#    define U_HAVE_STRTOD_L 1
-#  else
-#    define U_HAVE_STRTOD_L 0
-#  endif
-#endif
-
 #include "unicode/putil.h"
 #include "charstr.h"
 #include "cmemory.h"
 #include <stdio.h>
 #include <limits>
 
-#if U_HAVE_STRTOD_L && (U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM == U_PF_BSD)
+#if !defined(U_USE_STRTOD_L)
+# if U_PLATFORM_HAS_WIN32_API
+#   define U_USE_STRTOD_L 1
+# elif defined(U_HAVE_STRTOD_L)
+#   define U_USE_STRTOD_L U_HAVE_STRTOD_L
+# else
+#   define U_USE_STRTOD_L 0
+# endif
+#endif
+
+#if U_USE_STRTOD_L && !U_PLATFORM_HAS_WIN32_API
 #include <xlocale.h>
 #endif
 
@@ -477,18 +479,13 @@ DigitList::getDouble() const
     return tDouble;
 }
 
-#if U_HAVE_STRTOD_L
-# if U_PLATFORM_HAS_WIN32_API
-#   define locale_t _locale_t
-#   define newlocale(cat, loc, base) _create_locale(cat, loc)
-#   define freelocale _free_locale
-#   define strtod_l _strtod_l
-# elif U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM == U_PF_BSD
-#   define LC_ALL LC_ALL_MASK
-# endif
+#if U_USE_STRTOD_L && U_PLATFORM_HAS_WIN32_API
+# define locale_t _locale_t
+# define freelocale _free_locale
+# define strtod_l _strtod_l
 #endif
 
-#if U_HAVE_STRTOD_L
+#if U_USE_STRTOD_L
 static locale_t gCLocale = (locale_t)0;
 #endif
 static icu::UInitOnce gCLocaleInitOnce = U_INITONCE_INITIALIZER;
@@ -497,7 +494,7 @@ U_CDECL_BEGIN
 // Cleanup callback func
 static UBool U_CALLCONV digitList_cleanup(void)
 {
-#if U_HAVE_STRTOD_L
+#if U_USE_STRTOD_L
     if (gCLocale != (locale_t)0) {
         freelocale(gCLocale);
     }
@@ -507,8 +504,12 @@ static UBool U_CALLCONV digitList_cleanup(void)
 // C Locale initialization func
 static void U_CALLCONV initCLocale(void) {
     ucln_i18n_registerCleanup(UCLN_I18N_DIGITLIST, digitList_cleanup);
-#if U_HAVE_STRTOD_L
-    gCLocale = newlocale(LC_ALL, "C", (locale_t)0);
+#if U_USE_STRTOD_L
+# if U_PLATFORM_HAS_WIN32_API
+    gCLocale = _create_locale(LC_ALL, "C");
+# else
+    gCLocale = newlocale(LC_ALL_MASK, "C", (locale_t)0);
+# endif
 #endif
 }
 U_CDECL_END
@@ -516,7 +517,7 @@ U_CDECL_END
 double
 DigitList::decimalStrToDouble(char *decstr, char **end) {
     umtx_initOnce(gCLocaleInitOnce, &initCLocale);
-#if U_HAVE_STRTOD_L
+#if U_USE_STRTOD_L
     return strtod_l(decstr, end, gCLocale);
 #else
     char *decimalPt = strchr(decstr, '.');