Merge topic 'string-prefix'

ec7928ef26 use _s to construct static string_views at several places
94de927cab VS10Generator: avoid many string allocations
8ca2504a4d use string_views to avoid memory allocations
761f1adcae check for a valid URL scheme before starting to do any splitting
ef778d77e0 replace std::string::substr() with operations that do not allocate memory
77616f4681 pass cm::string_view to cmVisualStudioSlnParser::ParseTag()
ada6a3226f use cm::string_view for language extension lookups
48adc29721 replace "std::string::find(x) == 0" with cmHasPrefix()
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4501
This commit is contained in:
Brad King
2020-03-26 13:15:02 +00:00
committed by Kitware Robot
62 changed files with 493 additions and 515 deletions
@@ -32,14 +32,14 @@ void compare(const char* refName, const char* testName)
// trailing null to the string that we need to strip before testing for a
// trailing space.
if (refLine.size() && refLine[refLine.size() - 1] == 0) {
refLine = refLine.substr(0, refLine.size() - 1);
refLine.resize(refLine.size() - 1);
}
if (testLine.size() && testLine[testLine.size() - 1] == 0) {
testLine = testLine.substr(0, testLine.size() - 1);
testLine.resize(testLine.size() - 1);
}
// The reference files never have trailing spaces:
if (testLine.size() && testLine[testLine.size() - 1] == ' ') {
testLine = testLine.substr(0, testLine.size() - 1);
testLine.resize(testLine.size() - 1);
}
if (refLine != testLine) {
std::cout << "Ref and test are not the same:\n Ref: \"" << refLine