Skip to content

Commit

Permalink
update(falco): use std::include for readability
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Guerra <[email protected]>
  • Loading branch information
LucaGuerra authored and poiana committed Sep 13, 2024
1 parent a2336f1 commit 5c959d0
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions userspace/engine/rule_loader_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,18 +502,10 @@ void rule_loader::compiler::compile_rule_infos(
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;

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;
}
continue;
}

if (extra.m_rule != "" && r.name != extra.m_rule)
Expand Down Expand Up @@ -551,18 +543,10 @@ void rule_loader::compiler::compile_rule_infos(
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;

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;
}
continue;
}

if (extra.m_rule != "" && r.name != extra.m_rule)
Expand Down

0 comments on commit 5c959d0

Please sign in to comment.