Don't call strlen in StringRef when the length was already passed

This commit is contained in:
Martin Hořeňovský 2017-11-13 12:03:45 +01:00
parent 3537b7858f
commit e7c23b73da
1 changed files with 12 additions and 16 deletions

View File

@ -53,11 +53,7 @@ namespace Catch {
StringRef::StringRef( char const* rawChars, size_type size ) noexcept
: m_start( rawChars ),
m_size( size )
{
size_type rawSize = rawChars == nullptr ? 0 : static_cast<size_type>( std::strlen( rawChars ) );
if( rawSize < size )
m_size = rawSize;
}
{}
StringRef::StringRef( std::string const& stdString ) noexcept
: m_start( stdString.c_str() ),