From 59af8ab842b09b436041b66bb9f58eb433d8207c Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Tue, 20 Oct 2015 16:05:50 -0300 Subject: [PATCH] Cosmetics: fixed the coding style --- src/actions/redirect.cc | 2 +- src/actions/set_var.cc | 3 ++- src/operators/ip_match.h | 2 +- src/operators/pm.h | 2 +- src/rule.cc | 3 ++- src/rule.h | 3 +-- src/utils.cc | 6 +++--- src/utils/regex.cc | 3 ++- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/actions/redirect.cc b/src/actions/redirect.cc index 0232d92a..f3696b9d 100644 --- a/src/actions/redirect.cc +++ b/src/actions/redirect.cc @@ -30,7 +30,7 @@ Redirect::~Redirect() { Redirect::Redirect(const std::string& action) : Action(action, RunTimeOnlyIfMatchKind), m_url(action) { - //m_url = m_url.erase(0, 9); + // m_url = m_url.erase(0, 9); if (m_url.at(0) == '\'') { m_url.erase(0, 1); if (m_url.size() > 0) { diff --git a/src/actions/set_var.cc b/src/actions/set_var.cc index b45f9523..e6cb416a 100644 --- a/src/actions/set_var.cc +++ b/src/actions/set_var.cc @@ -102,7 +102,8 @@ void SetVar::dump() { bool SetVar::evaluate(Rule *rule, Assay *assay) { std::string targetValue; int value = 0; - std::string variableNameExpanded = MacroExpansion::expand(variableName, assay); + std::string variableNameExpanded = MacroExpansion::expand(variableName, + assay); std::string resolvedPre = MacroExpansion::expand(predicate, assay); if (operation == setOperation) { diff --git a/src/operators/ip_match.h b/src/operators/ip_match.h index cf8f13f9..4413c473 100644 --- a/src/operators/ip_match.h +++ b/src/operators/ip_match.h @@ -33,7 +33,7 @@ class IpMatch : public Operator { bool evaluate(Assay *assay, const std::string &input) override; - virtual bool init(const std::string &file, const char **error) override; + bool init(const std::string &file, const char **error) override; protected: Utils::IpTree m_tree; diff --git a/src/operators/pm.h b/src/operators/pm.h index c824ad31..95a14cec 100644 --- a/src/operators/pm.h +++ b/src/operators/pm.h @@ -39,7 +39,7 @@ class Pm : public Operator { const std::string& to); bool evaluate(Assay *assay, const std::string &input) override; - virtual bool init(const std::string &file, const char **error) override; + bool init(const std::string &file, const char **error) override; void postOrderTraversal(acmp_btree_node_t *node); std::list matched; diff --git a/src/rule.cc b/src/rule.cc index 919d485b..45b9fe11 100644 --- a/src/rule.cc +++ b/src/rule.cc @@ -107,7 +107,8 @@ Rule::Rule(Operator *_op, if (a->action_kind == Action::ConfigurationKind) { actions_conf.push_back(a); a->evaluate(this, NULL); - } else if (a->action_kind == Action::RunTimeBeforeMatchAttemptKind) { + } else if (a->action_kind + == Action::RunTimeBeforeMatchAttemptKind) { actions_runtime_pre.push_back(a); } else if (a->action_kind == Action::RunTimeOnlyIfMatchKind) { actions_runtime_pos.push_back(a); diff --git a/src/rule.h b/src/rule.h index d5f7a58d..a7a305a0 100644 --- a/src/rule.h +++ b/src/rule.h @@ -35,8 +35,7 @@ class Rule { std::vector *_variables, std::vector *_actions, std::string fileName, - int lineNumber - ); + int lineNumber); explicit Rule(std::string marker); ~Rule(); diff --git a/src/utils.cc b/src/utils.cc index bbe0818b..d8ee03cc 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -1023,8 +1023,7 @@ std::string toHexIfNeeded(const std::string &str) { } -std::vector expandEnv(const std::string& var, int flags) -{ +std::vector expandEnv(const std::string& var, int flags) { std::vector vars; wordexp_t p; @@ -1052,7 +1051,8 @@ std::string get_path(const std::string& file) { } -std::string find_resource(const std::string& resource, const std::string& config) { +std::string find_resource(const std::string& resource, + const std::string& config) { std::ifstream *iss = NULL; // Trying absolute or relative to the current dir. diff --git a/src/utils/regex.cc b/src/utils/regex.cc index 7cf660e8..e453b35e 100644 --- a/src/utils/regex.cc +++ b/src/utils/regex.cc @@ -52,7 +52,8 @@ int regex_search(const std::string& s, SMatch *match, s.size(), 0, 0, ovector, OVECCOUNT) > 0; if (ret > 0) { - match->match = std::string(s, ovector[ret-1], ovector[ret] - ovector[ret-1]); + match->match = std::string(s, ovector[ret-1], + ovector[ret] - ovector[ret-1]); match->size_ = ret; }