summaryrefslogtreecommitdiffstats
path: root/Source/cmCTest.cxx
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2020-03-21 11:57:29 (GMT)
committerRolf Eike Beer <eike@sf-mail.de>2020-03-24 16:50:37 (GMT)
commit8ca2504a4d65f433f88ffb79331cea950789152d (patch)
tree82cdd893b2457ab1886bccd3ca9c30361e0bc854 /Source/cmCTest.cxx
parent761f1adcae026c6fd9e10dafdde679adbfaf5869 (diff)
downloadCMake-8ca2504a4d65f433f88ffb79331cea950789152d.zip
CMake-8ca2504a4d65f433f88ffb79331cea950789152d.tar.gz
CMake-8ca2504a4d65f433f88ffb79331cea950789152d.tar.bz2
use string_views to avoid memory allocations
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r--Source/cmCTest.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 72ec1b5..01c5131 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -17,6 +17,7 @@
#include <vector>
#include <cm/memory>
+#include <cm/string_view>
#include <cmext/algorithm>
#include "cmsys/Base64.h"
@@ -2046,13 +2047,15 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
return true;
}
- const std::string noTestsPrefix = "--no-tests=";
+ cm::string_view noTestsPrefix = "--no-tests=";
if (cmHasPrefix(arg, noTestsPrefix)) {
- const std::string noTestsMode = arg.substr(noTestsPrefix.length());
+ cm::string_view noTestsMode =
+ cm::string_view(arg).substr(noTestsPrefix.length());
if (noTestsMode == "error") {
this->Impl->NoTestsMode = cmCTest::NoTests::Error;
} else if (noTestsMode != "ignore") {
- errormsg = "'--no-tests=' given unknown value '" + noTestsMode + "'";
+ errormsg =
+ cmStrCat("'--no-tests=' given unknown value '", noTestsMode, '\'');
return false;
} else {
this->Impl->NoTestsMode = cmCTest::NoTests::Ignore;