Skip to content

Commit 7ec50eb

Browse files
committed
Make GeoLookup::debug function static (and non-member), as suggested by cppcheck.
1 parent 4e68edf commit 7ec50eb

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

src/operators/geo_lookup.cc

+10-6
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@
3030
#include "src/utils/geo_lookup.h"
3131

3232

33-
namespace modsecurity {
34-
namespace operators {
33+
namespace modsecurity::operators {
34+
35+
36+
static bool debug(const Transaction *transaction, int x, const std::string &a) {
37+
ms_dbg_a(transaction, x, a);
38+
return true;
39+
}
3540

3641

3742
bool GeoLookup::evaluate(Transaction *trans, const std::string &exp) {
@@ -41,15 +46,14 @@ bool GeoLookup::evaluate(Transaction *trans, const std::string &exp) {
4146

4247
if (trans) {
4348
ret = Utils::GeoLookup::getInstance().lookup(exp, trans,
44-
std::bind(&GeoLookup::debug, this, trans, _1, _2));
49+
std::bind(debug, trans, _1, _2));
4550
} else {
46-
ret = Utils::GeoLookup::getInstance().lookup(exp, NULL,
51+
ret = Utils::GeoLookup::getInstance().lookup(exp, nullptr,
4752
nullptr);
4853
}
4954

5055
return ret;
5156
}
5257

5358

54-
} // namespace operators
55-
} // namespace modsecurity
59+
} // namespace modsecurity::operators

src/operators/geo_lookup.h

+4-11
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,19 @@
2121
#include "src/operators/operator.h"
2222

2323

24-
namespace modsecurity {
25-
namespace operators {
24+
namespace modsecurity::operators {
25+
2626

2727
class GeoLookup : public Operator {
2828
public:
2929
/** @ingroup ModSecurity_Operator */
3030
GeoLookup()
3131
: Operator("GeoLookup") { }
3232
bool evaluate(Transaction *transaction, const std::string &exp) override;
33-
34-
protected:
35-
// cppcheck-suppress functionStatic
36-
bool debug(const Transaction *transaction, int x, const std::string &a) {
37-
ms_dbg_a(transaction, x, a);
38-
return true;
39-
}
4033
};
4134

42-
} // namespace operators
43-
} // namespace modsecurity
35+
36+
} // namespace modsecurity::operators
4437

4538

4639
#endif // SRC_OPERATORS_GEO_LOOKUP_H_

0 commit comments

Comments
 (0)