Compare commits
1 Commits
apple25
...
svn-tags/l
Author | SHA1 | Date | |
---|---|---|---|
![]() |
11f376d956 |
@@ -285,12 +285,4 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _LIBCPP_STABLE_APPLE_ABI
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _LIBCPP_WCTYPE_IS_MASK
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
||||
|
@@ -302,11 +302,7 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
|
||||
class _LIBCPP_VISIBLE ctype_base
|
||||
{
|
||||
public:
|
||||
#ifdef __GLIBC__
|
||||
typedef unsigned short mask;
|
||||
#else
|
||||
typedef __uint32_t mask;
|
||||
#endif
|
||||
|
||||
#if __APPLE__
|
||||
static const mask space = _CTYPE_S;
|
||||
@@ -541,10 +537,6 @@ public:
|
||||
#endif
|
||||
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
|
||||
static const mask* classic_table() _NOEXCEPT;
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
static const int* __classic_upper_table() _NOEXCEPT;
|
||||
static const int* __classic_lower_table() _NOEXCEPT;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
~ctype();
|
||||
|
@@ -585,10 +585,8 @@ __assoc_state<_R>::set_value(_Arg& __arg)
|
||||
#endif
|
||||
{
|
||||
unique_lock<mutex> __lk(this->__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
::new(&__value_) _R(_VSTD::forward<_Arg>(__arg));
|
||||
this->__state_ |= base::__constructed | base::ready;
|
||||
__lk.unlock();
|
||||
@@ -605,10 +603,8 @@ __assoc_state<_R>::set_value_at_thread_exit(_Arg& __arg)
|
||||
#endif
|
||||
{
|
||||
unique_lock<mutex> __lk(this->__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
::new(&__value_) _R(_VSTD::forward<_Arg>(__arg));
|
||||
this->__state_ |= base::__constructed;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
@@ -667,10 +663,8 @@ void
|
||||
__assoc_state<_R&>::set_value(_R& __arg)
|
||||
{
|
||||
unique_lock<mutex> __lk(this->__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__value_ = &__arg;
|
||||
this->__state_ |= base::__constructed | base::ready;
|
||||
__lk.unlock();
|
||||
@@ -682,10 +676,8 @@ void
|
||||
__assoc_state<_R&>::set_value_at_thread_exit(_R& __arg)
|
||||
{
|
||||
unique_lock<mutex> __lk(this->__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__value_ = &__arg;
|
||||
this->__state_ |= base::__constructed;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
@@ -1074,10 +1066,8 @@ template <class _R>
|
||||
future<_R>::future(__assoc_state<_R>* __state)
|
||||
: __state_(__state)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_->__has_future_attached())
|
||||
throw future_error(make_error_code(future_errc::future_already_retrieved));
|
||||
#endif
|
||||
__state_->__add_shared();
|
||||
__state_->__set_future_attached();
|
||||
}
|
||||
@@ -1178,10 +1168,8 @@ template <class _R>
|
||||
future<_R&>::future(__assoc_state<_R&>* __state)
|
||||
: __state_(__state)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_->__has_future_attached())
|
||||
throw future_error(make_error_code(future_errc::future_already_retrieved));
|
||||
#endif
|
||||
__state_->__add_shared();
|
||||
__state_->__set_future_attached();
|
||||
}
|
||||
@@ -1380,10 +1368,8 @@ template <class _R>
|
||||
future<_R>
|
||||
promise<_R>::get_future()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
return future<_R>(__state_);
|
||||
}
|
||||
|
||||
@@ -1391,10 +1377,8 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_value(const _R& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value(__r);
|
||||
}
|
||||
|
||||
@@ -1404,10 +1388,8 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_value(_R&& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value(_VSTD::move(__r));
|
||||
}
|
||||
|
||||
@@ -1417,10 +1399,8 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_exception(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception(__p);
|
||||
}
|
||||
|
||||
@@ -1428,10 +1408,8 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_value_at_thread_exit(const _R& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value_at_thread_exit(__r);
|
||||
}
|
||||
|
||||
@@ -1441,10 +1419,8 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_value_at_thread_exit(_R&& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value_at_thread_exit(_VSTD::move(__r));
|
||||
}
|
||||
|
||||
@@ -1454,10 +1430,8 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_exception_at_thread_exit(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception_at_thread_exit(__p);
|
||||
}
|
||||
|
||||
@@ -1553,10 +1527,8 @@ template <class _R>
|
||||
future<_R&>
|
||||
promise<_R&>::get_future()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
return future<_R&>(__state_);
|
||||
}
|
||||
|
||||
@@ -1564,10 +1536,8 @@ template <class _R>
|
||||
void
|
||||
promise<_R&>::set_value(_R& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value(__r);
|
||||
}
|
||||
|
||||
@@ -1575,10 +1545,8 @@ template <class _R>
|
||||
void
|
||||
promise<_R&>::set_exception(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception(__p);
|
||||
}
|
||||
|
||||
@@ -1586,10 +1554,8 @@ template <class _R>
|
||||
void
|
||||
promise<_R&>::set_value_at_thread_exit(_R& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value_at_thread_exit(__r);
|
||||
}
|
||||
|
||||
@@ -1597,10 +1563,8 @@ template <class _R>
|
||||
void
|
||||
promise<_R&>::set_exception_at_thread_exit(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception_at_thread_exit(__p);
|
||||
}
|
||||
|
||||
|
@@ -192,11 +192,6 @@ template <class charT> class messages_byname;
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
// Get the C locale object
|
||||
locale_t __cloc();
|
||||
#endif
|
||||
|
||||
// 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.
|
||||
@@ -2516,11 +2511,7 @@ class __time_put
|
||||
{
|
||||
locale_t __loc_;
|
||||
protected:
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
_LIBCPP_ALWAYS_INLINE __time_put() : __loc_(0) {}
|
||||
#else // _LIBCPP_STABLE_APPLE_ABI
|
||||
_LIBCPP_ALWAYS_INLINE __time_put() : __loc_(__cloc()) {}
|
||||
#endif // _LIBCPP_STABLE_APPLE_ABI
|
||||
__time_put(const char* __nm);
|
||||
__time_put(const string& __nm);
|
||||
~__time_put();
|
||||
|
@@ -1801,10 +1801,10 @@ private:
|
||||
__storage_pointer __begin_;
|
||||
size_type __size_;
|
||||
__compressed_pair<size_type, __storage_allocator> __cap_alloc_;
|
||||
public:
|
||||
|
||||
typedef __bit_reference<vector> reference;
|
||||
typedef __bit_const_reference<vector> const_reference;
|
||||
private:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type& __cap() _NOEXCEPT
|
||||
{return __cap_alloc_.first();}
|
||||
|
@@ -73,10 +73,8 @@ void
|
||||
__assoc_sub_state::set_value()
|
||||
{
|
||||
unique_lock<mutex> __lk(__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__state_ |= __constructed | ready;
|
||||
__lk.unlock();
|
||||
__cv_.notify_all();
|
||||
@@ -86,10 +84,8 @@ void
|
||||
__assoc_sub_state::set_value_at_thread_exit()
|
||||
{
|
||||
unique_lock<mutex> __lk(__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__state_ |= __constructed;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
__lk.unlock();
|
||||
@@ -99,10 +95,8 @@ void
|
||||
__assoc_sub_state::set_exception(exception_ptr __p)
|
||||
{
|
||||
unique_lock<mutex> __lk(__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__exception_ = __p;
|
||||
__state_ |= ready;
|
||||
__lk.unlock();
|
||||
@@ -113,10 +107,8 @@ void
|
||||
__assoc_sub_state::set_exception_at_thread_exit(exception_ptr __p)
|
||||
{
|
||||
unique_lock<mutex> __lk(__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__exception_ = __p;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
__lk.unlock();
|
||||
@@ -167,18 +159,14 @@ __assoc_sub_state::__sub_wait(unique_lock<mutex>& __lk)
|
||||
void
|
||||
__assoc_sub_state::__execute()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
}
|
||||
|
||||
future<void>::future(__assoc_sub_state* __state)
|
||||
: __state_(__state)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_->__has_future_attached())
|
||||
throw future_error(make_error_code(future_errc::future_already_retrieved));
|
||||
#endif
|
||||
__state_->__add_shared();
|
||||
__state_->__set_future_attached();
|
||||
}
|
||||
@@ -218,50 +206,40 @@ promise<void>::~promise()
|
||||
future<void>
|
||||
promise<void>::get_future()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
return future<void>(__state_);
|
||||
}
|
||||
|
||||
void
|
||||
promise<void>::set_value()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value();
|
||||
}
|
||||
|
||||
void
|
||||
promise<void>::set_exception(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception(__p);
|
||||
}
|
||||
|
||||
void
|
||||
promise<void>::set_value_at_thread_exit()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value_at_thread_exit();
|
||||
}
|
||||
|
||||
void
|
||||
promise<void>::set_exception_at_thread_exit(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception_at_thread_exit(__p);
|
||||
}
|
||||
|
||||
|
184
src/locale.cpp
184
src/locale.cpp
@@ -116,20 +116,6 @@ namespace with_locale { namespace {
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
locale_t __cloc() {
|
||||
// In theory this could create a race condition. In practice
|
||||
// the race condition is non-fatal since it will just create
|
||||
// a little resource leak. Better approach would be appreciated.
|
||||
#ifdef __APPLE__
|
||||
return 0;
|
||||
#else
|
||||
static locale_t result = newlocale(LC_ALL_MASK, "C", 0);
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
#endif // _LIBCPP_STABLE_APPLE_ABI
|
||||
|
||||
namespace {
|
||||
|
||||
struct release
|
||||
@@ -781,80 +767,93 @@ ctype<wchar_t>::~ctype()
|
||||
bool
|
||||
ctype<wchar_t>::do_is(mask m, char_type c) const
|
||||
{
|
||||
return isascii(c) ? ctype<char>::classic_table()[c] & m : false;
|
||||
#ifdef __APPLE__
|
||||
return isascii(c) ? _DefaultRuneLocale.__runetype[c] & m : false;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
const wchar_t*
|
||||
ctype<wchar_t>::do_is(const char_type* low, const char_type* high, mask* vec) const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
for (; low != high; ++low, ++vec)
|
||||
*vec = static_cast<mask>(isascii(*low) ?
|
||||
ctype<char>::classic_table()[*low] : 0);
|
||||
*vec = static_cast<mask>(isascii(*low) ? _DefaultRuneLocale.__runetype[*low] : 0);
|
||||
return low;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
const wchar_t*
|
||||
ctype<wchar_t>::do_scan_is(mask m, const char_type* low, const char_type* high) const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
for (; low != high; ++low)
|
||||
if (isascii(*low) && (ctype<char>::classic_table()[*low] & m))
|
||||
if (isascii(*low) && (_DefaultRuneLocale.__runetype[*low] & m))
|
||||
break;
|
||||
return low;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
const wchar_t*
|
||||
ctype<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high) const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
for (; low != high; ++low)
|
||||
if (!(isascii(*low) && (ctype<char>::classic_table()[*low] & m)))
|
||||
if (!(isascii(*low) && (_DefaultRuneLocale.__runetype[*low] & m)))
|
||||
break;
|
||||
return low;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
wchar_t
|
||||
ctype<wchar_t>::do_toupper(char_type c) const
|
||||
{
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
const wchar_t*
|
||||
ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
for (; low != high; ++low)
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
|
||||
: *low;
|
||||
#else
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
|
||||
#endif
|
||||
return low;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
wchar_t
|
||||
ctype<wchar_t>::do_tolower(char_type c) const
|
||||
{
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
const wchar_t*
|
||||
ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
for (; low != high; ++low)
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
*low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
|
||||
: *low;
|
||||
#else
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
|
||||
#endif
|
||||
return low;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
wchar_t
|
||||
@@ -899,8 +898,10 @@ ctype<char>::ctype(const mask* tab, bool del, size_t refs)
|
||||
__tab_(tab),
|
||||
__del_(del)
|
||||
{
|
||||
if (__tab_ == 0)
|
||||
__tab_ = classic_table();
|
||||
#ifdef __APPLE__
|
||||
if (__tab_ == 0)
|
||||
__tab_ = _DefaultRuneLocale.__runetype;
|
||||
#endif
|
||||
}
|
||||
|
||||
ctype<char>::~ctype()
|
||||
@@ -912,45 +913,45 @@ ctype<char>::~ctype()
|
||||
char
|
||||
ctype<char>::do_toupper(char_type c) const
|
||||
{
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
return isascii(c) ? __classic_upper_table()[c] : c;
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char*
|
||||
ctype<char>::do_toupper(char_type* low, const char_type* high) const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
for (; low != high; ++low)
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
*low = isascii(*low) ? __classic_upper_table()[*low] : *low;
|
||||
#else
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
|
||||
#endif
|
||||
return low;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
char
|
||||
ctype<char>::do_tolower(char_type c) const
|
||||
{
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
return isascii(c) ? __classic_lower_table()[c] : c;
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
const char*
|
||||
ctype<char>::do_tolower(char_type* low, const char_type* high) const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
for (; low != high; ++low)
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
*low = isascii(*low) ? __classic_lower_table()[*low] : *low;
|
||||
#else
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
|
||||
#endif
|
||||
return low;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
char
|
||||
@@ -991,40 +992,11 @@ ctype<char>::classic_table() _NOEXCEPT
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
return _DefaultRuneLocale.__runetype;
|
||||
#elif defined(__GLIBC__)
|
||||
return __cloc()->__ctype_b;
|
||||
// This is assumed to be safe.
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
const int*
|
||||
ctype<char>::__classic_lower_table() _NOEXCEPT
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
return _DefaultRuneLocale.__maplower;
|
||||
#elif defined(__GLIBC__)
|
||||
return __cloc()->__ctype_tolower;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
const int*
|
||||
ctype<char>::__classic_upper_table() _NOEXCEPT
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
return _DefaultRuneLocale.__mapupper;
|
||||
#elif defined(__GLIBC__)
|
||||
return __cloc()->__ctype_toupper;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
#endif // _LIBCPP_STABLE_APPLE_ABI
|
||||
|
||||
// template <> class ctype_byname<char>
|
||||
|
||||
ctype_byname<char>::ctype_byname(const char* name, size_t refs)
|
||||
@@ -1114,30 +1086,17 @@ ctype_byname<wchar_t>::~ctype_byname()
|
||||
bool
|
||||
ctype_byname<wchar_t>::do_is(mask m, char_type c) const
|
||||
{
|
||||
#ifdef _LIBCPP_WCTYPE_IS_MASK
|
||||
return static_cast<bool>(iswctype_l(c, m, __l));
|
||||
#else
|
||||
if (m & space && !iswspace_l(c, __l)) return false;
|
||||
if (m & print && !iswprint_l(c, __l)) return false;
|
||||
if (m & cntrl && !iswcntrl_l(c, __l)) return false;
|
||||
if (m & upper && !iswupper_l(c, __l)) return false;
|
||||
if (m & lower && !iswlower_l(c, __l)) return false;
|
||||
if (m & alpha && !iswalpha_l(c, __l)) return false;
|
||||
if (m & digit && !iswdigit_l(c, __l)) return false;
|
||||
if (m & punct && !iswpunct_l(c, __l)) return false;
|
||||
if (m & xdigit && !iswxdigit_l(c, __l)) return false;
|
||||
if (m & blank && !iswblank_l(c, __l)) return false;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
const wchar_t*
|
||||
ctype_byname<wchar_t>::do_is(const char_type* low, const char_type* high, mask* vec) const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
for (; low != high; ++low, ++vec)
|
||||
{
|
||||
if (isascii(*low))
|
||||
*vec = static_cast<mask>(ctype<char>::classic_table()[*low]);
|
||||
*vec = static_cast<mask>(_DefaultRuneLocale.__runetype[*low]);
|
||||
else
|
||||
{
|
||||
*vec = 0;
|
||||
@@ -1162,30 +1121,17 @@ ctype_byname<wchar_t>::do_is(const char_type* low, const char_type* high, mask*
|
||||
}
|
||||
}
|
||||
return low;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
const wchar_t*
|
||||
ctype_byname<wchar_t>::do_scan_is(mask m, const char_type* low, const char_type* high) const
|
||||
{
|
||||
for (; low != high; ++low)
|
||||
{
|
||||
#ifdef _LIBCPP_WCTYPE_IS_MASK
|
||||
if (iswctype_l(*low, m, __l))
|
||||
break;
|
||||
#else
|
||||
if (m & space && !iswspace_l(*low, __l)) continue;
|
||||
if (m & print && !iswprint_l(*low, __l)) continue;
|
||||
if (m & cntrl && !iswcntrl_l(*low, __l)) continue;
|
||||
if (m & upper && !iswupper_l(*low, __l)) continue;
|
||||
if (m & lower && !iswlower_l(*low, __l)) continue;
|
||||
if (m & alpha && !iswalpha_l(*low, __l)) continue;
|
||||
if (m & digit && !iswdigit_l(*low, __l)) continue;
|
||||
if (m & punct && !iswpunct_l(*low, __l)) continue;
|
||||
if (m & xdigit && !iswxdigit_l(*low, __l)) continue;
|
||||
if (m & blank && !iswblank_l(*low, __l)) continue;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return low;
|
||||
}
|
||||
|
||||
@@ -1193,24 +1139,8 @@ const wchar_t*
|
||||
ctype_byname<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high) const
|
||||
{
|
||||
for (; low != high; ++low)
|
||||
{
|
||||
#ifdef _LIBCPP_WCTYPE_IS_MASK
|
||||
if (!iswctype_l(*low, m, __l))
|
||||
break;
|
||||
#else
|
||||
if (m & space && iswspace_l(*low, __l)) continue;
|
||||
if (m & print && iswprint_l(*low, __l)) continue;
|
||||
if (m & cntrl && iswcntrl_l(*low, __l)) continue;
|
||||
if (m & upper && iswupper_l(*low, __l)) continue;
|
||||
if (m & lower && iswlower_l(*low, __l)) continue;
|
||||
if (m & alpha && iswalpha_l(*low, __l)) continue;
|
||||
if (m & digit && iswdigit_l(*low, __l)) continue;
|
||||
if (m & punct && iswpunct_l(*low, __l)) continue;
|
||||
if (m & xdigit && iswxdigit_l(*low, __l)) continue;
|
||||
if (m & blank && iswblank_l(*low, __l)) continue;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return low;
|
||||
}
|
||||
|
||||
|
@@ -28,9 +28,6 @@
|
||||
__attribute__((__weak__, __visibility__("default")))
|
||||
void *
|
||||
operator new(std::size_t size)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
{
|
||||
if (size == 0)
|
||||
size = 1;
|
||||
@@ -74,9 +71,6 @@ operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
|
||||
__attribute__((__weak__, __visibility__("default")))
|
||||
void*
|
||||
operator new[](size_t size)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
{
|
||||
return ::operator new(size);
|
||||
}
|
||||
|
Reference in New Issue
Block a user