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
1 changed files with 4 additions and 4 deletions

View File

@ -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))
{