From 5c959d0b1b8f26a12432595f77720206c8b034af Mon Sep 17 00:00:00 2001 From: Luca Guerra Date: Fri, 13 Sep 2024 13:26:41 +0000 Subject: [PATCH] update(falco): use std::include for readability Signed-off-by: Luca Guerra --- userspace/engine/rule_loader_compiler.cpp | 28 +++++------------------ 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/userspace/engine/rule_loader_compiler.cpp b/userspace/engine/rule_loader_compiler.cpp index a370176d434..14ad031b0a5 100644 --- a/userspace/engine/rule_loader_compiler.cpp +++ b/userspace/engine/rule_loader_compiler.cpp @@ -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 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) @@ -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 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)