MCPcopy Create free account
hub / github.com/apache/trafficserver / Add

Method Add

src/cripts/Matcher.cc:46–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void
47Matcher::PCRE::Add(cripts::string_view regex, uint32_t options, bool jit)
48{
49 int errorcode = 0;
50 PCRE2_SIZE erroroffset = 0;
51 pcre2_code *re =
52 pcre2_compile(reinterpret_cast<PCRE2_SPTR>(regex.data()), regex.length(), options, &errorcode, &erroroffset, nullptr);
53
54 if (!re) {
55 PCRE2_UCHAR error[256];
56
57 pcre2_get_error_message(errorcode, error, sizeof(error));
58 CFatal("[Matcher::PCRE]: PCRE compile error `%s': %.*s", error, static_cast<int>(regex.length()), regex.data());
59 } else {
60 if (jit) {
61 if (0 != pcre2_jit_compile(re, PCRE2_JIT_COMPLETE)) {
62 CFatal("[Matcher::PCRE]: PCRE JIT compile error: %.*s", static_cast<int>(regex.length()), regex.data());
63 }
64 }
65 _regexes.emplace_back(regex, re);
66 }
67}
68
69Matcher::PCRE::Result
70Matcher::PCRE::Contains(cripts::string_view subject, PCRE2_SIZE offset, uint32_t options)

Callers

nothing calls this directly

Calls 3

emplace_backMethod · 0.80
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected