update(falco): use std::include for readability

Signed-off-by: Luca Guerra <luca@guerra.sh>
This commit is contained in:
Luca Guerra
2024-09-13 13:26:41 +00:00
committed by poiana
parent a2336f186e
commit 5c959d0b1b

View File

@@ -502,18 +502,10 @@ void rule_loader::compiler::compile_rule_infos(
continue; continue;
} }
if (extra.m_tags.size() != 0) if (!std::includes(r.tags.begin(), r.tags.end(),
extra.m_tags.begin(), extra.m_tags.end()))
{ {
std::set<std::string> intersect; continue;
set_intersection(extra.m_tags.begin(), extra.m_tags.end(),
r.tags.begin(), r.tags.end(),
inserter(intersect, intersect.begin()));
if (intersect.size() != extra.m_tags.size())
{
continue;
}
} }
if (extra.m_rule != "" && r.name != extra.m_rule) if (extra.m_rule != "" && r.name != extra.m_rule)
@@ -551,18 +543,10 @@ void rule_loader::compiler::compile_rule_infos(
continue; continue;
} }
if (extra.m_tags.size() != 0) if (!std::includes(r.tags.begin(), r.tags.end(),
extra.m_tags.begin(), extra.m_tags.end()))
{ {
std::set<std::string> intersect; continue;
set_intersection(extra.m_tags.begin(), extra.m_tags.end(),
r.tags.begin(), r.tags.end(),
inserter(intersect, intersect.begin()));
if (intersect.size() != extra.m_tags.size())
{
continue;
}
} }
if (extra.m_rule != "" && r.name != extra.m_rule) if (extra.m_rule != "" && r.name != extra.m_rule)