+++ /dev/null
-/*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-#ifndef SQUID_REGEXLIST_H_
-#define SQUID_REGEXLIST_H_
-
-#include "mem/forward.h"
-
-#include <regex>
-
-/// list of regular expressions.
-class RegexList
-{
- MEMPROXY_CLASS(RegexList);
-
-public:
- RegexList() = delete;
- RegexList(int aFlags, const char *aPattern) : flags(aFlags), pattern(xstrdup(aPattern)), next(nullptr) {}
- RegexList(const RegexList &) = delete;
- RegexList(const RegexList && o) = delete;
- ~RegexList();
-
- int flags;
- char *pattern;
- regex_t regex;
- RegexList *next;
-};
-
-#endif /* SQUID_REGEXLIST_H_ */
-
#include "acl/Acl.h"
#include "acl/Checklist.h"
#include "acl/RegexData.h"
+#include "base/RegexPattern.h"
#include "ConfigParser.h"
#include "Debug.h"
-#include "RegexList.h"
#include "wordlist.h"
ACLRegexData::~ACLRegexData()
*/
#include "squid.h"
-#include "RegexList.h"
+#include "base/RegexPattern.h"
-RegexList::~RegexList()
+RegexPattern::~RegexPattern()
{
xfree(pattern);
regfree(®ex);
+}
+RegexList::~RegexList()
+{
// lists could be very long
// iterate instead of recursing
for (auto p = next; p; p = next) {
--- /dev/null
+/*
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#ifndef SQUID_SRC_BASE_REGEXPATTERN_H
+#define SQUID_SRC_BASE_REGEXPATTERN_H
+
+#include "mem/forward.h"
+
+/**
+ * A regular expression,
+ * plain text and compiled representations
+ */
+class RegexPattern
+{
+ MEMPROXY_CLASS(RegexPattern);
+
+public:
+ RegexPattern() = delete;
+ RegexPattern(int aFlags, const char *aPattern) : flags(aFlags), pattern(xstrdup(aPattern)) {}
+ RegexPattern(const RegexPattern &) = delete;
+ RegexPattern(const RegexPattern && o) = delete;
+ ~RegexPattern();
+
+ int flags;
+ char *pattern;
+ regex_t regex;
+};
+
+/// list of regular expressions.
+/// \deprecated use a std::list<RegexPattern> instead
+class RegexList : public RegexPattern
+{
+ MEMPROXY_CLASS(RegexList);
+
+public:
+ RegexList() = delete;
+ RegexList(int aFlags, const char *aPattern) : RegexPattern(aFlags, aPattern), next(nullptr) {}
+ RegexList(const RegexList &) = delete;
+ RegexList(const RegexList && o) = delete;
+ ~RegexList();
+
+ RegexList *next;
+};
+
+#endif /* SQUID_SRC_BASE_REGEXPATTERN_H */
+