Having default actions as o shared pointer

This commit is contained in:
Felipe Zimmerle
2019-01-22 09:15:29 -03:00
parent 9d158611cf
commit 6b0ad8049a
5 changed files with 775 additions and 776 deletions

View File

@@ -33,7 +33,7 @@ bool Block::evaluate(Rule *rule, Transaction *transaction,
std::shared_ptr<RuleMessage> rm) {
ms_dbg_a(transaction, 8, "Marking request as disruptive.");
for (Action *a : transaction->m_rules->m_defaultActions[rule->m_phase]) {
for (auto &a : transaction->m_rules->m_defaultActions[rule->m_phase]) {
if (a->isDisruptive() == false) {
continue;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1194,7 +1194,8 @@ expression:
}
for (actions::Action *a : checkedActions) {
driver.m_defaultActions[definedPhase].push_back(a);
driver.m_defaultActions[definedPhase].push_back(
std::unique_ptr<actions::Action>(a));
}
delete actions;

View File

@@ -389,13 +389,13 @@ std::list<std::pair<std::shared_ptr<std::string>,
// Notice that first we make sure that won't be a t:none
// on the target rule.
if (none == 0) {
for (Action *a : trans->m_rules->m_defaultActions[this->m_phase]) {
for (auto &a : trans->m_rules->m_defaultActions[this->m_phase]) {
if (a->action_kind \
!= actions::Action::RunTimeBeforeMatchAttemptKind) {
continue;
}
executeTransformation(a, &value, trans, &ret, &path,
executeTransformation(a.get(), &value, trans, &ret, &path,
&transformations);
}
}
@@ -570,12 +570,12 @@ void Rule::executeActionsAfterFullMatch(Transaction *trans,
bool containsBlock, std::shared_ptr<RuleMessage> ruleMessage) {
bool disruptiveAlreadyExecuted = false;
for (Action *a : trans->m_rules->m_defaultActions[this->m_phase]) {
if (a->action_kind != actions::Action::RunTimeOnlyIfMatchKind) {
for (auto &a : trans->m_rules->m_defaultActions[this->m_phase]) {
if (a.get()->action_kind != actions::Action::RunTimeOnlyIfMatchKind) {
continue;
}
if (!a->isDisruptive()) {
executeAction(trans, containsBlock, ruleMessage, a, true);
if (!a.get()->isDisruptive()) {
executeAction(trans, containsBlock, ruleMessage, a.get(), true);
}
}