From: Amos Jeffries Date: Sat, 29 Jun 2013 04:21:47 +0000 (-0600) Subject: Cleanup: Remove last CBDATA_CLASS() macros X-Git-Tag: SQUID_3_4_0_1~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=029c83497022f48b98f6c9da09971a5293819cf3;p=thirdparty%2Fsquid.git Cleanup: Remove last CBDATA_CLASS() macros Update the final CBDATA_CLASS() macro usages to CBDATA_CLASS2() and remove the now defunct macro. --- diff --git a/include/CbDataList.h b/include/CbDataList.h index a7376416e2..97ff706fe3 100644 --- a/include/CbDataList.h +++ b/include/CbDataList.h @@ -39,8 +39,6 @@ class CbDataList { public: - void *operator new (size_t); - void operator delete (void *); CbDataList (C const &); ~CbDataList(); @@ -57,7 +55,7 @@ public: bool empty() const { return this == NULL; } private: - CBDATA_CLASS(CbDataList); + CBDATA_CLASS2(CbDataList); }; /// \ingroup POD @@ -102,24 +100,6 @@ template cbdata_type CbDataList::CBDATA_CbDataList = CBDATA_UNKNOWN; /** \endcond */ -template -void * -CbDataList::operator new (size_t byteCount) -{ - CBDATA_INIT_TYPE(CbDataList); - - CbDataList *result = cbdataAlloc(CbDataList); - - return result; -} - -template -void -CbDataList::operator delete (void *address) -{ - cbdataFree(address); -} - template CbDataList::CbDataList(C const &value) : next(NULL), element (value) {} diff --git a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc index dca3930850..bc16d41518 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc +++ b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc @@ -354,19 +354,3 @@ DiskThreadsDiskFile::writeDone(int rvfd, int errflag, size_t len, RefCount cbdata_type IoResult::CBDATA_IoResult = CBDATA_UNKNOWN; /** \endcond */ - -template -void * -IoResult::operator new(size_t unused) -{ - CBDATA_INIT_TYPE(IoResult); - IoResult *result = cbdataAlloc(IoResult); - return result; -} - -template -void -IoResult::operator delete(void *address) -{ - cbdataFree(address); -} diff --git a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.h b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.h index 01b86ca672..6e56ade723 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.h +++ b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.h @@ -94,15 +94,13 @@ class IoResult { public: - void * operator new (size_t); - void operator delete (void *); IoResult(RefCount aFile, RefCount aRequest) : file(aFile), request(aRequest) {} RefCount file; RefCount request; private: - CBDATA_CLASS(IoResult); + CBDATA_CLASS2(IoResult); }; template diff --git a/src/PeerSelectState.h b/src/PeerSelectState.h index 1ad666d4bd..2328279930 100644 --- a/src/PeerSelectState.h +++ b/src/PeerSelectState.h @@ -71,8 +71,8 @@ class ps_state { public: - void *operator new(size_t); ps_state(); + ~ps_state(); // Produce a URL for display identifying the transaction we are // trying to locate a peer for. @@ -110,7 +110,7 @@ public: ping_data ping; ACLChecklist *acl_checklist; private: - CBDATA_CLASS(ps_state); + CBDATA_CLASS2(ps_state); }; #endif /* SQUID_PEERSELECTSTATE_H */ diff --git a/src/cbdata.h b/src/cbdata.h index a30cfff4bf..51de95e2d0 100644 --- a/src/cbdata.h +++ b/src/cbdata.h @@ -374,9 +374,6 @@ cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size, */ #define cbdataReferenceDone(var) do {if (var) {cbdataInternalUnlock(var); var = NULL;}} while(0) -/// \ingroup CBDATAAPI -#define CBDATA_CLASS(type) static cbdata_type CBDATA_##type - /// \ingroup CBDATAAPI #define CBDATA_CLASS_INIT(type) cbdata_type type::CBDATA_##type = CBDATA_UNKNOWN #define CBDATA_NAMESPACED_CLASS_INIT(namespace, type) cbdata_type namespace::type::CBDATA_##type = CBDATA_UNKNOWN diff --git a/src/peer_select.cc b/src/peer_select.cc index 440319483c..7746de51e3 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -71,7 +71,6 @@ static const char *DirectStr[] = { static void peerSelectFoo(ps_state *); static void peerPingTimeout(void *data); static IRCB peerHandlePingReply; -static void peerSelectStateFree(ps_state * psstate); static void peerIcpParentMiss(CachePeer *, icp_common_t *, ps_state *); #if USE_HTCP static void peerHtcpParentMiss(CachePeer *, HtcpReplyData *, ps_state *); @@ -89,34 +88,31 @@ static void peerSelectDnsResults(const ipcache_addrs *ia, const DnsLookupDetails CBDATA_CLASS_INIT(ps_state); -static void -peerSelectStateFree(ps_state * psstate) +ps_state::~ps_state() { - if (psstate->entry) { - debugs(44, 3, HERE << psstate->entry->url()); + if (entry) { + debugs(44, 3, entry->url()); - if (psstate->entry->ping_status == PING_WAITING) - eventDelete(peerPingTimeout, psstate); + if (entry->ping_status == PING_WAITING) + eventDelete(peerPingTimeout, this); - psstate->entry->ping_status = PING_DONE; + entry->ping_status = PING_DONE; } - if (psstate->acl_checklist) { - debugs(44, DBG_IMPORTANT, "calling aclChecklistFree() from peerSelectStateFree"); - delete (psstate->acl_checklist); + if (acl_checklist) { + debugs(44, DBG_IMPORTANT, "calling aclChecklistFree() from ps_state destructor"); + delete acl_checklist; } - HTTPMSGUNLOCK(psstate->request); + HTTPMSGUNLOCK(request); - if (psstate->entry) { - assert(psstate->entry->ping_status != PING_WAITING); - psstate->entry->unlock(); - psstate->entry = NULL; + if (entry) { + assert(entry->ping_status != PING_WAITING); + entry->unlock(); + entry = NULL; } - delete psstate->lastError; - - cbdataFree(psstate); + delete lastError; } static int @@ -313,7 +309,7 @@ peerSelectDnsPaths(ps_state *psstate) psstate->lastError = NULL; // FwdState has taken control over the ErrorState object. } - peerSelectStateFree(psstate); + delete psstate; } static void @@ -753,7 +749,7 @@ peerPingTimeout(void *data) /* request aborted */ entry->ping_status = PING_DONE; cbdataReferenceDone(psstate->callback_data); - peerSelectStateFree(psstate); + delete psstate; return; } @@ -943,13 +939,6 @@ peerAddFwdServer(FwdServer ** FSVR, CachePeer * p, hier_code code) *FSVR = fs; } -void * -ps_state::operator new(size_t) -{ - CBDATA_INIT_TYPE(ps_state); - return cbdataAlloc(ps_state); -} - ps_state::ps_state() : request (NULL), entry (NULL), always_direct(Config.accessList.AlwaysDirect?ACCESS_DUNNO:ACCESS_DENIED),