summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/include/locale
diff options
context:
space:
mode:
authortheraven <theraven@FreeBSD.org>2013-07-10 16:28:24 +0000
committertheraven <theraven@FreeBSD.org>2013-07-10 16:28:24 +0000
commit214e4f8fe625ad54aac3b215909e0b994a5768ec (patch)
treef757844d307e5ebbf92ab857f2376cceb7807147 /contrib/libc++/include/locale
parentc660176671bf640bee3fd09dbfa32ad187a9b942 (diff)
downloadFreeBSD-src-214e4f8fe625ad54aac3b215909e0b994a5768ec.zip
FreeBSD-src-214e4f8fe625ad54aac3b215909e0b994a5768ec.tar.gz
Import new libcxxrt / libc++. This brings some bug fixes, including a potential race condition for static initialisers.
Diffstat (limited to 'contrib/libc++/include/locale')
-rw-r--r--contrib/libc++/include/locale36
1 files changed, 12 insertions, 24 deletions
diff --git a/contrib/libc++/include/locale b/contrib/libc++/include/locale
index 49f9c08..ef7603d 100644
--- a/contrib/libc++/include/locale
+++ b/contrib/libc++/include/locale
@@ -206,6 +206,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if defined(__APPLE__) || defined(__FreeBSD__)
# define _LIBCPP_GET_C_LOCALE 0
+#elif defined(__NetBSD__)
+# define _LIBCPP_GET_C_LOCALE LC_C_LOCALE
#else
# define _LIBCPP_GET_C_LOCALE __cloc()
// Get the C locale object
@@ -355,20 +357,6 @@ size_t __mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
}
inline
-int __sprintf_l(char *__s, locale_t __l, const char *__format, ...) {
- va_list __va;
- va_start(__va, __format);
-#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __res = vsprintf_l(__s, __l, __format, __va);
-#else
- __locale_raii __current(uselocale(__l), uselocale);
- int __res = vsprintf(__s, __format, __va);
-#endif
- va_end(__va);
- return __res;
-}
-
-inline
int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
@@ -1801,9 +1789,9 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+ int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
- int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
+ int __nc = __snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v);
#endif
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
@@ -1831,9 +1819,9 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+ int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
- int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
+ int __nc = __snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v);
#endif
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
@@ -1861,9 +1849,9 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+ int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
- int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
+ int __nc = __snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v);
#endif
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
@@ -1891,9 +1879,9 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+ 1;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+ int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
- int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
+ int __nc = __snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v);
#endif
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
@@ -2055,9 +2043,9 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
const unsigned __nbuf = 20;
char __nar[__nbuf];
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- int __nc = sprintf_l(__nar, _LIBCPP_GET_C_LOCALE, __fmt, __v);
+ int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
#else
- int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
+ int __nc = __snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v);
#endif
char* __ne = __nar + __nc;
char* __np = this->__identify_padding(__nar, __ne, __iob);
OpenPOWER on IntegriCloud