Skip to content

Commit 5497b86

Browse files
committed
Added plus condition to prevent the unnecessary loops
1 parent ebdb36b commit 5497b86

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/rules.cc

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,17 +239,19 @@ int Rules::evaluate(int phase, Transaction *t) {
239239
}
240240
}
241241

242-
for (auto &z : t->m_ruleRemoveByTag) {
243-
if (rule->containsTag(z, t) == true) {
244-
ms_dbg_a(t, 9, "Skipped rule id '" \
245-
+ std::to_string(rule->m_ruleId) \
246-
+ "'. Skipped due to a ruleRemoveByTag action.");
247-
remove_rule = true;
248-
break;
242+
if (t->m_ruleRemoveByTag.empty() == false) {
243+
for (auto &z : t->m_ruleRemoveByTag) {
244+
if (rule->containsTag(z, t) == true) {
245+
ms_dbg_a(t, 9, "Skipped rule id '" \
246+
+ std::to_string(rule->m_ruleId) \
247+
+ "'. Skipped due to a ruleRemoveByTag action.");
248+
remove_rule = true;
249+
break;
250+
}
251+
}
252+
if (remove_rule) {
253+
continue;
249254
}
250-
}
251-
if (remove_rule) {
252-
continue;
253255
}
254256

255257
rule->evaluate(t, NULL);

0 commit comments

Comments
 (0)