Skip to content

Commit bf98382

Browse files
zimmerleWGH-
authored andcommitted
Renames SMatch to RegexMatch
1 parent b8e31d1 commit bf98382

File tree

13 files changed

+31
-31
lines changed

13 files changed

+31
-31
lines changed

src/modsecurity.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ int ModSecurity::processContentOffset(const char *content, size_t len,
229229
const unsigned char *buf;
230230
size_t jsonSize;
231231

232-
std::list<regex::SMatch> vars = variables.searchAll(matchString);
233-
std::list<regex::SMatch> ops = operators.searchAll(matchString);
234-
std::list<regex::SMatch> trans = transformations.searchAll(matchString);
232+
std::list<regex::RegexMatch> vars = variables.searchAll(matchString);
233+
std::list<regex::RegexMatch> ops = operators.searchAll(matchString);
234+
std::list<regex::RegexMatch> trans = transformations.searchAll(matchString);
235235

236236
g = yajl_gen_alloc(NULL);
237237
if (g == NULL) {

src/operators/rx.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ bool Rx::evaluate(Transaction *transaction, RuleWithActions *rule,
5151
re = m_re;
5252
}
5353

54-
std::vector<regex::SMatchCapture> captures;
54+
std::vector<regex::RegexMatchCapture> captures;
5555
re->searchOneMatch(input, captures);
5656

5757
if (rule && rule->hasCaptureAction() && transaction) {
58-
for (const regex::SMatchCapture& capture : captures) {
58+
for (const regex::RegexMatchCapture& capture : captures) {
5959
const std::string capture_substring(input.substr(capture.m_offset,capture.m_length));
6060
transaction->m_collections.m_tx_collection->storeOrUpdateFirst(
6161
std::to_string(capture.m_group), capture_substring);

src/operators/rx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727

2828
namespace modsecurity {
29-
using regex::SMatch;
29+
using regex::RegexMatch;
3030
using regex::regex_search;
3131
using regex::Regex;
3232

src/operators/verify_cpf.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ bool VerifyCPF::verify(const char *cpfnumber, int len) {
110110

111111
bool VerifyCPF::evaluate(Transaction *t, RuleWithActions *rule,
112112
const std::string& input, std::shared_ptr<RuleMessage> ruleMessage) {
113-
std::list<SMatch> matches;
113+
std::list<RegexMatch> matches;
114114
bool is_cpf = false;
115115
int i;
116116

src/operators/verify_cpf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
namespace modsecurity {
28-
using regex::SMatch;
28+
using regex::RegexMatch;
2929
using regex::regex_search;
3030
using regex::Regex;
3131

src/operators/verify_ssn.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ bool VerifySSN::verify(const char *ssnumber, int len) {
112112

113113
bool VerifySSN::evaluate(Transaction *t, RuleWithActions *rule,
114114
const std::string& input, std::shared_ptr<RuleMessage> ruleMessage) {
115-
std::list<SMatch> matches;
115+
std::list<RegexMatch> matches;
116116
bool is_ssn = false;
117117
int i;
118118

src/operators/verify_ssn.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
namespace modsecurity {
28-
using regex::SMatch;
28+
using regex::RegexMatch;
2929
using regex::regex_search;
3030
using regex::Regex;
3131

src/operators/verify_svnr.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ bool VerifySVNR::verify(const char *svnrnumber, int len) {
7979

8080
bool VerifySVNR::evaluate(Transaction *t, RuleWithActions *rule,
8181
const std::string& input, std::shared_ptr<RuleMessage> ruleMessage) {
82-
std::list<SMatch> matches;
82+
std::list<RegexMatch> matches;
8383
bool is_svnr = false;
8484
int i;
8585

src/operators/verify_svnr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
namespace modsecurity {
14-
using regex::SMatch;
14+
using regex::RegexMatch;
1515
using regex::regex_search;
1616
using regex::Regex;
1717

src/regex/regex.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ Regex::~Regex() {
6262
}
6363

6464

65-
std::list<SMatch> Regex::searchAll(const std::string& s) const {
65+
std::list<RegexMatch> Regex::searchAll(const std::string& s) const {
6666
const char *subject = s.c_str();
6767
const std::string tmpString = std::string(s.c_str(), s.size());
6868
int ovector[OVECCOUNT];
6969
int rc, i, offset = 0;
70-
std::list<SMatch> retList;
70+
std::list<RegexMatch> retList;
7171

7272
do {
7373
rc = pcre_exec(m_pc, m_pce, subject,
@@ -83,7 +83,7 @@ std::list<SMatch> Regex::searchAll(const std::string& s) const {
8383
}
8484
std::string match = std::string(tmpString, start, len);
8585
offset = start + len;
86-
retList.push_front(SMatch(match, start));
86+
retList.push_front(RegexMatch(match, start));
8787

8888
if (len == 0) {
8989
rc = 0;
@@ -95,7 +95,7 @@ std::list<SMatch> Regex::searchAll(const std::string& s) const {
9595
return retList;
9696
}
9797

98-
bool Regex::searchOneMatch(const std::string& s, std::vector<SMatchCapture>& captures) const {
98+
bool Regex::searchOneMatch(const std::string& s, std::vector<RegexMatchCapture>& captures) const {
9999
const char *subject = s.c_str();
100100
int ovector[OVECCOUNT];
101101

@@ -108,20 +108,20 @@ bool Regex::searchOneMatch(const std::string& s, std::vector<SMatchCapture>& cap
108108
if (end > s.size()) {
109109
continue;
110110
}
111-
SMatchCapture capture(i, start, len);
111+
RegexMatchCapture capture(i, start, len);
112112
captures.push_back(capture);
113113
}
114114

115115
return (rc > 0);
116116
}
117117

118-
int Regex::search(const std::string& s, SMatch *match) const {
118+
int Regex::search(const std::string& s, RegexMatch *match) const {
119119
int ovector[OVECCOUNT];
120120
int ret = pcre_exec(m_pc, m_pce, s.c_str(),
121121
s.size(), 0, 0, ovector, OVECCOUNT) > 0;
122122

123123
if (ret > 0) {
124-
*match = SMatch(
124+
*match = RegexMatch(
125125
std::string(s, ovector[ret-1], ovector[ret] - ovector[ret-1]),
126126
0);
127127
}

0 commit comments

Comments
 (0)