소스 검색

ENH: make regex static so it is not recomputed for each line of the cache

Bill Hoffman 20 년 전
부모
커밋
a3d1de8cd2
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      Source/cmCacheManager.cxx

+ 4 - 4
Source/cmCacheManager.cxx

@@ -83,9 +83,9 @@ bool cmCacheManager::ParseEntry(const char* entry,
                                 std::string& value)
 {
   // input line is:         key:type=value
-  cmsys::RegularExpression reg("^([^:]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
+  static cmsys::RegularExpression reg("^([^:]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
   // input line is:         "key":type=value
-  cmsys::RegularExpression regQuoted("^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
+  static cmsys::RegularExpression regQuoted("^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
   bool flag = false;
   if(regQuoted.find(entry))
     {
@@ -120,9 +120,9 @@ bool cmCacheManager::ParseEntry(const char* entry,
                                 CacheEntryType& type)
 {
   // input line is:         key:type=value
-  cmsys::RegularExpression reg("^([^:]*):([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
+  static cmsys::RegularExpression reg("^([^:]*):([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
   // input line is:         "key":type=value
-  cmsys::RegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
+  static cmsys::RegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
   bool flag = false;
   if(regQuoted.find(entry))
     {