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

This commit is contained in:
Bill Hoffman 2005-04-12 13:26:08 -04:00
parent 266d5d16df
commit a3d1de8cd2

View File

@ -83,9 +83,9 @@ bool cmCacheManager::ParseEntry(const char* entry,
std::string& value) std::string& value)
{ {
// input line is: key:type=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 // 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; bool flag = false;
if(regQuoted.find(entry)) if(regQuoted.find(entry))
{ {
@ -120,9 +120,9 @@ bool cmCacheManager::ParseEntry(const char* entry,
CacheEntryType& type) CacheEntryType& type)
{ {
// input line is: key:type=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 // 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; bool flag = false;
if(regQuoted.find(entry)) if(regQuoted.find(entry))
{ {