summaryrefslogtreecommitdiffstats
path: root/Source/cmSourceFileLocation.cxx
diff options
context:
space:
mode:
authorBen Boeckel <mathstuf@gmail.com>2014-03-11 05:49:11 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2014-04-29 01:43:27 (GMT)
commitb4cb543e0c0648bbd3dbede91f864f89275417c4 (patch)
treec20ea2e4098ae1648d98eafe41aa5b270c38f546 /Source/cmSourceFileLocation.cxx
parente8e1f3a19fd07ba64381094b98c66f7d07c1746e (diff)
downloadCMake-b4cb543e0c0648bbd3dbede91f864f89275417c4.zip
CMake-b4cb543e0c0648bbd3dbede91f864f89275417c4.tar.gz
CMake-b4cb543e0c0648bbd3dbede91f864f89275417c4.tar.bz2
cmSourceFileLocation: Save some string copies
Diffstat (limited to 'Source/cmSourceFileLocation.cxx')
-rw-r--r--Source/cmSourceFileLocation.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 7837738..1c2454e 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -192,7 +192,7 @@ cmSourceFileLocation
// Only a fixed set of extensions will be tried to match a file on
// disk. One of these must match if loc refers to this source file.
- std::string ext = this->Name.substr(loc.Name.size()+1);
+ std::string const& ext = this->Name.substr(loc.Name.size()+1);
cmMakefile const* mf = this->Makefile;
const std::vector<std::string>& srcExts = mf->GetSourceExtensions();
if(std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end())
@@ -216,7 +216,7 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
// Both extensions are similarly ambiguous. Since only the old fixed set
// of extensions will be tried, the names must match at this point to be
// the same file.
- if(this->Name != loc.Name)
+ if(this->Name.size() != loc.Name.size() || this->Name != loc.Name)
{
return false;
}
@@ -278,10 +278,10 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
else if(this->AmbiguousDirectory)
{
// Compare possible directory combinations.
- std::string srcDir =
+ std::string const& srcDir =
cmSystemTools::CollapseFullPath(
this->Directory.c_str(), this->Makefile->GetCurrentDirectory());
- std::string binDir =
+ std::string const& binDir =
cmSystemTools::CollapseFullPath(
this->Directory.c_str(), this->Makefile->GetCurrentOutputDirectory());
if(srcDir != loc.Directory &&
@@ -293,10 +293,10 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
else if(loc.AmbiguousDirectory)
{
// Compare possible directory combinations.
- std::string srcDir =
+ std::string const& srcDir =
cmSystemTools::CollapseFullPath(
loc.Directory.c_str(), loc.Makefile->GetCurrentDirectory());
- std::string binDir =
+ std::string const& binDir =
cmSystemTools::CollapseFullPath(
loc.Directory.c_str(), loc.Makefile->GetCurrentOutputDirectory());
if(srcDir != this->Directory &&