]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Kinkie <gkinkie@gmail.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 9 Jul 2008 11:55:41 +0000 (23:55 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 9 Jul 2008 11:55:41 +0000 (23:55 +1200)
Cleanups: rename List.h to CbDataList.h

include/List.h is in my very humble opinion misleadingly named, as it's
tied to CBDATA semantics and isn't really suited to be used as a generic
container class.

This patch renames the include file to CbDataList.h, and all datatypes
defined there are altered in the same manner.

14 files changed:
include/CbDataList.h [moved from include/List.h with 72% similarity]
src/ACLASN.h
src/ACLIntRange.cc
src/ACLIntRange.h
src/ACLMethodData.cc
src/ACLMethodData.h
src/ACLProtocolData.cc
src/ACLProtocolData.h
src/ACLSslErrorData.cc
src/ACLSslErrorData.h
src/CommRead.h
src/StoreSearch.h
src/asn.cc
src/comm.cc

similarity index 72%
rename from include/List.h
rename to include/CbDataList.h
index a928eec838d3278e2c9538aa1fb2af4ff17a112b..0aa43dba4021bfc22aac923ec97a86cf27d5a84e 100644 (file)
 
 /// \ingroup POD
 template <class C>
-class List
+class CbDataList
 {
 
 public:
     void *operator new (size_t);
     void operator delete (void *);
-    List (C const &);
-    ~List();
+    CbDataList (C const &);
+    ~CbDataList();
 
     bool find(C const &)const;
     bool findAndTune(C const &);
-    List *next;
+    CbDataList *next;
     C element;
     bool empty() const { return this == NULL; }
 
 private:
-    CBDATA_CLASS(List);
+    CBDATA_CLASS(CbDataList);
 };
 
 /// \ingroup POD
 template<class C>
-class ListContainer
+class CbDataListContainer
 {
 
 public:
-    ListContainer();
-    ~ListContainer();
-    List<C> *push_back (C const &);
+    CbDataListContainer();
+    ~CbDataListContainer();
+    CbDataList<C> *push_back (C const &);
     C pop_front();
     bool empty() const;
 
-    List<C> *head;
+    CbDataList<C> *head;
 };
 
 /// \ingroup POD
 template<class C>
-class ListIterator
+class CbDataListIterator
 {
 public:
-    ListIterator(ListContainer<C> const &list) : next_entry(list.head) {}
+    CbDataListIterator(CbDataListContainer<C> const &list) : next_entry(list.head) {}
     const C & next() {
-       List<C> *entry = next_entry;
+       CbDataList<C> *entry = next_entry;
        if (entry)
            next_entry = entry->next;
        return entry->element;
@@ -89,40 +89,40 @@ public:
     }
 
 private:
-    List<C> *next_entry;
+    CbDataList<C> *next_entry;
 };
 
 /* implementation follows */
 
 /** \cond AUTODOCS-IGNORE */
 template <class C>
-cbdata_type List<C>::CBDATA_List = CBDATA_UNKNOWN;
+cbdata_type CbDataList<C>::CBDATA_CbDataList = CBDATA_UNKNOWN;
 /** \endcond */
 
 template <class C>
 void *
-List<C>::operator new (size_t byteCount)
+CbDataList<C>::operator new (size_t byteCount)
 {
-    CBDATA_INIT_TYPE(List);
+    CBDATA_INIT_TYPE(CbDataList);
 
-    List<C> *result = cbdataAlloc(List);
+    CbDataList<C> *result = cbdataAlloc(CbDataList);
 
     return result;
 }
 
 template <class C>
 void
-List<C>::operator delete (void *address)
+CbDataList<C>::operator delete (void *address)
 {
     cbdataFree(address);
 }
 
 template <class C>
-List<C>::List(C const &value) : next(NULL), element (value)
+CbDataList<C>::CbDataList(C const &value) : next(NULL), element (value)
 {}
 
 template <class C>
-List<C>::~List()
+CbDataList<C>::~CbDataList()
 {
     if (next)
         delete next;
@@ -130,9 +130,9 @@ List<C>::~List()
 
 template <class C>
 bool
-List<C>::find (C const &toFind) const
+CbDataList<C>::find (C const &toFind) const
 {
-    List<C> const *node = NULL;
+    CbDataList<C> const *node = NULL;
 
     for (node = this; node; node = node->next)
         if (node->element == toFind)
@@ -143,11 +143,11 @@ List<C>::find (C const &toFind) const
 
 template <class C>
 bool
-List<C>::findAndTune(C const & toFind)
+CbDataList<C>::findAndTune(C const & toFind)
 {
-    List<C> *prev = NULL;
+    CbDataList<C> *prev = NULL;
 
-    for (List<C> *node = this; node; node = node->
+    for (CbDataList<C> *node = this; node; node = node->
                                             next) {
         if (node->element == toFind) {
             if (prev != NULL) {
@@ -168,24 +168,24 @@ List<C>::findAndTune(C const & toFind)
 }
 
 template <class C>
-ListContainer<C>::ListContainer() : head (NULL)
+CbDataListContainer<C>::CbDataListContainer() : head (NULL)
 {}
 
 template <class C>
-ListContainer<C>::~ListContainer()
+CbDataListContainer<C>::~CbDataListContainer()
 {
     if (head)
         delete head;
 }
 
 template <class C>
-List<C> *
-ListContainer<C>::push_back (C const &element)
+CbDataList<C> *
+CbDataListContainer<C>::push_back (C const &element)
 {
-    List<C> *node = new List<C> (element);
+    CbDataList<C> *node = new CbDataList<C> (element);
 
     if (head) {
-        List<C> *tempNode = NULL;
+        CbDataList<C> *tempNode = NULL;
 
         for (tempNode = head; tempNode->next; tempNode = tempNode->next);
         tempNode->next = node;
@@ -197,11 +197,11 @@ ListContainer<C>::push_back (C const &element)
 
 template <class C>
 C
-ListContainer<C>::pop_front()
+CbDataListContainer<C>::pop_front()
 {
     if (head) {
         C result = head->element;
-        List<C> *node = head;
+        CbDataList<C> *node = head;
         head = head->next;
         node->next = NULL;
         delete node;
@@ -213,7 +213,7 @@ ListContainer<C>::pop_front()
 
 template <class C>
 bool
-ListContainer<C>::empty() const
+CbDataListContainer<C>::empty() const
 {
     return head == NULL;
 }
index 65b4f00be9788d08ec0b70fd796cf92f380538f3..9a837c8f47752a8c7f1bd850d0454e42c2405ea8 100644 (file)
@@ -36,7 +36,7 @@
 #define SQUID_ACLASN_H
 
 #include "ACLData.h"
-#include "List.h"
+#include "CbDataList.h"
 #include "ACLStrategised.h"
 #include "ACLChecklist.h"
 #include "IPAddress.h"
@@ -45,7 +45,7 @@
 
 class CacheManager;
 
-SQUIDCEXTERN int asnMatchIp(List<int> *, IPAddress &);
+SQUIDCEXTERN int asnMatchIp(CbDataList<int> *, IPAddress &);
 
 /// \ingroup ACLAPI
 SQUIDCEXTERN void asnInit(void);
@@ -77,7 +77,7 @@ private:
     static ACLStrategised<IPAddress> SourceRegistryEntry_;
     static ACL::Prototype DestinationRegistryProtoype;
     static ACLStrategised<IPAddress> DestinationRegistryEntry_;
-    List<int> *data;
+    CbDataList<int> *data;
 };
 
 MEMPROXY_CLASS_INLINE(ACLASN)          /**DOCS_NOSEMI*/
index 2a86c620b1a39c99d4d773b1f9258212c1d63845..21b29641ac25d6f59d55cf6b57b73c651b67ddf0 100644 (file)
@@ -40,7 +40,7 @@
 #include "Parsing.h"
 
 /* explicit instantiation required for some systems */
-template cbdata_type List< Range<int> >::CBDATA_List;
+template cbdata_type CbDataList< Range<int> >::CBDATA_CbDataList;
 
 void
 ACLIntRange::parse()
@@ -83,7 +83,7 @@ bool
 ACLIntRange::match(int i)
 {
     RangeType const toFind (i, i+1);
-    ListIterator<RangeType> iter(ranges);
+    CbDataListIterator<RangeType> iter(ranges);
 
     while (!iter.end()) {
         const RangeType & element = iter.next();
@@ -113,7 +113,7 @@ ACLIntRange::dump ()
 {
     wordlist *W = NULL;
     char buf[32];
-    ListIterator<RangeType> iter(ranges);
+    CbDataListIterator<RangeType> iter(ranges);
 
     while (!iter.end()) {
         const RangeType & element = iter.next();
index 18406f016cf03c156a47bd860b2364ed41235f7d..72d8b2b05841286d9bea1b0c4a84ffeebf43dd09 100644 (file)
@@ -36,7 +36,7 @@
 #define SQUID_ACLINTRANGE_H
 
 #include "ACLData.h"
-#include "List.h"
+#include "CbDataList.h"
 #include "Range.h"
 
 /// \ingroup ACLAPI
@@ -55,7 +55,7 @@ public:
 
 private:
     typedef Range<int> RangeType;
-    ListContainer <RangeType> ranges;
+    CbDataListContainer <RangeType> ranges;
 };
 
 #endif /* SQUID_ACLINTRANGE_H */
index c7dae825970da3f9869429368c5ebf64721314d6..f00e25412017c9c7a5e1033e724d021925471757 100644 (file)
@@ -64,15 +64,14 @@ ACLMethodData::match(HttpRequestMethod toFind)
 /* explicit instantiation required for some systems */
 
 /// \cond AUTODOCS-IGNORE
-template cbdata_type List<HttpRequestMethod>
-::CBDATA_List;
+template cbdata_type CbDataList<HttpRequestMethod>::CBDATA_CbDataList;
 /// \endcond
 
 wordlist *
 ACLMethodData::dump()
 {
     wordlist *W = NULL;
-    List<HttpRequestMethod> *data = values;
+    CbDataList<HttpRequestMethod> *data = values;
 
     while (data != NULL) {
         wordlistAdd(&W, RequestMethodStr(data->element));
@@ -85,12 +84,12 @@ ACLMethodData::dump()
 void
 ACLMethodData::parse()
 {
-    List<HttpRequestMethod> **Tail;
+    CbDataList<HttpRequestMethod> **Tail;
     char *t = NULL;
 
     for (Tail = &values; *Tail; Tail = &((*Tail)->next));
     while ((t = strtokFile())) {
-        List<HttpRequestMethod> *q = new List<HttpRequestMethod> (HttpRequestMethod(t, NULL));
+        CbDataList<HttpRequestMethod> *q = new CbDataList<HttpRequestMethod> (HttpRequestMethod(t, NULL));
         *(Tail) = q;
         Tail = &q->next;
     }
index 0be431e3190187de2fd92164800b631ba467fbae..5ac338e7c6ed6e711cfe30de1317fb81bb4d0021 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "ACL.h"
 #include "ACLData.h"
-#include "List.h"
+#include "CbDataList.h"
 
 /// \ingroup ACLAPI
 class ACLMethodData : public ACLData<HttpRequestMethod>
@@ -56,7 +56,7 @@ public:
     bool empty() const;
     virtual ACLData<HttpRequestMethod> *clone() const;
 
-    List<HttpRequestMethod> *values;
+    CbDataList<HttpRequestMethod> *values;
 };
 
 MEMPROXY_CLASS_INLINE(ACLMethodData);
index a17ac99a4f03e341d7c50ef727104c58e67a2ca1..db567b45498f1858dccdd257b4206bd322ef3087 100644 (file)
@@ -63,14 +63,14 @@ ACLProtocolData::match(protocol_t toFind)
 /* explicit instantiation required for some systems */
 
 /// \cond AUTODOCS-IGNORE
-template cbdata_type List<protocol_t>::CBDATA_List;
+template cbdata_type CbDataList<protocol_t>::CBDATA_CbDataList;
 /// \endcond
 
 wordlist *
 ACLProtocolData::dump()
 {
     wordlist *W = NULL;
-    List<protocol_t> *data = values;
+    CbDataList<protocol_t> *data = values;
 
     while (data != NULL) {
         wordlistAdd(&W, ProtocolStr[data->element]);
@@ -83,12 +83,12 @@ ACLProtocolData::dump()
 void
 ACLProtocolData::parse()
 {
-    List<protocol_t> **Tail;
+    CbDataList<protocol_t> **Tail;
     char *t = NULL;
 
     for (Tail = &values; *Tail; Tail = &((*Tail)->next));
     while ((t = strtokFile())) {
-        List<protocol_t> *q = new List<protocol_t> (urlParseProtocol(t));
+        CbDataList<protocol_t> *q = new CbDataList<protocol_t> (urlParseProtocol(t));
         *(Tail) = q;
         Tail = &q->next;
     }
index 1a162e4900deb8e744c1d215c9eec430abb1121e..2e7b1201188d8c84ca765f721470caae799e3957 100644 (file)
@@ -37,7 +37,7 @@
 #define SQUID_ACLPROTOCOLDATA_H
 #include "ACL.h"
 #include "ACLData.h"
-#include "List.h"
+#include "CbDataList.h"
 
 class ACLProtocolData : public ACLData<protocol_t>
 {
@@ -55,7 +55,7 @@ public:
     bool empty() const;
     virtual ACLData<protocol_t> *clone() const;
 
-    List<protocol_t> *values;
+    CbDataList<protocol_t> *values;
 };
 
 MEMPROXY_CLASS_INLINE(ACLProtocolData);
index 39a5035607e9f2a397feaf285a016199dad1c90d..6b63f81aff93a5254c3dbcfd1020416469c65154 100644 (file)
@@ -29,13 +29,13 @@ ACLSslErrorData::match(ssl_error_t toFind)
 
 /* explicit instantiation required for some systems */
 
-template cbdata_type List<ssl_error_t>::CBDATA_List;
+template cbdata_type CbDataList<ssl_error_t>::CBDATA_CbDataList;
 
 wordlist *
 ACLSslErrorData::dump()
 {
     wordlist *W = NULL;
-    List<ssl_error_t> *data = values;
+    CbDataList<ssl_error_t> *data = values;
 
     while (data != NULL) {
         wordlistAdd(&W, sslFindErrorString(data->element));
@@ -48,12 +48,12 @@ ACLSslErrorData::dump()
 void
 ACLSslErrorData::parse()
 {
-    List<ssl_error_t> **Tail;
+    CbDataList<ssl_error_t> **Tail;
     char *t = NULL;
 
     for (Tail = &values; *Tail; Tail = &((*Tail)->next));
     while ((t = strtokFile())) {
-        List<ssl_error_t> *q = new List<ssl_error_t>(sslParseErrorString(t));
+        CbDataList<ssl_error_t> *q = new CbDataList<ssl_error_t>(sslParseErrorString(t));
         *(Tail) = q;
         Tail = &q->next;
     }
index 54230cd6ccecd922fc33ca17eda3ef6cb066bc46..0e13ffa814074a3b6b428df758d217ee4885b59e 100644 (file)
@@ -7,7 +7,7 @@
 #define SQUID_ACLSSL_ERRORDATA_H
 #include "ACL.h"
 #include "ACLData.h"
-#include "List.h"
+#include "CbDataList.h"
 #include "ssl_support.h"
 
 class ACLSslErrorData : public ACLData<ssl_error_t>
@@ -26,7 +26,7 @@ public:
     bool empty() const;
     virtual ACLData<ssl_error_t> *clone() const;
 
-    List<ssl_error_t> *values;
+    CbDataList<ssl_error_t> *values;
 };
 
 MEMPROXY_CLASS_INLINE(ACLSslErrorData);
index 6b7d2a24f86e828d2bf4017efc9dfedddd31f183..42d83334a76634179c2de5bbf76135658a8a75c9 100644 (file)
@@ -43,7 +43,7 @@
 #include "squid.h"
 #include "comm.h"
 #include "CommCalls.h"
-#include "List.h"
+#include "CbDataList.h"
 
 class CommRead
 {
@@ -92,10 +92,10 @@ public:
 
 private:
     static PF CloseHandler;
-    static DeferredRead popHead(ListContainer<DeferredRead> &deferredReads);
+    static DeferredRead popHead(CbDataListContainer<DeferredRead> &deferredReads);
     void kickARead(DeferredRead const &);
     void flushReads();
-    ListContainer<DeferredRead> deferredReads;
+    CbDataListContainer<DeferredRead> deferredReads;
 };
 
 
index 1f3e10f11ec35cfb2b701288ad5c1094775b97d8..ea9cfc222116be6a1ae6f21120599325d260fc6c 100644 (file)
@@ -47,7 +47,7 @@ public:
     virtual ~StoreSearch() {}
 
     /* not ready yet
-    void asList(void (*) (List<StoreEntryPointer), void *cbdata);
+    void asList(void (*) (CbDataList<StoreEntryPointer), void *cbdata);
     */
     /* callback the client when a new StoreEntry is available
      * or an error occurs 
index ce9f739adfb1723f93d348ab225ed708c6e36a59..a0b3bffcfc3f9b4f74581c7c6aae2020056f4d9b 100644 (file)
@@ -72,7 +72,7 @@ struct squid_radix_node_head *AS_tree_head;
 /* explicit instantiation required for some systems */
 
 /// \cond AUTODOCS-IGNORE
-template cbdata_type List<int>::CBDATA_List;
+template cbdata_type CbDataList<int>::CBDATA_CbDataList;
 /// \endcond
 
 /**
@@ -82,7 +82,7 @@ template cbdata_type List<int>::CBDATA_List;
  */
 struct as_info
 {
-    List<int> *as_number;
+    CbDataList<int> *as_number;
     time_t expires;            /* NOTUSED */
 };
 
@@ -128,13 +128,13 @@ static OBJH asnStats;
 /* PUBLIC */
 
 int
-asnMatchIp(List<int> *data, IPAddress &addr)
+asnMatchIp(CbDataList<int> *data, IPAddress &addr)
 {
     struct squid_radix_node *rn;
     as_info *e;
     m_ADDR m_addr;
-    List<int> *a = NULL;
-    List<int> *b = NULL;
+    CbDataList<int> *a = NULL;
+    CbDataList<int> *b = NULL;
 
     debugs(53, 3, "asnMatchIp: Called for " << addr );
 
@@ -174,7 +174,7 @@ asnMatchIp(List<int> *data, IPAddress &addr)
 void
 ACLASN::prepareForUse()
 {
-    for (List<int> *i = data; i; i = i->
+    for (CbDataList<int> *i = data; i; i = i->
                                      next)
         asnCacheStart(i->element);
 }
@@ -388,8 +388,8 @@ asnAddNet(char *as_string, int as_number)
     rtentry_t *e;
 
     struct squid_radix_node *rn;
-    List<int> **Tail = NULL;
-    List<int> *q = NULL;
+    CbDataList<int> **Tail = NULL;
+    CbDataList<int> *q = NULL;
     as_info *asinfo = NULL;
 
     IPAddress mask;
@@ -439,14 +439,14 @@ asnAddNet(char *as_string, int as_number)
             debugs(53, 3, "asnAddNet: Warning: Found a network with multiple AS numbers!");
 
             for (Tail = &asinfo->as_number; *Tail; Tail = &(*Tail)->next);
-            q = new List<int> (as_number);
+            q = new CbDataList<int> (as_number);
 
             *(Tail) = q;
 
             e->e_info = asinfo;
         }
     } else {
-        q = new List<int> (as_number);
+        q = new CbDataList<int> (as_number);
         asinfo = (as_info *)xmalloc(sizeof(as_info));
         asinfo->as_number = q;
         rn = squid_rn_addroute(&e->e_addr, &e->e_mask, AS_tree_head, e->e_nodes);
@@ -492,8 +492,8 @@ destroyRadixNode(struct squid_radix_node *rn, void *w)
 static void
 destroyRadixNodeInfo(as_info * e_info)
 {
-    List<int> *prev = NULL;
-    List<int> *data = e_info->as_number;
+    CbDataList<int> *prev = NULL;
+    CbDataList<int> *data = e_info->as_number;
 
     while (data) {
         prev = data;
@@ -509,7 +509,7 @@ printRadixNode(struct squid_radix_node *rn, void *_sentry)
 {
     StoreEntry *sentry = (StoreEntry *)_sentry;
     rtentry_t *e = (rtentry_t *) rn;
-    List<int> *q;
+    CbDataList<int> *q;
     as_info *asinfo;
     char buf[MAX_IPSTRLEN];
     IPAddress addr;
@@ -551,7 +551,7 @@ ACLASN::dump()
 {
     wordlist *W = NULL;
     char buf[32];
-    List<int> *ldata = data;
+    CbDataList<int> *ldata = data;
 
     while (ldata != NULL) {
         snprintf(buf, sizeof(buf), "%d", ldata->element);
@@ -571,14 +571,14 @@ ACLASN::empty () const
 void
 ACLASN::parse()
 {
-    List<int> **curlist = &data;
-    List<int> **Tail;
-    List<int> *q = NULL;
+    CbDataList<int> **curlist = &data;
+    CbDataList<int> **Tail;
+    CbDataList<int> *q = NULL;
     char *t = NULL;
 
     for (Tail = curlist; *Tail; Tail = &((*Tail)->next));
     while ((t = strtokFile())) {
-        q = new List<int> (atoi(t));
+        q = new CbDataList<int> (atoi(t));
         *(Tail) = q;
         Tail = &q->next;
     }
index 6f07ef08829c4861a851dbf66b920c2c5ba983d7..63b2c40007dcdbcd53db2089f3eaad0c5e133d45 100644 (file)
@@ -2509,13 +2509,13 @@ DeferredReadManager::~DeferredReadManager() {
 /* explicit instantiation required for some systems */
 
 /// \cond AUTODOCS-IGNORE
-template cbdata_type List<DeferredRead>::CBDATA_List;
+template cbdata_type CbDataList<DeferredRead>::CBDATA_CbDataList;
 /// \endcond
 
 void
 DeferredReadManager::delayRead(DeferredRead const &aRead) {
     debugs(5, 3, "Adding deferred read on FD " << aRead.theRead.fd);
-    List<DeferredRead> *temp = deferredReads.push_back(aRead);
+    CbDataList<DeferredRead> *temp = deferredReads.push_back(aRead);
     comm_add_close_handler (aRead.theRead.fd, CloseHandler, temp);
 }
 
@@ -2524,13 +2524,13 @@ DeferredReadManager::CloseHandler(int fd, void *thecbdata) {
     if (!cbdataReferenceValid (thecbdata))
         return;
 
-    List<DeferredRead> *temp = (List<DeferredRead> *)thecbdata;
+    CbDataList<DeferredRead> *temp = (CbDataList<DeferredRead> *)thecbdata;
 
     temp->element.markCancelled();
 }
 
 DeferredRead
-DeferredReadManager::popHead(ListContainer<DeferredRead> &deferredReads) {
+DeferredReadManager::popHead(CbDataListContainer<DeferredRead> &deferredReads) {
     assert (!deferredReads.empty());
 
     if (!deferredReads.head->element.cancelled)
@@ -2543,7 +2543,7 @@ DeferredReadManager::popHead(ListContainer<DeferredRead> &deferredReads) {
 
 void
 DeferredReadManager::kickReads(int const count) {
-    /* if we had List::size() we could consolidate this and flushReads */
+    /* if we had CbDataList::size() we could consolidate this and flushReads */
 
     if (count < 1) {
         flushReads();
@@ -2563,9 +2563,9 @@ DeferredReadManager::kickReads(int const count) {
 
 void
 DeferredReadManager::flushReads() {
-    ListContainer<DeferredRead> reads;
+    CbDataListContainer<DeferredRead> reads;
     reads = deferredReads;
-    deferredReads = ListContainer<DeferredRead>();
+    deferredReads = CbDataListContainer<DeferredRead>();
 
     while (!reads.empty()) {
         DeferredRead aRead = popHead(reads);