diff --git a/libcxx/include/__string/char_traits.h b/libcxx/include/__string/char_traits.h index 60ec186ead826..86c92477cbfeb 100644 --- a/libcxx/include/__string/char_traits.h +++ b/libcxx/include/__string/char_traits.h @@ -132,8 +132,6 @@ struct char_traits { static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT { - if (__n == 0) - return nullptr; return std::__constexpr_memchr(__s, __a, __n); } @@ -250,8 +248,6 @@ struct char_traits : __char_traits_base::length(const template inline _SizeT _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI __str_find(const _CharT* __p, _SizeT __sz, _CharT __c, _SizeT __pos) _NOEXCEPT { - if (__pos >= __sz) + if (__pos > __sz) return __npos; const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c); if (__r == nullptr)