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

Method init

plugins/prefetch/pattern.cc:49–66  ·  view source on GitHub ↗

* @brief Initializes PCRE pattern by providing the subject and replacement strings. * @param pattern PCRE pattern, a string containing PCRE patterns, capturing groups. * @param replacement PCRE replacement, a string where $0 ... $9 will be replaced with the corresponding capturing groups * @return true if successful, false if failure */

Source from the content-addressed store, hash-verified

47 * @return true if successful, false if failure
48 */
49bool
50Pattern::init(const String &pattern, const String &replacement)
51{
52 pcreFree();
53
54 _pattern.assign(pattern);
55 _replacement.assign(replacement);
56
57 _tokenCount = 0;
58
59 if (!compile()) {
60 PrefetchDebug("failed to initialize pattern:'%s', replacement:'%s'", pattern.c_str(), replacement.c_str());
61 pcreFree();
62 return false;
63 }
64
65 return true;
66}
67
68/**
69 * @brief Initializes PCRE pattern by providing the pattern only or pattern+replacement in a single configuration string.

Callers

nothing calls this directly

Calls 4

replaceStringFunction · 0.70
assignMethod · 0.45
c_strMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected