Commit 0c73273b authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'dev/static-regex'

1b003c1f cmTarget: Remove an unused variable
7492a7b8 regex: Search on strings where possible
3e7194a2 regex: Use static regexs where possible
parents 58f8e6bc 1b003c1f
......@@ -588,8 +588,8 @@ void cmCPackNSISGenerator::CreateMenuLinks( cmOStringStream& str,
return;
}
cmsys::RegularExpression urlRegex;
urlRegex.compile("^(mailto:|(ftps?|https?|news)://).*$");
static cmsys::RegularExpression
urlRegex("^(mailto:|(ftps?|https?|news)://).*$");
std::vector<std::string>::iterator it;
for ( it = cpackMenuLinksVector.begin();
......
......@@ -1811,7 +1811,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath)
}
}
is_shared_library = this->ExtractSharedLibraryName.find(file.c_str());
is_shared_library = this->ExtractSharedLibraryName.find(file);
if(!is_shared_library)
{
......@@ -1831,8 +1831,8 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath)
{
if(fullPath.find(".framework") != std::string::npos)
{
cmsys::RegularExpression splitFramework;
splitFramework.compile("^(.*)/(.*).framework/(.*)$");
static cmsys::RegularExpression
splitFramework("^(.*)/(.*).framework/(.*)$");
if(splitFramework.find(fullPath) &&
(std::string::npos !=
splitFramework.match(3).find(splitFramework.match(2))))
......
......@@ -469,12 +469,11 @@ std::string::size_type cmGeneratorExpression::Find(const std::string &input)
//----------------------------------------------------------------------------
bool cmGeneratorExpression::IsValidTargetName(const std::string &input)
{
cmsys::RegularExpression targetNameValidator;
// The ':' is supported to allow use with IMPORTED targets. At least
// Qt 4 and 5 IMPORTED targets use ':' as the namespace delimiter.
targetNameValidator.compile("^[A-Za-z0-9_.:+-]+$");
static cmsys::RegularExpression targetNameValidator("^[A-Za-z0-9_.:+-]+$");
return targetNameValidator.find(input.c_str());
return targetNameValidator.find(input);
}
//----------------------------------------------------------------------------
......
......@@ -401,9 +401,8 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
{
return compilerId ? compilerId : "";
}
cmsys::RegularExpression compilerIdValidator;
compilerIdValidator.compile("^[A-Za-z0-9_]*$");
if (!compilerIdValidator.find(parameters.begin()->c_str()))
static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$");
if (!compilerIdValidator.find(*parameters.begin()))
{
reportError(context, content->GetOriginalExpression(),
"Expression syntax not recognized.");
......@@ -509,9 +508,8 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode
return compilerVersion ? compilerVersion : "";
}
cmsys::RegularExpression compilerIdValidator;
compilerIdValidator.compile("^[0-9\\.]*$");
if (!compilerIdValidator.find(parameters.begin()->c_str()))
static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$");
if (!compilerIdValidator.find(*parameters.begin()))
{
reportError(context, content->GetOriginalExpression(),
"Expression syntax not recognized.");
......@@ -711,9 +709,8 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
{
return configurationNode.Evaluate(parameters, context, content, 0);
}
cmsys::RegularExpression configValidator;
configValidator.compile("^[A-Za-z0-9_]*$");
if (!configValidator.find(parameters.begin()->c_str()))
static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$");
if (!configValidator.find(*parameters.begin()))
{
reportError(context, content->GetOriginalExpression(),
"Expression syntax not recognized.");
......@@ -884,8 +881,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
"$<TARGET_PROPERTY:...> expression requires one or two parameters");
return std::string();
}
cmsys::RegularExpression propertyNameValidator;
propertyNameValidator.compile("^[A-Za-z0-9_]+$");
static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$");
cmTarget const* target = context->HeadTarget;
std::string propertyName = *parameters.begin();
......@@ -973,7 +969,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return std::string();
}
if (!propertyNameValidator.find(propertyName.c_str()))
if (!propertyNameValidator.find(propertyName))
{
::reportError(context, content->GetOriginalExpression(),
"Property name not supported.");
......
......@@ -39,8 +39,8 @@ public:
if(file.rfind(".framework") != std::string::npos)
{
cmsys::RegularExpression splitFramework;
splitFramework.compile("^(.*)/(.*).framework/(.*)$");
static cmsys::RegularExpression
splitFramework("^(.*)/(.*).framework/(.*)$");
if(splitFramework.find(file) &&
(std::string::npos !=
splitFramework.match(3).find(splitFramework.match(2))))
......@@ -326,8 +326,8 @@ void cmOrderDirectories::AddRuntimeLibrary(std::string const& fullPath,
if(fullPath.rfind(".framework") != std::string::npos)
{
cmsys::RegularExpression splitFramework;
splitFramework.compile("^(.*)/(.*).framework/(.*)$");
static cmsys::RegularExpression
splitFramework("^(.*)/(.*).framework/(.*)$");
if(splitFramework.find(fullPath) &&
(std::string::npos !=
splitFramework.match(3).find(splitFramework.match(2))))
......
......@@ -6145,7 +6145,6 @@ void processILibs(const std::string& config,
if (emitted.insert(tgt).second)
{
tgts.push_back(tgt);
std::vector<std::string> ilibs;
cmTarget::LinkInterface const* iface =
tgt->GetLinkInterfaceLibraries(config, headTarget);
if (iface)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment