Skip to content

Commit df3c3f6

Browse files
committed
Cosmetics: coding style
1 parent ad28de4 commit df3c3f6

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/utils/regex.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ namespace Utils {
3939

4040

4141
Regex::Regex(const std::string& pattern_)
42-
: pattern(pattern_.empty() ? ".*" : pattern_)
43-
{
42+
: pattern(pattern_.empty() ? ".*" : pattern_) {
4443
const char *errptr = NULL;
4544
int erroffset;
4645

@@ -108,8 +107,7 @@ int Regex::search(const std::string& s, SMatch *match) const {
108107
if (ret > 0) {
109108
*match = SMatch(
110109
std::string(s, ovector[ret-1], ovector[ret] - ovector[ret-1]),
111-
0
112-
);
110+
0);
113111
}
114112

115113
return ret;

src/utils/regex.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ namespace Utils {
3131

3232
class SMatch {
3333
public:
34-
SMatch()
35-
: m_match(), m_offset(0)
36-
{}
34+
SMatch() :
35+
m_match(),
36+
m_offset(0) { }
3737

38-
SMatch(const std::string &match, size_t offset)
39-
: m_match(match), m_offset(offset)
40-
{}
38+
SMatch(const std::string &match, size_t offset) :
39+
m_match(match),
40+
m_offset(offset) { }
4141

4242
const std::string& str() const { return m_match; }
4343
size_t offset() const { return m_offset; }
@@ -47,6 +47,7 @@ class SMatch {
4747
size_t m_offset;
4848
};
4949

50+
5051
class Regex {
5152
public:
5253
explicit Regex(const std::string& pattern_);
@@ -66,14 +67,17 @@ class Regex {
6667
pcre_extra *m_pce = NULL;
6768
};
6869

70+
6971
static inline int regex_search(const std::string& s, SMatch *match, const Regex& regex) {
7072
return regex.search(s, match);
7173
}
7274

75+
7376
static inline int regex_search(const std::string& s, const Regex& regex) {
7477
return regex.search(s);
7578
}
7679

80+
7781
} // namespace Utils
7882
} // namespace modsecurity
7983

0 commit comments

Comments
 (0)