Przeglądaj źródła

Replace 'foo.length() >= 1' pattern with !foo.empty()

Stephen Kelly 10 lat temu
rodzic
commit
fd0c036c0c
2 zmienionych plików z 2 dodań i 2 usunięć
  1. 1 1
      Source/cmFileCommand.cxx
  2. 1 1
      Source/cmake.cxx

+ 1 - 1
Source/cmFileCommand.cxx

@@ -745,7 +745,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
       // A non-string character has been found.  Check if the current
       // string matches the requirements.  We require that the length
       // be at least one no matter what the user specified.
-      if(s.length() >= minlen && s.length() >= 1 &&
+      if(s.length() >= minlen && !s.empty() &&
       (!have_regex || regex.find(s.c_str())))
         {
         output_size += static_cast<int>(s.size()) + 1;

+ 1 - 1
Source/cmake.cxx

@@ -2531,7 +2531,7 @@ static bool cmakeCheckStampFile(const char* stampName)
   while(cmSystemTools::GetLineFromStream(fin, dep))
     {
     int result;
-    if(dep.length() >= 1 && dep[0] != '#' &&
+    if(!dep.empty() && dep[0] != '#' &&
        (!ftc.FileTimeCompare(stampDepends.c_str(), dep.c_str(), &result)
         || result < 0))
       {