]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
mempools-nozero part 1: fix ctors of classes declared MEMPROXY_CLASS
authorFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 24 Aug 2015 14:20:07 +0000 (16:20 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 24 Aug 2015 14:20:07 +0000 (16:20 +0200)
19 files changed:
src/MemObject.cc
src/StoreMeta.cc
src/StoreMeta.h
src/URL.h
src/acl/Acl.cc
src/acl/Acl.h
src/acl/Asn.h
src/acl/DomainData.h
src/acl/UserData.cc
src/auth/AclProxyAuth.cc
src/auth/User.cc
src/auth/negotiate/UserRequest.cc
src/auth/ntlm/UserRequest.cc
src/comm/Connection.cc
src/esi/Esi.cc
src/external_acl.cc
src/fs/ufs/UFSStoreState.h
src/mime.cc
src/url.cc

index a5f90fd1d5f5662b70cbb17edde2c473f1c38cea..a92d14bb7386d38dd568f47688238e5224165460 100644 (file)
@@ -96,16 +96,16 @@ MemObject::MemObject() :
     inmem_lo(0),
     nclients(0),
     smpCollapsed(false),
-    request(NULL),
-    ping_reply_callback(NULL),
-    ircb_data(NULL),
+    request(nullptr),
+    ping_reply_callback(nullptr),
+    ircb_data(nullptr),
     id(0),
     object_sz(-1),
     swap_hdr_sz(0),
 #if URL_CHECKSUM_DEBUG
     chksum(0),
 #endif
-    vary_headers(NULL)
+    vary_headers(nullptr)
 {
     debugs(20, 3, "new MemObject " << this);
     memset(&start_ping, 0, sizeof(start_ping));
index 832710fcd0fdc60c818311af7cb22999c9e5add6..15bab0d04a5b520640dfc8f8428b6fcfe25f1217 100644 (file)
@@ -186,3 +186,16 @@ StoreMeta::checkConsistency(StoreEntry *) const
     return true;
 }
 
+StoreMeta::StoreMeta(const StoreMeta &s) :
+    length(s.length),
+    value(s.value),
+    next(s.next)
+{}
+
+StoreMeta& StoreMeta::operator=(const StoreMeta &s)
+{
+    length=s.length;
+    value=s.value;
+    next=s.next;
+    return *this;
+}
index f47aef03e98b18adcc20dd7b05b4ce0c9df05478..a550c774af18ecfc660dd7d9d8d0fe14380aeb0d 100644 (file)
@@ -111,6 +111,11 @@ enum {
 /// \ingroup SwapStoreAPI
 class StoreMeta
 {
+protected:
+    StoreMeta() : length(-1), value(nullptr), next(nullptr) { }
+    StoreMeta(const StoreMeta &);
+    StoreMeta& operator=(const StoreMeta &);
+
 public:
     static bool validType(char);
     static int const MaximumTLVLength;
index 3c1b1933cb52cba00a754e4123c1834999ea321f..9a0f88e7a06b5320f7310db302faa72b63cfe7e4 100644 (file)
--- a/src/URL.h
+++ b/src/URL.h
@@ -26,8 +26,8 @@ class URL
     MEMPROXY_CLASS(URL);
 
 public:
-    URL() : scheme_(), hostIsNumeric_(false), port_(0) {*host_=0;}
-    URL(AnyP::UriScheme const &aScheme) : scheme_(aScheme), hostIsNumeric_(false), port_(0) {*host_=0;}
+    URL() : hostIsNumeric_(false), port_(0) {*host_=0;}
+    URL(AnyP::UriScheme const &aScheme);
 
     void clear() {
         scheme_=AnyP::PROTO_NONE;
index dcbc5208896347aae6ad08f690fe6a183b0583ee..6961a5803d92418b3fd04e18c333e720d8c78aa1 100644 (file)
@@ -120,8 +120,17 @@ ACL::Factory (char const *type)
 }
 
 ACL::ACL() :
+    cfgline(nullptr),
+    next(nullptr),
+    registered(false)
+{
+    *name = 0;
+}
+
+ACL::ACL(const ACLFlag flgs[]) :
     cfgline(NULL),
     next(NULL),
+    flags(flgs),
     registered(false)
 {
     *name = 0;
@@ -334,9 +343,7 @@ ACL::cacheMatchAcl(dlink_list * cache, ACLChecklist *checklist)
         link = link->next;
     }
 
-    auth_match = new acl_proxy_auth_match_cache();
-    auth_match->matchrv = matchForCache (checklist);
-    auth_match->acl_data = this;
+    auth_match = new acl_proxy_auth_match_cache(matchForCache(checklist), this);
     dlinkAddTail(auth_match, &auth_match->link, cache);
     debugs(28, 4, "ACL::cacheMatchAcl: miss for '" << name << "'. Adding result " << auth_match->matchrv);
     return auth_match->matchrv;
index bedb4d50d37a04df0e8737910eb95901e9cf95ec..879118b1a915b76c76d50bf1c467be7d85a4079e 100644 (file)
@@ -80,9 +80,7 @@ public:
     static ACL *FindByName(const char *name);
 
     ACL();
-    explicit ACL(const ACLFlag flgs[]) : cfgline(NULL), next(NULL), flags(flgs), registered(false) {
-        *name = 0;
-    }
+    explicit ACL(const ACLFlag flgs[]);
     virtual ~ACL();
 
     /// sets user-specified ACL name and squid.conf context
@@ -216,6 +214,11 @@ class acl_proxy_auth_match_cache
     MEMPROXY_CLASS(acl_proxy_auth_match_cache);
 
 public:
+    acl_proxy_auth_match_cache(int matchRv, void * aclData) :
+        matchrv(matchRv),
+        acl_data(aclData)
+    {}
+
     dlink_node link;
     int matchrv;
     void *acl_data;
index 11e8c73e030104bf88087cc989a269172d15f7e1..30e54fb24b6b03adb4c081a992e3bf27530a4f60 100644 (file)
@@ -29,6 +29,7 @@ class ACLASN : public ACLData<Ip::Address>
     MEMPROXY_CLASS(ACLASN);
 
 public:
+    ACLASN() : data(nullptr) {}
     virtual ~ACLASN();
 
     virtual bool match(Ip::Address);
index a3af868d1d6d4fee58e0f8caa927c8e9a932c569..3510978f813eb8d55555ae9d1fef0c0c3ea1502d 100644 (file)
@@ -18,6 +18,7 @@ class ACLDomainData : public ACLData<char const *>
     MEMPROXY_CLASS(ACLDomainData);
 
 public:
+    ACLDomainData() : domains(nullptr) {}
     virtual ~ACLDomainData();
     virtual bool match(char const *);
     virtual SBufList dump() const;
index 0e1feb024decc577c87a0aafa1b47e9464f9b3ae..3497677bea823b94f9f3243b3fac0db90ef96484 100644 (file)
@@ -60,13 +60,8 @@ CaseInsensitveSBufCompare(const SBuf &lhs, const SBuf &rhs)
     return (lhs.caseCmp(rhs) < 0);
 }
 
-static bool
-CaseSensitveSBufCompare(const SBuf &lhs, const SBuf &rhs)
-{
-    return (lhs < rhs);
-}
-
-ACLUserData::ACLUserData() : userDataNames(CaseSensitveSBufCompare)
+ACLUserData::ACLUserData() :
+    userDataNames()
 {
     flags.case_insensitive = false;
     flags.required = false;
index afe2d13d2b8e2b558e203a1d824613eb03b7c403..a3d5886897c072ed3632bb1031265ec7609222ce 100644 (file)
@@ -25,9 +25,14 @@ ACLProxyAuth::~ACLProxyAuth()
     delete data;
 }
 
-ACLProxyAuth::ACLProxyAuth(ACLData<char const *> *newData, char const *theType) : data(newData), type_(theType) {}
+ACLProxyAuth::ACLProxyAuth(ACLData<char const *> *newData, char const *theType) :
+    data(newData),
+    type_(theType)
+{}
 
-ACLProxyAuth::ACLProxyAuth(ACLProxyAuth const &old) : data(old.data->clone()), type_(old.type_)
+ACLProxyAuth::ACLProxyAuth(ACLProxyAuth const &old) :
+    data(old.data->clone()),
+    type_(old.type_)
 {}
 
 ACLProxyAuth &
index 48080993721c3cf011b11f7fb5859c9123a4e7bc..a826807a2413b2acdfc02373cf107ef8ee0f6209 100644 (file)
@@ -28,9 +28,8 @@ Auth::User::User(Auth::Config *aConfig, const char *aRequestRealm) :
     config(aConfig),
     ipcount(0),
     expiretime(0),
-    notes(),
     credentials_state(Auth::Unchecked),
-    username_(NULL),
+    username_(nullptr),
     requestRealm_(aRequestRealm)
 {
     proxy_match_cache.head = proxy_match_cache.tail = NULL;
index 2b49dd70048d563ecaf5a8b9b8c0d1c092558f95..0028915788e6363a948e915cf9e347b7cb5066f3 100644 (file)
 #include "MemBuf.h"
 #include "SquidTime.h"
 
-Auth::Negotiate::UserRequest::UserRequest()
-{
-    waiting=0;
-    client_blob=0;
-    server_blob=0;
-    authserver=NULL;
-    request=NULL;
-}
+Auth::Negotiate::UserRequest::UserRequest() :
+    authserver(nullptr),
+    server_blob(nullptr),
+    client_blob(nullptr),
+    waiting(0),
+    request(nullptr)
+{}
 
 Auth::Negotiate::UserRequest::~UserRequest()
 {
index 1f4024eebd4b6ae494c55fe45be50a56db1a5468..40fe619d545bea605429a439d542e0a6e86e04e8 100644 (file)
 #include "MemBuf.h"
 #include "SquidTime.h"
 
-Auth::Ntlm::UserRequest::UserRequest()
-{
-    waiting=0;
-    client_blob=0;
-    server_blob=0;
-    authserver=NULL;
-    request=NULL;
-}
+Auth::Ntlm::UserRequest::UserRequest() :
+    authserver(nullptr),
+    server_blob(nullptr),
+    client_blob(nullptr),
+    waiting(0),
+    request(nullptr)
+{}
 
 Auth::Ntlm::UserRequest::~UserRequest()
 {
index 61410fb1ea47aa2b3b321a7627703584a0025083..f5123e1622846fd4e7bc14f1daaca805fac44cdb 100644 (file)
@@ -24,14 +24,12 @@ Comm::IsConnOpen(const Comm::ConnectionPointer &conn)
 }
 
 Comm::Connection::Connection() :
-    local(),
-    remote(),
     peerType(HIER_NONE),
     fd(-1),
     tos(0),
     nfmark(0),
     flags(COMM_NONBLOCKING),
-    peer_(NULL),
+    peer_(nullptr),
     startTime_(squid_curtime)
 {
     *rfc931 = 0; // quick init the head. the rest does not matter.
index d01b41eab65f4a961f9f3e2e7b4c5bc2b7d99226..106877d25760482d44f59720e32938e6f4c6abb2 100644 (file)
@@ -1484,11 +1484,10 @@ esiLiteral::~esiLiteral()
     cbdataReferenceDone (varState);
 }
 
-esiLiteral::esiLiteral(ESISegment::Pointer aSegment)
+esiLiteral::esiLiteral(ESISegment::Pointer aSegment) :
+    buffer(aSegment),
+    varState(nullptr)
 {
-    buffer = aSegment;
-    /* we've been handed a complete, processed string */
-    varState = NULL;
     /* Nothing to do */
     flags.donevars = 1;
 }
@@ -1881,7 +1880,10 @@ esiChoose::~esiChoose()
     debugs(86, 5, "esiChoose::~esiChoose " << this);
 }
 
-esiChoose::esiChoose(esiTreeParentPtr aParent) : elements (), chosenelement (-1),parent (aParent)
+esiChoose::esiChoose(esiTreeParentPtr aParent) :
+    elements(),
+    chosenelement(-1),
+    parent(aParent)
 {}
 
 void
index 08a4ff6e3fb11155826831558edbae06d7884743..70fbd6f247bd884f6823d87a2cec398259590fc2 100644 (file)
@@ -73,7 +73,13 @@ class external_acl_format : public RefCountable
 public:
     typedef RefCount<external_acl_format> Pointer;
 
-    external_acl_format() : type(Format::LFT_NONE), header(NULL), member(NULL), separator(' '), header_id(Http::HdrType::BAD_HDR) {}
+    external_acl_format() :
+        type(Format::LFT_NONE),
+        header(nullptr),
+        member(nullptr),
+        separator(' '),
+        header_id(Http::HdrType::BAD_HDR)
+    {}
     ~external_acl_format() {
         xfree(header);
         xfree(member);
index fcfbdf4648f67936f5c6cf07dfaa7a39c0d76f77..c1fbe88ba4fecf378268939ad740d8c1b001d2b5 100644 (file)
@@ -48,7 +48,13 @@ protected:
     {
         MEMPROXY_CLASS(UFSStoreState::_queued_read);
     public:
-        _queued_read() : buf(NULL), size(0), offset(0), callback(NULL), callback_data(NULL) {}
+        _queued_read() :
+            buf(nullptr),
+            size(0),
+            offset(0),
+            callback(nullptr),
+            callback_data(nullptr)
+        {}
 
         char *buf;
         size_t size;
@@ -61,7 +67,12 @@ protected:
     {
         MEMPROXY_CLASS(UFSStoreState::_queued_write);
     public:
-        _queued_write() : buf(NULL), size(0), offset(0), free_func(NULL) {}
+        _queued_write() :
+            buf(nullptr),
+            size(0),
+            offset(0),
+            free_func(nullptr)
+        {}
 
         char const *buf;
         size_t size;
index ec8d77d11f879e836cee18b7df48cb573b9bbb3a..0179f14cef1954ead5b7faad39788fab596a24b7 100644 (file)
@@ -116,9 +116,9 @@ mimeGetEntry(const char *fn, int skip_encodings)
 }
 
 MimeIcon::MimeIcon(const char *aName) :
-    icon_(aName)
+    url_(nullptr)
 {
-    url_ = xstrdup(internalLocalUri("/squid-internal-static/icons/", icon_));
+    setName(aName);
 }
 
 MimeIcon::~MimeIcon()
index 43a5a362fcfba358ab78b54a1df4052e3090d2cb..accd7e896fab5723f109619f3a74ed1afc864a0a 100644 (file)
@@ -916,3 +916,10 @@ URLHostName::extract(char const *aUrl)
     return Host;
 }
 
+URL::URL(AnyP::UriScheme const &aScheme) :
+    scheme_(aScheme),
+    hostIsNumeric_(false),
+    port_(0)
+{
+    *host_=0;
+}