]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Shuffle RegexList.* to base/libbase RegexPattern.*
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 27 Jul 2015 05:21:06 +0000 (22:21 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 27 Jul 2015 05:21:06 +0000 (22:21 -0700)
Split the core regex pattern data fields out into a class RegexPattern
for as a container node use in std::list or other constructions.

Leave the custom linked-list operations under the name RegexList. As a
child wrapper class for now so that old API members are still available.

src/Makefile.am
src/RegexList.h [deleted file]
src/acl/RegexData.cc
src/base/Makefile.am
src/base/RegexPattern.cc [moved from src/RegexList.cc with 89% similarity]
src/base/RegexPattern.h [new file with mode: 0644]
src/mem/old_api.cc

index c1c9668cdadd418f728ed2632b88a91de6093400..9e5e6086ebf0bc5c135378eefd6dab917e9f8218 100644 (file)
@@ -985,8 +985,6 @@ tests_testHttpReply_SOURCES=\
        HttpReply.h \
        MasterXaction.cc \
        MasterXaction.h \
-       RegexList.h \
-       RegexList.cc \
        MemBuf.cc \
        MemBuf.h \
        mime_header.h \
diff --git a/src/RegexList.h b/src/RegexList.h
deleted file mode 100644 (file)
index fe783b8..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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_ */
-
index 82b8b37d6eebbdd140d8bf1c41234f420f027f14..52c83811d1467544d0d7272716380fa662211793 100644 (file)
@@ -18,9 +18,9 @@
 #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()
index 8643df4da23cdf11bcce6418506a397bbe44fe6d..72643db253150291cbe02eafa55397dfa249ef74 100644 (file)
@@ -27,6 +27,8 @@ libbase_la_SOURCES = \
        Lock.h \
        LruMap.h \
        Packable.h \
+       RegexPattern.cc \
+       RegexPattern.h \
        RunnersRegistry.cc \
        RunnersRegistry.h \
        Subscription.h \
similarity index 89%
rename from src/RegexList.cc
rename to src/base/RegexPattern.cc
index 13de2d0f08748a7c06d642244152d26d2ab560ce..37018d48048cb573743bc786c3b01d42b32db621 100644 (file)
@@ -7,13 +7,16 @@
  */
 
 #include "squid.h"
-#include "RegexList.h"
+#include "base/RegexPattern.h"
 
-RegexList::~RegexList()
+RegexPattern::~RegexPattern()
 {
     xfree(pattern);
     regfree(&regex);
+}
 
+RegexList::~RegexList()
+{
     // lists could be very long
     // iterate instead of recursing
     for (auto p = next; p; p = next) {
diff --git a/src/base/RegexPattern.h b/src/base/RegexPattern.h
new file mode 100644 (file)
index 0000000..eb2fdd5
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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 */
+
index d154fba8a9bd0334790502d8109bfa85c574f559..b01a2f3138637bff14e71334f9cc0c4bf28ee65b 100644 (file)
@@ -23,7 +23,6 @@
 #include "MemBuf.h"
 #include "memMeter.h"
 #include "mgr/Registration.h"
-#include "RegexList.h"
 #include "SquidConfig.h"
 #include "SquidList.h"
 #include "SquidTime.h"