]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: update several CBDATA classes
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 19 Jun 2013 04:59:56 +0000 (22:59 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 19 Jun 2013 04:59:56 +0000 (22:59 -0600)
Removes several cbdataAlloc/cbdataFree by updating classes to use
CBDATA_CLASS2 macro..

src/ftp.cc
src/urn.cc

index bcd173a15bbdb1ff09a56383db8471715ee6da8d..fb320b0664587d1e243e353174d1b922c704f377 100644 (file)
@@ -182,12 +182,7 @@ private:
 /// \ingroup ServerProtocolFTPInternal
 class FtpStateData : public ServerStateData
 {
-
 public:
-    void *operator new (size_t);
-    void operator delete (void *);
-    void *toCbdata() { return this; }
-
     FtpStateData(FwdState *, const Comm::ConnectionPointer &conn);
     ~FtpStateData();
     char user[MAX_URL];
@@ -238,9 +233,6 @@ public:
 
     struct _ftp_flags flags;
 
-private:
-    CBDATA_CLASS(FtpStateData);
-
 public:
     // these should all be private
     virtual void start();
@@ -309,25 +301,12 @@ public:
 private:
     // BodyConsumer for HTTP: consume request body.
     virtual void handleRequestBodyProducerAborted();
+
+    CBDATA_CLASS2(FtpStateData);
 };
 
 CBDATA_CLASS_INIT(FtpStateData);
 
-void *
-FtpStateData::operator new (size_t)
-{
-    CBDATA_INIT_TYPE(FtpStateData);
-    FtpStateData *result = cbdataAlloc(FtpStateData);
-    return result;
-}
-
-void
-FtpStateData::operator delete (void *address)
-{
-    FtpStateData *t = static_cast<FtpStateData *>(address);
-    cbdataFree(t);
-}
-
 /// \ingroup ServerProtocolFTPInternal
 typedef struct {
     char type;
index 2d7c964312932760011266a585cdfeca76aeffba..59e61d4a528fa3f992f4111b1cc74abaa85a0f6c 100644 (file)
@@ -31,6 +31,7 @@
  */
 
 #include "squid.h"
+#include "cbdata.h"
 #include "errorpage.h"
 #include "FwdState.h"
 #include "globals.h"
@@ -54,8 +55,6 @@ class UrnState : public StoreClient
 
 public:
     void created (StoreEntry *newEntry);
-    void *operator new (size_t byteCount);
-    void operator delete (void *address);
     void start (HttpRequest *, StoreEntry *);
     char *getHost (String &urlpath);
     void setUriResFromRequest(HttpRequest *);
@@ -79,6 +78,8 @@ public:
 
 private:
     char *urlres;
+
+    CBDATA_CLASS2(UrnState);
 };
 
 typedef struct {
@@ -96,25 +97,9 @@ static url_entry *urnParseReply(const char *inbuf, const HttpRequestMethod&);
 static const char *const crlf = "\r\n";
 static QS url_entry_sort;
 
-CBDATA_TYPE(UrnState);
-void *
-UrnState::operator new (size_t byteCount)
-{
-    /* derived classes with different sizes must implement their own new */
-    assert (byteCount == sizeof (UrnState));
-    CBDATA_INIT_TYPE(UrnState);
-    return cbdataAlloc(UrnState);
-
-}
-
-void
-UrnState::operator delete (void *address)
-{
-    UrnState * tmp = (UrnState *)address;
-    cbdataFree (tmp);
-}
+CBDATA_CLASS_INIT(UrnState);
 
-UrnState::~UrnState ()
+UrnState::~UrnState()
 {
     safe_free(urlres);
 }