Revert locale for apple back to original design, getting rid of now useless helper *_l functions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135272 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9a2078137f
commit
bcbbd4d14f
106
include/locale
106
include/locale
@ -204,75 +204,7 @@ typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
|
||||
// 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 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
// 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 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
|
||||
*__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 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
|
||||
{
|
||||
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 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ 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 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ 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 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ 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 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ 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 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
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 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
#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 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
{
|
||||
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 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
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 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
#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 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
{
|
||||
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 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
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 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user