cmSourceFileLocation: Avoid string allocation in extension checking
The substr call was causing excess allocations. Swap the cheaper character check to be before the longer string comparison, now using the prefix checking function.
This commit is contained in:
parent
bb1c41a085
commit
5554910ec2
|
@ -183,8 +183,9 @@ cmSourceFileLocation
|
|||
// Check if loc's name could possibly be extended to our name by
|
||||
// adding an extension.
|
||||
if(!(this->Name.size() > loc.Name.size() &&
|
||||
this->Name.substr(0, loc.Name.size()) == loc.Name &&
|
||||
this->Name[loc.Name.size()] == '.'))
|
||||
this->Name[loc.Name.size()] == '.' &&
|
||||
cmHasLiteralPrefixImpl(this->Name.c_str(),
|
||||
loc.Name.c_str(), loc.Name.size())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue