Browse Source

ENH: reduce string construct delete ops

Ken Martin 19 years ago
parent
commit
c88c75b8f2
4 changed files with 14 additions and 14 deletions
  1. 3 3
      Source/cmForEachCommand.cxx
  2. 5 5
      Source/cmIfCommand.cxx
  3. 3 3
      Source/cmMacroCommand.cxx
  4. 3 3
      Source/cmWhileCommand.cxx

+ 3 - 3
Source/cmForEachCommand.cxx

@@ -26,12 +26,12 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
     return false;
     }
 
-  if (cmSystemTools::LowerCase(lff.Name) == "foreach")
+  if (!cmSystemTools::Strucmp(lff.Name.c_str(),"foreach"))
     {
     // record the number of nested foreach commands
     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->Depth) 
@@ -81,7 +81,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
 bool cmForEachFunctionBlocker::
 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;
     mf.ExpandArguments(lff.Arguments, expandedArguments);

+ 5 - 5
Source/cmIfCommand.cxx

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

+ 3 - 3
Source/cmMacroCommand.cxx

@@ -252,11 +252,11 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
 {
   // record commands until we hit the ENDMACRO
   // 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++;
     }
-  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->Depth) 
@@ -300,7 +300,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
 bool cmMacroFunctionBlocker::
 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;
     mf.ExpandArguments(lff.Arguments, expandedArguments);

+ 3 - 3
Source/cmWhileCommand.cxx

@@ -28,12 +28,12 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
     }
   
   // 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
     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->Depth) 
@@ -78,7 +78,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
 bool cmWhileFunctionBlocker::
 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
         || mf.IsOn("CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS"))