Bug#999938: trafficserver: depends on obsolete pcre3 library (3/3)
From
Yavor Doganov@21:1/5 to
All on Fri Dec 29 16:00:01 2023
[continued from previous message]
+ pcre2_code *_re = nullptr; /**< @brief PCRE compiled info structure, computed during initialization */
String _pattern; /**< @brief PCRE pattern string, containing PCRE patterns and capturing groups. */
String _replacement; /**< @brief PCRE replacement string, containing $0..$9 to be replaced with content of the capturing groups */
--- trafficserver-9.2.3+ds.orig/plugins/experimental/cookie_remap/cookie_remap.cc
+++ trafficserver-9.2.3+ds/plugins/experimental/cookie_remap/cookie_remap.cc
@@ -24,8 +24,11 @@
#include "cookiejar.h"
#include <ts/ts.h>
-#include <pcre.h>
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
#include <ts/remap.h>
+#include <tscore/ink_defs.h>
+#include <tscore/ink_memory.h>
#include <yaml-cpp/yaml.h>
#include <string>
@@ -261,11 +264,7 @@
{
TSDebug(MY_NAME, "subop destructor called");
if (regex) {
- pcre_free(regex);
- }
-
- if (regex_extra) {
- pcre_free(regex_extra);
+ pcre2_code_free(regex);
}
}
@@ -378,23 +377,18 @@
bool
setRegexMatch(const std::string &s)
{
- const char *error_comp = nullptr;
- const char *error_study = nullptr;
- int erroffset;
+ int error;
+ PCRE2_SIZE erroffset;
op_type = REGEXP;
regex_string = s;
- regex = pcre_compile(regex_string.c_str(), 0, &e