minor perf improvement

This commit is contained in:
Ken Martin 2003-06-20 11:23:47 -04:00
parent c21ad62987
commit e9e312b441

View File

@ -1020,7 +1020,8 @@ void cmMakefile::AddUtilityCommand(const char* utilityName,
cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname) cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname)
{ {
std::string name = cname; std::string name = cname;
std::string out;
// look through all the source files that have custom commands // look through all the source files that have custom commands
// and see if the custom command has the passed source file as an output // and see if the custom command has the passed source file as an output
// keep in mind the possible .rule extension that may be tacked on // keep in mind the possible .rule extension that may be tacked on
@ -1031,7 +1032,7 @@ cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname)
if ((*i)->GetCustomCommand()) if ((*i)->GetCustomCommand())
{ {
// is the output of the custom command match the source files name // is the output of the custom command match the source files name
std::string out = (*i)->GetCustomCommand()->GetOutput(); out = (*i)->GetCustomCommand()->GetOutput();
if (out.rfind(name) != out.npos && if (out.rfind(name) != out.npos &&
out.rfind(name) == out.size() - name.size()) out.rfind(name) == out.size() - name.size())
{ {