]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: Remove last CBDATA_CLASS() macros
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 29 Jun 2013 04:21:47 +0000 (22:21 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 29 Jun 2013 04:21:47 +0000 (22:21 -0600)
Update the final CBDATA_CLASS() macro usages to CBDATA_CLASS2() and
remove the now defunct macro.

include/CbDataList.h
src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc
src/DiskIO/DiskThreads/DiskThreadsDiskFile.h
src/PeerSelectState.h
src/cbdata.h
src/peer_select.cc

index a7376416e25ccfa840715374bd41c1b7edf37ef5..97ff706fe357b3101cfe696d7b7617ddf3aa96cb 100644 (file)
@@ -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 <class C>
 cbdata_type CbDataList<C>::CBDATA_CbDataList = CBDATA_UNKNOWN;
 /** \endcond */
 
-template <class C>
-void *
-CbDataList<C>::operator new (size_t byteCount)
-{
-    CBDATA_INIT_TYPE(CbDataList);
-
-    CbDataList<C> *result = cbdataAlloc(CbDataList);
-
-    return result;
-}
-
-template <class C>
-void
-CbDataList<C>::operator delete (void *address)
-{
-    cbdataFree(address);
-}
-
 template <class C>
 CbDataList<C>::CbDataList(C const &value) : next(NULL), element (value)
 {}
index dca393085053f9edd1f2b8f167e544f2f5d23cf9..bc16d41518ff5d9fc9ae7d77948729a2f2f10780 100644 (file)
@@ -354,19 +354,3 @@ DiskThreadsDiskFile::writeDone(int rvfd, int errflag, size_t len, RefCount<Write
 template <class RT>
 cbdata_type IoResult<RT>::CBDATA_IoResult = CBDATA_UNKNOWN;
 /** \endcond */
-
-template<class RT>
-void *
-IoResult<RT>::operator new(size_t unused)
-{
-    CBDATA_INIT_TYPE(IoResult);
-    IoResult<RT> *result = cbdataAlloc(IoResult);
-    return result;
-}
-
-template <class RT>
-void
-IoResult<RT>::operator delete(void *address)
-{
-    cbdataFree(address);
-}
index 01b86ca6724bf8e8ddf8ddaed6d2440167b51c21..6e56ade7234999fa50cc218c83a7818f1b753791 100644 (file)
@@ -94,15 +94,13 @@ class IoResult
 {
 
 public:
-    void * operator new (size_t);
-    void operator delete (void *);
     IoResult(RefCount<DiskThreadsDiskFile> aFile, RefCount<RT> aRequest) : file(aFile), request(aRequest) {}
 
     RefCount<DiskThreadsDiskFile> file;
     RefCount<RT> request;
 
 private:
-    CBDATA_CLASS(IoResult);
+    CBDATA_CLASS2(IoResult);
 };
 
 template <class RT>
index 1ad666d4bdc071e4b7408eaee2c616de70301bed..2328279930b6de9373eb131437c4da4f9b9429ce 100644 (file)
@@ -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 */
index a30cfff4bf4f86340bd36ed4a6468ccb279e9a58..51de95e2d0d919a6058709e8dd5de5ce90f40a49 100644 (file)
@@ -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
index 440319483cde7e5889f67ca9817c3b86e7b232b5..7746de51e3199ca697d55e15752d3eb6ffe3610f 100644 (file)
@@ -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),