From: Amos Jeffries Date: Wed, 9 Jul 2008 11:55:41 +0000 (+1200) Subject: Author: Kinkie X-Git-Tag: SQUID_3_1_0_1~49^2~160 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2236466c9b2e6577bec0ec4420118eb8b42afa9c;p=thirdparty%2Fsquid.git Author: Kinkie 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. --- diff --git a/include/List.h b/include/CbDataList.h similarity index 72% rename from include/List.h rename to include/CbDataList.h index a928eec838..0aa43dba40 100644 --- a/include/List.h +++ b/include/CbDataList.h @@ -38,48 +38,48 @@ /// \ingroup POD template -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 ListContainer +class CbDataListContainer { public: - ListContainer(); - ~ListContainer(); - List *push_back (C const &); + CbDataListContainer(); + ~CbDataListContainer(); + CbDataList *push_back (C const &); C pop_front(); bool empty() const; - List *head; + CbDataList *head; }; /// \ingroup POD template -class ListIterator +class CbDataListIterator { public: - ListIterator(ListContainer const &list) : next_entry(list.head) {} + CbDataListIterator(CbDataListContainer const &list) : next_entry(list.head) {} const C & next() { - List *entry = next_entry; + CbDataList *entry = next_entry; if (entry) next_entry = entry->next; return entry->element; @@ -89,40 +89,40 @@ public: } private: - List *next_entry; + CbDataList *next_entry; }; /* implementation follows */ /** \cond AUTODOCS-IGNORE */ template -cbdata_type List::CBDATA_List = CBDATA_UNKNOWN; +cbdata_type CbDataList::CBDATA_CbDataList = CBDATA_UNKNOWN; /** \endcond */ template void * -List::operator new (size_t byteCount) +CbDataList::operator new (size_t byteCount) { - CBDATA_INIT_TYPE(List); + CBDATA_INIT_TYPE(CbDataList); - List *result = cbdataAlloc(List); + CbDataList *result = cbdataAlloc(CbDataList); return result; } template void -List::operator delete (void *address) +CbDataList::operator delete (void *address) { cbdataFree(address); } template -List::List(C const &value) : next(NULL), element (value) +CbDataList::CbDataList(C const &value) : next(NULL), element (value) {} template -List::~List() +CbDataList::~CbDataList() { if (next) delete next; @@ -130,9 +130,9 @@ List::~List() template bool -List::find (C const &toFind) const +CbDataList::find (C const &toFind) const { - List const *node = NULL; + CbDataList const *node = NULL; for (node = this; node; node = node->next) if (node->element == toFind) @@ -143,11 +143,11 @@ List::find (C const &toFind) const template bool -List::findAndTune(C const & toFind) +CbDataList::findAndTune(C const & toFind) { - List *prev = NULL; + CbDataList *prev = NULL; - for (List *node = this; node; node = node-> + for (CbDataList *node = this; node; node = node-> next) { if (node->element == toFind) { if (prev != NULL) { @@ -168,24 +168,24 @@ List::findAndTune(C const & toFind) } template -ListContainer::ListContainer() : head (NULL) +CbDataListContainer::CbDataListContainer() : head (NULL) {} template -ListContainer::~ListContainer() +CbDataListContainer::~CbDataListContainer() { if (head) delete head; } template -List * -ListContainer::push_back (C const &element) +CbDataList * +CbDataListContainer::push_back (C const &element) { - List *node = new List (element); + CbDataList *node = new CbDataList (element); if (head) { - List *tempNode = NULL; + CbDataList *tempNode = NULL; for (tempNode = head; tempNode->next; tempNode = tempNode->next); tempNode->next = node; @@ -197,11 +197,11 @@ ListContainer::push_back (C const &element) template C -ListContainer::pop_front() +CbDataListContainer::pop_front() { if (head) { C result = head->element; - List *node = head; + CbDataList *node = head; head = head->next; node->next = NULL; delete node; @@ -213,7 +213,7 @@ ListContainer::pop_front() template bool -ListContainer::empty() const +CbDataListContainer::empty() const { return head == NULL; } diff --git a/src/ACLASN.h b/src/ACLASN.h index 65b4f00be9..9a837c8f47 100644 --- a/src/ACLASN.h +++ b/src/ACLASN.h @@ -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 *, IPAddress &); +SQUIDCEXTERN int asnMatchIp(CbDataList *, IPAddress &); /// \ingroup ACLAPI SQUIDCEXTERN void asnInit(void); @@ -77,7 +77,7 @@ private: static ACLStrategised SourceRegistryEntry_; static ACL::Prototype DestinationRegistryProtoype; static ACLStrategised DestinationRegistryEntry_; - List *data; + CbDataList *data; }; MEMPROXY_CLASS_INLINE(ACLASN) /**DOCS_NOSEMI*/ diff --git a/src/ACLIntRange.cc b/src/ACLIntRange.cc index 2a86c620b1..21b29641ac 100644 --- a/src/ACLIntRange.cc +++ b/src/ACLIntRange.cc @@ -40,7 +40,7 @@ #include "Parsing.h" /* explicit instantiation required for some systems */ -template cbdata_type List< Range >::CBDATA_List; +template cbdata_type CbDataList< Range >::CBDATA_CbDataList; void ACLIntRange::parse() @@ -83,7 +83,7 @@ bool ACLIntRange::match(int i) { RangeType const toFind (i, i+1); - ListIterator iter(ranges); + CbDataListIterator iter(ranges); while (!iter.end()) { const RangeType & element = iter.next(); @@ -113,7 +113,7 @@ ACLIntRange::dump () { wordlist *W = NULL; char buf[32]; - ListIterator iter(ranges); + CbDataListIterator iter(ranges); while (!iter.end()) { const RangeType & element = iter.next(); diff --git a/src/ACLIntRange.h b/src/ACLIntRange.h index 18406f016c..72d8b2b058 100644 --- a/src/ACLIntRange.h +++ b/src/ACLIntRange.h @@ -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 RangeType; - ListContainer ranges; + CbDataListContainer ranges; }; #endif /* SQUID_ACLINTRANGE_H */ diff --git a/src/ACLMethodData.cc b/src/ACLMethodData.cc index c7dae82597..f00e254120 100644 --- a/src/ACLMethodData.cc +++ b/src/ACLMethodData.cc @@ -64,15 +64,14 @@ ACLMethodData::match(HttpRequestMethod toFind) /* explicit instantiation required for some systems */ /// \cond AUTODOCS-IGNORE -template cbdata_type List -::CBDATA_List; +template cbdata_type CbDataList::CBDATA_CbDataList; /// \endcond wordlist * ACLMethodData::dump() { wordlist *W = NULL; - List *data = values; + CbDataList *data = values; while (data != NULL) { wordlistAdd(&W, RequestMethodStr(data->element)); @@ -85,12 +84,12 @@ ACLMethodData::dump() void ACLMethodData::parse() { - List **Tail; + CbDataList **Tail; char *t = NULL; for (Tail = &values; *Tail; Tail = &((*Tail)->next)); while ((t = strtokFile())) { - List *q = new List (HttpRequestMethod(t, NULL)); + CbDataList *q = new CbDataList (HttpRequestMethod(t, NULL)); *(Tail) = q; Tail = &q->next; } diff --git a/src/ACLMethodData.h b/src/ACLMethodData.h index 0be431e319..5ac338e7c6 100644 --- a/src/ACLMethodData.h +++ b/src/ACLMethodData.h @@ -37,7 +37,7 @@ #include "ACL.h" #include "ACLData.h" -#include "List.h" +#include "CbDataList.h" /// \ingroup ACLAPI class ACLMethodData : public ACLData @@ -56,7 +56,7 @@ public: bool empty() const; virtual ACLData *clone() const; - List *values; + CbDataList *values; }; MEMPROXY_CLASS_INLINE(ACLMethodData); diff --git a/src/ACLProtocolData.cc b/src/ACLProtocolData.cc index a17ac99a4f..db567b4549 100644 --- a/src/ACLProtocolData.cc +++ b/src/ACLProtocolData.cc @@ -63,14 +63,14 @@ ACLProtocolData::match(protocol_t toFind) /* explicit instantiation required for some systems */ /// \cond AUTODOCS-IGNORE -template cbdata_type List::CBDATA_List; +template cbdata_type CbDataList::CBDATA_CbDataList; /// \endcond wordlist * ACLProtocolData::dump() { wordlist *W = NULL; - List *data = values; + CbDataList *data = values; while (data != NULL) { wordlistAdd(&W, ProtocolStr[data->element]); @@ -83,12 +83,12 @@ ACLProtocolData::dump() void ACLProtocolData::parse() { - List **Tail; + CbDataList **Tail; char *t = NULL; for (Tail = &values; *Tail; Tail = &((*Tail)->next)); while ((t = strtokFile())) { - List *q = new List (urlParseProtocol(t)); + CbDataList *q = new CbDataList (urlParseProtocol(t)); *(Tail) = q; Tail = &q->next; } diff --git a/src/ACLProtocolData.h b/src/ACLProtocolData.h index 1a162e4900..2e7b120118 100644 --- a/src/ACLProtocolData.h +++ b/src/ACLProtocolData.h @@ -37,7 +37,7 @@ #define SQUID_ACLPROTOCOLDATA_H #include "ACL.h" #include "ACLData.h" -#include "List.h" +#include "CbDataList.h" class ACLProtocolData : public ACLData { @@ -55,7 +55,7 @@ public: bool empty() const; virtual ACLData *clone() const; - List *values; + CbDataList *values; }; MEMPROXY_CLASS_INLINE(ACLProtocolData); diff --git a/src/ACLSslErrorData.cc b/src/ACLSslErrorData.cc index 39a5035607..6b63f81aff 100644 --- a/src/ACLSslErrorData.cc +++ b/src/ACLSslErrorData.cc @@ -29,13 +29,13 @@ ACLSslErrorData::match(ssl_error_t toFind) /* explicit instantiation required for some systems */ -template cbdata_type List::CBDATA_List; +template cbdata_type CbDataList::CBDATA_CbDataList; wordlist * ACLSslErrorData::dump() { wordlist *W = NULL; - List *data = values; + CbDataList *data = values; while (data != NULL) { wordlistAdd(&W, sslFindErrorString(data->element)); @@ -48,12 +48,12 @@ ACLSslErrorData::dump() void ACLSslErrorData::parse() { - List **Tail; + CbDataList **Tail; char *t = NULL; for (Tail = &values; *Tail; Tail = &((*Tail)->next)); while ((t = strtokFile())) { - List *q = new List(sslParseErrorString(t)); + CbDataList *q = new CbDataList(sslParseErrorString(t)); *(Tail) = q; Tail = &q->next; } diff --git a/src/ACLSslErrorData.h b/src/ACLSslErrorData.h index 54230cd6cc..0e13ffa814 100644 --- a/src/ACLSslErrorData.h +++ b/src/ACLSslErrorData.h @@ -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 @@ -26,7 +26,7 @@ public: bool empty() const; virtual ACLData *clone() const; - List *values; + CbDataList *values; }; MEMPROXY_CLASS_INLINE(ACLSslErrorData); diff --git a/src/CommRead.h b/src/CommRead.h index 6b7d2a24f8..42d83334a7 100644 --- a/src/CommRead.h +++ b/src/CommRead.h @@ -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 &deferredReads); + static DeferredRead popHead(CbDataListContainer &deferredReads); void kickARead(DeferredRead const &); void flushReads(); - ListContainer deferredReads; + CbDataListContainer deferredReads; }; diff --git a/src/StoreSearch.h b/src/StoreSearch.h index 1f3e10f11e..ea9cfc2221 100644 --- a/src/StoreSearch.h +++ b/src/StoreSearch.h @@ -47,7 +47,7 @@ public: virtual ~StoreSearch() {} /* not ready yet - void asList(void (*) (List::CBDATA_List; +template cbdata_type CbDataList::CBDATA_CbDataList; /// \endcond /** @@ -82,7 +82,7 @@ template cbdata_type List::CBDATA_List; */ struct as_info { - List *as_number; + CbDataList *as_number; time_t expires; /* NOTUSED */ }; @@ -128,13 +128,13 @@ static OBJH asnStats; /* PUBLIC */ int -asnMatchIp(List *data, IPAddress &addr) +asnMatchIp(CbDataList *data, IPAddress &addr) { struct squid_radix_node *rn; as_info *e; m_ADDR m_addr; - List *a = NULL; - List *b = NULL; + CbDataList *a = NULL; + CbDataList *b = NULL; debugs(53, 3, "asnMatchIp: Called for " << addr ); @@ -174,7 +174,7 @@ asnMatchIp(List *data, IPAddress &addr) void ACLASN::prepareForUse() { - for (List *i = data; i; i = i-> + for (CbDataList *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 **Tail = NULL; - List *q = NULL; + CbDataList **Tail = NULL; + CbDataList *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 (as_number); + q = new CbDataList (as_number); *(Tail) = q; e->e_info = asinfo; } } else { - q = new List (as_number); + q = new CbDataList (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 *prev = NULL; - List *data = e_info->as_number; + CbDataList *prev = NULL; + CbDataList *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 *q; + CbDataList *q; as_info *asinfo; char buf[MAX_IPSTRLEN]; IPAddress addr; @@ -551,7 +551,7 @@ ACLASN::dump() { wordlist *W = NULL; char buf[32]; - List *ldata = data; + CbDataList *ldata = data; while (ldata != NULL) { snprintf(buf, sizeof(buf), "%d", ldata->element); @@ -571,14 +571,14 @@ ACLASN::empty () const void ACLASN::parse() { - List **curlist = &data; - List **Tail; - List *q = NULL; + CbDataList **curlist = &data; + CbDataList **Tail; + CbDataList *q = NULL; char *t = NULL; for (Tail = curlist; *Tail; Tail = &((*Tail)->next)); while ((t = strtokFile())) { - q = new List (atoi(t)); + q = new CbDataList (atoi(t)); *(Tail) = q; Tail = &q->next; } diff --git a/src/comm.cc b/src/comm.cc index 6f07ef0882..63b2c40007 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -2509,13 +2509,13 @@ DeferredReadManager::~DeferredReadManager() { /* explicit instantiation required for some systems */ /// \cond AUTODOCS-IGNORE -template cbdata_type List::CBDATA_List; +template cbdata_type CbDataList::CBDATA_CbDataList; /// \endcond void DeferredReadManager::delayRead(DeferredRead const &aRead) { debugs(5, 3, "Adding deferred read on FD " << aRead.theRead.fd); - List *temp = deferredReads.push_back(aRead); + CbDataList *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 *temp = (List *)thecbdata; + CbDataList *temp = (CbDataList *)thecbdata; temp->element.markCancelled(); } DeferredRead -DeferredReadManager::popHead(ListContainer &deferredReads) { +DeferredReadManager::popHead(CbDataListContainer &deferredReads) { assert (!deferredReads.empty()); if (!deferredReads.head->element.cancelled) @@ -2543,7 +2543,7 @@ DeferredReadManager::popHead(ListContainer &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 reads; + CbDataListContainer reads; reads = deferredReads; - deferredReads = ListContainer(); + deferredReads = CbDataListContainer(); while (!reads.empty()) { DeferredRead aRead = popHead(reads);