mirror of https://github.com/catchorg/Catch2.git
Don't call strlen in StringRef when the length was already passed
This commit is contained in:
parent
3537b7858f
commit
e7c23b73da
|
@ -53,11 +53,7 @@ namespace Catch {
|
||||||
StringRef::StringRef( char const* rawChars, size_type size ) noexcept
|
StringRef::StringRef( char const* rawChars, size_type size ) noexcept
|
||||||
: m_start( rawChars ),
|
: m_start( rawChars ),
|
||||||
m_size( size )
|
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
|
StringRef::StringRef( std::string const& stdString ) noexcept
|
||||||
: m_start( stdString.c_str() ),
|
: m_start( stdString.c_str() ),
|
||||||
|
|
Loading…
Reference in New Issue