bneradt commented on code in PR #12576:
URL: https://github.com/apache/trafficserver/pull/12576#discussion_r2441056928
##########
plugins/prefetch/pattern.h:
##########
@@ -23,22 +23,16 @@
#pragma once
-#ifdef HAVE_PCRE_PCRE_H
-#include <pcre/pcre.h>
-#else
-#include <pcre.h>
-#endif
-
#include "common.h"
+#include "tsutil/Regex.h"
/**
* @brief PCRE matching, capturing and replacing
*/
class Pattern
{
public:
- static const int TOKENCOUNT = 10; /**< @brief Capturing groups
$0..$9 */
- static const int OVECOUNT = TOKENCOUNT * 3; /**< @brief pcre_exec() array
count, handle 10 capture groups */
+ static const int TOKENCOUNT = 10; /**< @brief Capturing groups $0..$9 */
Pattern();
virtual ~Pattern();
Review Comment:
Is inheritance actually used here? If not, let's remove the `virtual`.
##########
plugins/prefetch/pattern.cc:
##########
@@ -129,33 +126,13 @@ Pattern::init(const String &config)
bool
Pattern::empty() const
{
- return _pattern.empty() || nullptr == _re;
-}
-
-/**
- * @brief Frees PCRE library related resources.
- */
-void
-Pattern::pcreFree()
-{
- if (_re) {
- pcre_free(_re);
- _re = nullptr;
- }
-
- if (_extra) {
- pcre_free(_extra);
- _extra = nullptr;
- }
+ return _pattern.empty() || _regex.empty();
}
/**
* @brief Destructor, frees PCRE related resources.
*/
-Pattern::~Pattern()
-{
- pcreFree();
-}
+Pattern::~Pattern() {}
Review Comment:
Should probably just remove this and use `= default;` in the class
declaration.
--
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]