diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:30 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:30 +0000 |
commit | 243a6be085fe6a7ce49169864c68a8839735e49b (patch) | |
tree | abfecf3c23dc7512ca48e72ac418b149c865e0f3 /include/__string | |
parent | 1147845301c03308e3419b89c28c77bb6917fe04 (diff) |
Notes
Diffstat (limited to 'include/__string')
-rw-r--r-- | include/__string | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/__string b/include/__string index a88b976be3c9..b4c8815f72d2 100644 --- a/include/__string +++ b/include/__string @@ -351,6 +351,18 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size #endif } + +template <class _Traits> +_LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR +inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT { +#if _LIBCPP_DEBUG_LEVEL >= 1 + return __s ? _Traits::length(__s) : (_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0); +#else + return _Traits::length(__s); +#endif +} + inline _LIBCPP_CONSTEXPR_AFTER_CXX14 size_t char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT |