diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-30 16:58:57 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-30 16:58:57 (GMT) |
commit | fd22157e554a3f71eceec83dde1070ce76071e0d (patch) | |
tree | 8ae7be2189e1dd1467bf387eb1e3b0eb4199d3f3 /Source/cmMakefile.cxx | |
parent | 42b7d859ad3eda64abbc2388a2d016309559c435 (diff) | |
download | CMake-fd22157e554a3f71eceec83dde1070ce76071e0d.zip CMake-fd22157e554a3f71eceec83dde1070ce76071e0d.tar.gz CMake-fd22157e554a3f71eceec83dde1070ce76071e0d.tar.bz2 |
ENH: improve speed of GetSource function
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index db4a7e5..610c294 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1310,11 +1310,19 @@ cmData* cmMakefile::LookupData(const char* name) const cmSourceFile* cmMakefile::GetSource(const char* sourceName) { + std::string s = sourceName; + std::string ext; + std::string::size_type pos = s.rfind('.'); + if(pos != std::string::npos) + { + ext = s.substr(pos+1, s.size() - pos-1); + s = s.substr(0, pos); + } for(std::vector<cmSourceFile*>::iterator i = m_SourceFiles.begin(); i != m_SourceFiles.end(); ++i) { - if((*i)->GetSourceName() == sourceName - || (*i)->GetSourceName()+"."+(*i)->GetSourceExtension() == sourceName) + if((*i)->GetSourceName() == s + && (ext.size() == 0 || (ext == (*i)->GetSourceExtension()))) { return *i; } |