소스 검색

cmComputeLinkInformation: reserve space in built-up string

This should avoid any reallocations that would occur in this function.
Ben Boeckel 5 년 전
부모
커밋
609c3b7cdc
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  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 == '.') {