ENH: reduce string construct delete ops

This commit is contained in:
Ken Martin 2006-05-31 11:19:39 -04:00
parent d9ae0aaa29
commit c88c75b8f2
4 changed files with 14 additions and 14 deletions

View File

@ -26,12 +26,12 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
return false; return false;
} }
if (cmSystemTools::LowerCase(lff.Name) == "foreach") if (!cmSystemTools::Strucmp(lff.Name.c_str(),"foreach"))
{ {
// record the number of nested foreach commands // record the number of nested foreach commands
this->Depth++; this->Depth++;
} }
else if (cmSystemTools::LowerCase(lff.Name) == "endforeach") else if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endforeach"))
{ {
// if this is the endofreach for this statement // if this is the endofreach for this statement
if (!this->Depth) if (!this->Depth)
@ -81,7 +81,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
bool cmForEachFunctionBlocker:: bool cmForEachFunctionBlocker::
ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf)
{ {
if(cmSystemTools::LowerCase(lff.Name) == "endforeach") if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endforeach"))
{ {
std::vector<std::string> expandedArguments; std::vector<std::string> expandedArguments;
mf.ExpandArguments(lff.Arguments, expandedArguments); mf.ExpandArguments(lff.Arguments, expandedArguments);

View File

@ -23,18 +23,18 @@ bool cmIfFunctionBlocker::
IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
{ {
// always let if statements through // always let if statements through
if (cmSystemTools::LowerCase(lff.Name) == "if") if (!cmSystemTools::Strucmp(lff.Name.c_str(),"if"))
{ {
return false; return false;
} }
// watch for our ELSE or ENDIF // watch for our ELSE or ENDIF
if (cmSystemTools::LowerCase(lff.Name) == "else" || if (!cmSystemTools::Strucmp(lff.Name.c_str(),"else") ||
cmSystemTools::LowerCase(lff.Name) == "endif") !cmSystemTools::Strucmp(lff.Name.c_str(),"endif"))
{ {
// if it was an else statement then we should change state // if it was an else statement then we should change state
// and block this Else Command // and block this Else Command
if (cmSystemTools::LowerCase(lff.Name) == "else") if (!cmSystemTools::Strucmp(lff.Name.c_str(),"else"))
{ {
this->IsBlocking = !this->IsBlocking; this->IsBlocking = !this->IsBlocking;
return true; return true;
@ -51,7 +51,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff, bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
cmMakefile& mf) cmMakefile& mf)
{ {
if (cmSystemTools::LowerCase(lff.Name) == "endif") if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endif"))
{ {
if (mf.IsOn("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS") if (mf.IsOn("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS")
|| lff.Arguments == this->Args) || lff.Arguments == this->Args)

View File

@ -252,11 +252,11 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
{ {
// record commands until we hit the ENDMACRO // record commands until we hit the ENDMACRO
// at the ENDMACRO call we shift gears and start looking for invocations // at the ENDMACRO call we shift gears and start looking for invocations
if(cmSystemTools::LowerCase(lff.Name) == "macro") if(!cmSystemTools::Strucmp(lff.Name.c_str(),"macro"))
{ {
this->Depth++; this->Depth++;
} }
else if(cmSystemTools::LowerCase(lff.Name) == "endmacro") else if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endmacro"))
{ {
// if this is the endmacro for this macro then execute // if this is the endmacro for this macro then execute
if (!this->Depth) if (!this->Depth)
@ -300,7 +300,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
bool cmMacroFunctionBlocker:: bool cmMacroFunctionBlocker::
ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf) ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf)
{ {
if(cmSystemTools::LowerCase(lff.Name) == "endmacro") if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endmacro"))
{ {
std::vector<std::string> expandedArguments; std::vector<std::string> expandedArguments;
mf.ExpandArguments(lff.Arguments, expandedArguments); mf.ExpandArguments(lff.Arguments, expandedArguments);

View File

@ -28,12 +28,12 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
} }
// at end of for each execute recorded commands // at end of for each execute recorded commands
if (cmSystemTools::LowerCase(lff.Name) == "while") if (!cmSystemTools::Strucmp(lff.Name.c_str(),"while"))
{ {
// record the number of while commands past this one // record the number of while commands past this one
this->Depth++; this->Depth++;
} }
else if (cmSystemTools::LowerCase(lff.Name) == "endwhile") else if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endwhile"))
{ {
// if this is the endwhile for this while loop then execute // if this is the endwhile for this while loop then execute
if (!this->Depth) if (!this->Depth)
@ -78,7 +78,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
bool cmWhileFunctionBlocker:: bool cmWhileFunctionBlocker::
ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf)
{ {
if(cmSystemTools::LowerCase(lff.Name) == "endwhile") if(!cmSystemTools::Strucmp(lff.Name.c_str(),"endwhile"))
{ {
if (lff.Arguments == this->Args if (lff.Arguments == this->Args
|| mf.IsOn("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS")) || mf.IsOn("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS"))