Browse Source

cmMakefile: Replace two loops with std::replace.

Stephen Kelly 10 years ago
parent
commit
ee269f4f16
1 changed files with 2 additions and 13 deletions
  1. 2 13
      Source/cmMakefile.cxx

+ 2 - 13
Source/cmMakefile.cxx

@@ -1341,19 +1341,8 @@ void cmMakefile::AddDefineFlag(const char* flag, std::string& dflags)
 {
   // remove any \n\r
   std::string ret = flag;
-  std::string::size_type pos = 0;
-  while((pos = ret.find('\n', pos)) != std::string::npos)
-    {
-    ret[pos] = ' ';
-    pos++;
-    }
-  pos = 0;
-  while((pos = ret.find('\r', pos)) != std::string::npos)
-    {
-    ret[pos] = ' ';
-    pos++;
-    }
-
+  std::replace(ret.begin(), ret.end(), '\n', ' ');
+  std::replace(ret.begin(), ret.end(), '\r', ' ');
   dflags += " ";
   dflags += ret;
 }