mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Cosmetics: coding style
This commit is contained in:
parent
ad28de4f14
commit
df3c3f62b7
@ -39,8 +39,7 @@ namespace Utils {
|
||||
|
||||
|
||||
Regex::Regex(const std::string& pattern_)
|
||||
: pattern(pattern_.empty() ? ".*" : pattern_)
|
||||
{
|
||||
: pattern(pattern_.empty() ? ".*" : pattern_) {
|
||||
const char *errptr = NULL;
|
||||
int erroffset;
|
||||
|
||||
@ -108,8 +107,7 @@ int Regex::search(const std::string& s, SMatch *match) const {
|
||||
if (ret > 0) {
|
||||
*match = SMatch(
|
||||
std::string(s, ovector[ret-1], ovector[ret] - ovector[ret-1]),
|
||||
0
|
||||
);
|
||||
0);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -31,13 +31,13 @@ namespace Utils {
|
||||
|
||||
class SMatch {
|
||||
public:
|
||||
SMatch()
|
||||
: m_match(), m_offset(0)
|
||||
{}
|
||||
SMatch() :
|
||||
m_match(),
|
||||
m_offset(0) { }
|
||||
|
||||
SMatch(const std::string &match, size_t offset)
|
||||
: m_match(match), m_offset(offset)
|
||||
{}
|
||||
SMatch(const std::string &match, size_t offset) :
|
||||
m_match(match),
|
||||
m_offset(offset) { }
|
||||
|
||||
const std::string& str() const { return m_match; }
|
||||
size_t offset() const { return m_offset; }
|
||||
@ -47,6 +47,7 @@ class SMatch {
|
||||
size_t m_offset;
|
||||
};
|
||||
|
||||
|
||||
class Regex {
|
||||
public:
|
||||
explicit Regex(const std::string& pattern_);
|
||||
@ -66,14 +67,17 @@ class Regex {
|
||||
pcre_extra *m_pce = NULL;
|
||||
};
|
||||
|
||||
|
||||
static inline int regex_search(const std::string& s, SMatch *match, const Regex& regex) {
|
||||
return regex.search(s, match);
|
||||
}
|
||||
|
||||
|
||||
static inline int regex_search(const std::string& s, const Regex& regex) {
|
||||
return regex.search(s);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Utils
|
||||
} // namespace modsecurity
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user