Jelajahi Sumber

cmComputeLinkInformation: reserve space in built-up string

This should avoid any reallocations that would occur in this function.
Ben Boeckel 5 tahun lalu
induk
melakukan
609c3b7cdc
1 mengubah file dengan 1 tambahan dan 0 penghapusan
  1. 1 0
      Source/cmComputeLinkInformation.cxx

+ 1 - 0
Source/cmComputeLinkInformation.cxx

@@ -998,6 +998,7 @@ std::string cmComputeLinkInformation::CreateExtensionRegex(
 std::string cmComputeLinkInformation::NoCaseExpression(const char* str)
 {
   std::string ret;
+  ret.reserve(strlen(str) * 4);
   const char* s = str;
   while (*s) {
     if (*s == '.') {