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_)
|
Regex::Regex(const std::string& pattern_)
|
||||||
: pattern(pattern_.empty() ? ".*" : pattern_)
|
: pattern(pattern_.empty() ? ".*" : pattern_) {
|
||||||
{
|
|
||||||
const char *errptr = NULL;
|
const char *errptr = NULL;
|
||||||
int erroffset;
|
int erroffset;
|
||||||
|
|
||||||
@ -108,8 +107,7 @@ int Regex::search(const std::string& s, SMatch *match) const {
|
|||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
*match = SMatch(
|
*match = SMatch(
|
||||||
std::string(s, ovector[ret-1], ovector[ret] - ovector[ret-1]),
|
std::string(s, ovector[ret-1], ovector[ret] - ovector[ret-1]),
|
||||||
0
|
0);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -31,13 +31,13 @@ namespace Utils {
|
|||||||
|
|
||||||
class SMatch {
|
class SMatch {
|
||||||
public:
|
public:
|
||||||
SMatch()
|
SMatch() :
|
||||||
: m_match(), m_offset(0)
|
m_match(),
|
||||||
{}
|
m_offset(0) { }
|
||||||
|
|
||||||
SMatch(const std::string &match, size_t offset)
|
SMatch(const std::string &match, size_t offset) :
|
||||||
: m_match(match), m_offset(offset)
|
m_match(match),
|
||||||
{}
|
m_offset(offset) { }
|
||||||
|
|
||||||
const std::string& str() const { return m_match; }
|
const std::string& str() const { return m_match; }
|
||||||
size_t offset() const { return m_offset; }
|
size_t offset() const { return m_offset; }
|
||||||
@ -47,6 +47,7 @@ class SMatch {
|
|||||||
size_t m_offset;
|
size_t m_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Regex {
|
class Regex {
|
||||||
public:
|
public:
|
||||||
explicit Regex(const std::string& pattern_);
|
explicit Regex(const std::string& pattern_);
|
||||||
@ -66,14 +67,17 @@ class Regex {
|
|||||||
pcre_extra *m_pce = NULL;
|
pcre_extra *m_pce = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static inline int regex_search(const std::string& s, SMatch *match, const Regex& regex) {
|
static inline int regex_search(const std::string& s, SMatch *match, const Regex& regex) {
|
||||||
return regex.search(s, match);
|
return regex.search(s, match);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline int regex_search(const std::string& s, const Regex& regex) {
|
static inline int regex_search(const std::string& s, const Regex& regex) {
|
||||||
return regex.search(s);
|
return regex.search(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
} // namespace modsecurity
|
} // namespace modsecurity
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user