Removes unecessary static methods from regex class

This commit is contained in:
Felipe Zimmerle
2019-01-18 18:24:26 -03:00
parent 57fc3b5084
commit 686b6ffff7
12 changed files with 15 additions and 30 deletions

View File

@@ -39,7 +39,7 @@ void CustomDebugLog::write(int level, const std::string &id,
bool CustomDebugLog::contains(const std::string& pattern) {
modsecurity::regex::Regex re(pattern);
std::string s = m_log.str();
return modsecurity::regex::regex_search(s, re);
return re.search(s);
}
std::string CustomDebugLog::log_messages() {

View File

@@ -39,7 +39,6 @@ using modsecurity_test::ModSecurityTestResults;
using modsecurity_test::RegressionTest;
using modsecurity_test::RegressionTestResult;
using modsecurity::regex::regex_search;
using modsecurity::regex::RegexMatch;
using modsecurity::regex::Regex;
@@ -55,7 +54,7 @@ void print_help() {
bool contains(const std::string &s, const std::string &pattern) {
bool ret;
modsecurity::regex::Regex re(pattern);
ret = modsecurity::regex::regex_search(s, re);
ret = re.search(s);
return ret;
}
@@ -210,7 +209,7 @@ void perform_unit_test(ModSecurityTest<RegressionTest> *test,
RegexMatch match;
std::string s = modsec_rules->getParserError();
if (regex_search(s, &match, re)) {
if (re.search(s, &match)) {
if (test->m_automake_output) {
std::cout << ":test-result: PASS " << filename \
<< ":" << t->name << std::endl;

View File

@@ -62,7 +62,7 @@ void json2bin(std::string *str) {
modsecurity::regex::Regex re2("\\\\u([a-z0-9A-Z]{4})");
modsecurity::regex::RegexMatch match;
while (modsecurity::regex::regex_search(*str, &match, re)) {
while (re.search(*str, &match)) {
unsigned int p;
std::string toBeReplaced = match.str();
toBeReplaced.erase(0, 2);
@@ -70,7 +70,7 @@ void json2bin(std::string *str) {
replaceAll(str, match.str(), p);
}
while (modsecurity::regex::regex_search(*str, &match, re2)) {
while (re2.search(*str, &match)) {
unsigned int p;
std::string toBeReplaced = match.str();
toBeReplaced.erase(0, 2);