bneradt commented on code in PR #12573:
URL: https://github.com/apache/trafficserver/pull/12573#discussion_r2437317641
##########
plugins/header_rewrite/regex_helper.cc:
##########
@@ -17,39 +17,29 @@
*/
#include "regex_helper.h"
#include "lulu.h"
+#include "ts/ts.h"
+#include "tsutil/Regex.h"
+#include <pcre.h>
bool
regexHelper::setRegexMatch(const std::string &s, bool nocase)
{
- const char *errorComp = nullptr;
- const char *errorStudy = nullptr;
- int erroffset;
+ std::string error;
+ int errorOffset;
regexString = s;
- regex = pcre_compile(regexString.c_str(), nocase ? PCRE_CASELESS : 0,
&errorComp, &erroffset, nullptr);
- if (regex == nullptr) {
- return false;
- }
- regexExtra = pcre_study(regex, 0, &errorStudy);
- if ((regexExtra == nullptr) && (errorStudy != nullptr)) {
- return false;
- }
- if (pcre_fullinfo(regex, regexExtra, PCRE_INFO_CAPTURECOUNT, ®exCcount)
!= 0) {
+ bool ok = regex.compile(regexString, error, errorOffset, nocase ?
PCRE_CASELESS : 0);
+
+ if (!ok) {
Review Comment:
Maybe just `if (!regex.compile...`
##########
plugins/header_rewrite/regex_helper.cc:
##########
@@ -17,39 +17,29 @@
*/
#include "regex_helper.h"
#include "lulu.h"
+#include "ts/ts.h"
+#include "tsutil/Regex.h"
+#include <pcre.h>
Review Comment:
We shouldn't need `pcre.h` anymore, right?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]