Use StringRef for Opt's optNames

Removes another ~70 allocations.
This commit is contained in:
Martin Hořeňovský committed 2023-12-26 16:03:22 +01:00
1 parent 5d5f42f99b
commit cd3c7ebe87
3 files changed
+13 -10

No files matched your search

+9 -6
View File
@@ -25,13 +25,16 @@ namespace {
;
}
std::string normaliseOpt( std::string const& optName ) {
#ifdef CATCH_PLATFORM_WINDOWS
if ( optName[0] == '/' )
return "-" + optName.substr( 1 );
else
Catch::StringRef normaliseOpt( Catch::StringRef optName ) {
if ( optName[0] == '-'
#if defined(CATCH_PLATFORM_WINDOWS)
|| optName[0] == '/'
#endif
return optName;
) {
return optName.substr( 1, optName.size() );
}
return optName;
}
} // namespace