[cfe-commits] [libcxx] r135272 - /libcxx/trunk/include/locale

Howard Hinnant hhinnant at apple.com
Fri Jul 15 07:46:11 PDT 2011


Author: hhinnant
Date: Fri Jul 15 09:46:11 2011
New Revision: 135272

URL: http://llvm.org/viewvc/llvm-project?rev=135272&view=rev
Log:
Revert locale for apple back to original design, getting rid of now useless helper *_l functions

Modified:
    libcxx/trunk/include/locale

Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=135272&r1=135271&r2=135272&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Fri Jul 15 09:46:11 2011
@@ -204,75 +204,7 @@
 // OSX has nice foo_l() functions that let you turn off use of the global
 // locale.  Linux, not so much.  The following functions avoid the locale when
 // that's possible and otherwise do the wrong thing.  FIXME.
-#ifdef _LIBCPP_STABLE_APPLE_ABI
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-int
-__nolocale_sprintf(char* __restrict __str,
-                   const char* __restrict __format, _Tp __v)
-{
-    return sprintf_l(__str, 0, __format, __v);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-int
-__nolocale_snprintf(char* __restrict __str, size_t __size,
-                    const char* __restrict __format, _Tp __v)
-{
-    return snprintf_l(__str, __size, 0, __format, __v);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-int
-__nolocale_snprintf(char* __restrict __str, size_t __size,
-                    const char* __restrict __format, int __prec, _Tp __v)
-{
-    return snprintf_l(__str, __size, 0, __format, __prec, __v);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-int
-__nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
-{
-    return asprintf_l(__ret, 0, __format, __v);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-int
-__nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
-                                                                        _Tp __v)
-{
-    return asprintf_l(__ret, 0, __format, __prec, __v);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-int
-__nolocale_sscanf(const char* __restrict __str,
-                  const char* __restrict __format, _Tp* __v)
-{
-    return sscanf_l(__str, 0, __format, __v);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-int
-__nolocale_isxdigit(int __c)
-{
-    return isxdigit_l(__c, 0);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-int
-__nolocale_isdigit(int __c)
-{
-    return isdigit_l(__c, 0);
-}
-
-#else  // _LIBCPP_STABLE_APPLE_ABI
+#ifndef _LIBCPP_STABLE_APPLE_ABI
 
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
 decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
@@ -1360,7 +1292,7 @@
     // Stage 3
     __a[sizeof(__a)-1] = 0;
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-    if (__nolocale_sscanf(__a, "%p", &__v) != 1)
+    if (sscanf_l(__a, 0, "%p", &__v) != 1)
 #else
     if (__sscanf_l(__a, __cloc(), "%p", &__v) != 1)
 #endif
@@ -1469,7 +1401,7 @@
         *__oe++ = __ct.widen(*__nf++);
         for (__ns = __nf; __ns < __ne; ++__ns)
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-            if (!__nolocale_isxdigit(*__ns))
+            if (!isxdigit_l(*__ns, 0))
 #else
             if (!isxdigit_l(*__ns, __cloc()))
 #endif
@@ -1479,7 +1411,7 @@
     {
         for (__ns = __nf; __ns < __ne; ++__ns)
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-            if (!__nolocale_isdigit(*__ns))
+            if (!isdigit_l(*__ns, 0))
 #else
             if (!isdigit_l(*__ns, __cloc()))
 #endif
@@ -1681,7 +1613,7 @@
                           + 1;
     char __nar[__nbuf];
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-    int __nc = __nolocale_sprintf(__nar, __fmt, __v);
+    int __nc = sprintf_l(__nar, 0, __fmt, __v);
 #else
     int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
 #endif
@@ -1711,7 +1643,7 @@
                           + 1;
     char __nar[__nbuf];
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-    int __nc = __nolocale_sprintf(__nar, __fmt, __v);
+    int __nc = sprintf_l(__nar, 0, __fmt, __v);
 #else
     int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
 #endif
@@ -1741,7 +1673,7 @@
                           + 1;
     char __nar[__nbuf];
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-    int __nc = __nolocale_sprintf(__nar, __fmt, __v);
+    int __nc = sprintf_l(__nar, 0, __fmt, __v);
 #else
     int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
 #endif
@@ -1771,7 +1703,7 @@
                           + 1;
     char __nar[__nbuf];
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-    int __nc = __nolocale_sprintf(__nar, __fmt, __v);
+    int __nc = sprintf_l(__nar, 0, __fmt, __v);
 #else
     int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
 #endif
@@ -1802,7 +1734,7 @@
     int __nc;
     if (__specify_precision)
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-        __nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
+        __nc = snprintf_l(__nb, __nbuf, 0, __fmt,
                                    (int)__iob.precision(), __v);
 #else
         __nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
@@ -1810,7 +1742,7 @@
 #endif
     else
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-        __nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
+        __nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v);
 #else
         __nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
 #endif
@@ -1819,15 +1751,14 @@
     {
         if (__specify_precision)
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-            __nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
-                                       __v);
+            __nc = asprintf_l(&__nb, 0, __fmt, (int)__iob.precision(), __v);
 #else
             __nc = __asprintf_l(&__nb, __cloc(), __fmt,
                               (int)__iob.precision());
 #endif
         else
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-            __nc = __nolocale_asprintf(&__nb, __fmt, __v);
+            __nc = asprintf_l(&__nb, 0, __fmt, __v);
 #else
             __nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision());
 #endif
@@ -1872,7 +1803,7 @@
     int __nc;
     if (__specify_precision)
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-        __nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
+        __nc = snprintf_l(__nb, __nbuf, 0, __fmt,
                                    (int)__iob.precision(), __v);
 #else
         __nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
@@ -1880,7 +1811,7 @@
 #endif
     else
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-        __nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
+        __nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v);
 #else
         __nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
 #endif
@@ -1889,15 +1820,14 @@
     {
         if (__specify_precision)
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-            __nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
-                                       __v);
+            __nc = asprintf_l(&__nb, 0, __fmt, (int)__iob.precision(), __v);
 #else
             __nc = __asprintf_l(&__nb, __cloc(), __fmt,
                               (int)__iob.precision());
 #endif
         else
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-            __nc = __nolocale_asprintf(&__nb, __fmt, __v);
+            __nc = asprintf_l(&__nb, 0, __fmt, __v);
 #else
             __nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision());
 #endif
@@ -1937,7 +1867,7 @@
     const unsigned __nbuf = 20;
     char __nar[__nbuf];
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-    int __nc = __nolocale_sprintf(__nar, __fmt, __v);
+    int __nc = sprintf_l(__nar, 0, __fmt, __v);
 #else
     int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
 #endif
@@ -3625,7 +3555,7 @@
     if (__n > __bs-1)
     {
 #ifdef _LIBCPP_STABLE_APPLE_ABI
-        __n = __nolocale_asprintf(&__bb, "%.0Lf", __units);
+        __n = asprintf_l(&__bb, 0, "%.0Lf", __units);
 #else
         __n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);
 #endif





More information about the cfe-commits mailing list