You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2019/03/27 11:44:49 UTC
[trafficserver] branch master updated: Ran clang-tidy with
modernize-use-default-member-init
This is an automated email from the ASF dual-hosted git repository.
masaori pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 7651e26 Ran clang-tidy with modernize-use-default-member-init
7651e26 is described below
commit 7651e269d638f1d83882558b86e3064282d21976
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Tue Mar 19 15:44:19 2019 +0900
Ran clang-tidy with modernize-use-default-member-init
1. Remove unmatched #endif and set `_location` nullptr.
- iocore/eventsystem/I_IOBuffer.h
- iocore/eventsystem/P_IOBuffer.h
2. Include "ts/apidefs.h"
- include/tscpp/api/Stat.h
3. Rollback changes made with -fix-error option (clang-diagnostic-implicit-function-declaration)
- plugins/lua/ts_lua_client_request.c
- plugins/lua/ts_lua_client_response.c
- plugins/lua/ts_lua_server_response.c
- plugins/experimental/remap_stats/remap_stats.c
---
.clang-tidy | 5 +-
example/cppapi/websocket/WSBuffer.cc | 2 +-
example/cppapi/websocket/WSBuffer.h | 2 +-
example/intercept/intercept.cc | 12 +-
example/passthru/passthru.cc | 8 +-
include/tscore/Arena.h | 4 +-
include/tscore/HashMD5.h | 4 +-
include/tscore/IpMap.h | 4 +-
include/tscore/List.h | 4 +-
include/tscore/MT_hashtable.h | 4 +-
include/tscore/PriorityQueue.h | 6 +-
include/tscore/Ptr.h | 6 +-
include/tscore/RbTree.h | 14 +-
include/tscore/SimpleTokenizer.h | 13 +-
include/tscore/TsBuffer.h | 12 +-
include/tscore/ink_cap.h | 2 +-
include/tscore/ink_inet.h | 4 +-
include/tscore/ink_lockfile.h | 6 +-
include/tscore/ink_string++.h | 10 +-
include/tscore/ink_uuid.h | 4 +-
include/tscpp/api/Continuation.h | 4 +-
include/tscpp/api/Stat.h | 4 +-
include/tscpp/util/MemSpan.h | 2 +-
include/wccp/Wccp.h | 6 +-
iocore/cache/Cache.cc | 2 +-
iocore/cache/CacheHttp.cc | 2 +-
iocore/cache/I_Cache.h | 9 +-
iocore/cache/I_Store.h | 32 +-
iocore/cache/P_CacheDir.h | 27 +-
iocore/cache/P_CacheDisk.h | 6 +-
iocore/cache/P_CacheHosting.h | 34 +-
iocore/cache/P_CacheHttp.h | 4 +-
iocore/cache/P_CacheInternal.h | 30 +-
iocore/cache/P_CacheTest.h | 14 +-
iocore/cache/P_CacheVol.h | 16 +-
iocore/cache/RamCacheCLFUS.cc | 38 +--
iocore/cache/Store.cc | 2 +-
iocore/dns/DNS.cc | 2 +-
iocore/dns/DNSConnection.cc | 3 +-
iocore/dns/I_DNSProcessor.h | 12 +-
iocore/dns/P_DNSConnection.h | 26 +-
iocore/dns/P_DNSProcessor.h | 32 +-
iocore/dns/P_SplitDNSProcessor.h | 28 +-
iocore/dns/SplitDNS.cc | 6 +-
iocore/eventsystem/I_EThread.h | 22 +-
iocore/eventsystem/I_IOBuffer.h | 53 +--
iocore/eventsystem/I_ProxyAllocator.h | 6 +-
iocore/eventsystem/I_VIO.h | 10 +-
iocore/eventsystem/P_IOBuffer.h | 7 -
iocore/eventsystem/P_VIO.h | 4 +-
iocore/hostdb/HostDB.cc | 6 +-
iocore/hostdb/I_HostDBProcessor.h | 22 +-
iocore/hostdb/P_HostDBProcessor.h | 30 +-
iocore/hostdb/P_RefCountCache.h | 6 +-
iocore/hostdb/RefCountCache.cc | 3 +-
iocore/net/Connection.cc | 2 +-
iocore/net/I_NetVConnection.h | 31 +-
iocore/net/I_Socks.h | 4 +-
iocore/net/NetVCTest.cc | 34 +-
iocore/net/P_Connection.h | 14 +-
iocore/net/P_NetVCTest.h | 60 ++--
iocore/net/P_SNIActionPerformer.h | 4 +-
iocore/net/P_SSLCertLookup.h | 16 +-
iocore/net/P_SSLNextProtocolSet.h | 4 +-
iocore/net/P_SSLUtils.h | 7 +-
iocore/net/P_Socks.h | 34 +-
iocore/net/P_UDPConnection.h | 13 +-
iocore/net/P_UDPIOEvent.h | 14 +-
iocore/net/P_UDPNet.h | 6 +-
iocore/net/P_UDPPacket.h | 16 +-
iocore/net/P_UnixNetState.h | 8 +-
iocore/net/P_UnixNetVConnection.h | 24 +-
iocore/net/SSLCertLookup.cc | 6 +-
iocore/net/SSLNextProtocolSet.cc | 2 +-
iocore/net/SSLSessionCache.cc | 2 +-
iocore/net/SSLSessionCache.h | 2 +-
iocore/net/UnixNetVConnection.cc | 16 +-
iocore/net/UnixUDPNet.cc | 9 +-
iocore/utils/I_OneWayTunnel.h | 26 +-
iocore/utils/OneWayTunnel.cc | 17 +-
lib/records/I_RecHttp.h | 18 +-
lib/records/RecHttp.cc | 12 +-
lib/tsconfig/Errata.h | 4 +-
lib/tsconfig/TsBuilder.h | 6 +-
lib/tsconfig/TsValue.h | 12 +-
plugins/authproxy/authproxy.cc | 40 +--
plugins/cache_promote/cache_promote.cc | 16 +-
plugins/cachekey/configs.h | 8 +-
plugins/cachekey/pattern.cc | 2 +-
plugins/cachekey/pattern.h | 10 +-
plugins/conf_remap/conf_remap.cc | 4 +-
plugins/escalate/escalate.cc | 4 +-
plugins/esi/combo_handler.cc | 16 +-
plugins/esi/fetcher/HttpDataFetcherImpl.h | 16 +-
plugins/esi/serverIntercept.cc | 8 +-
plugins/esi/test/TestHttpDataFetcher.h | 6 +-
plugins/experimental/access_control/pattern.cc | 2 +-
plugins/experimental/access_control/pattern.h | 10 +-
plugins/experimental/balancer/roundrobin.cc | 4 +-
plugins/experimental/cookie_remap/cookie_remap.cc | 26 +-
plugins/experimental/geoip_acl/acl.h | 10 +-
plugins/experimental/hipes/hipes.cc | 28 +-
plugins/experimental/inliner/chunk-decoder.h | 6 +-
plugins/experimental/inliner/fetcher.h | 4 +-
plugins/experimental/inliner/html-parser.h | 10 +-
plugins/experimental/inliner/ts.h | 10 +-
plugins/experimental/magick/magick.cc | 8 +-
plugins/experimental/memcache/tsmemcache.h | 6 +-
plugins/experimental/mp4/mp4_common.h | 8 +-
plugins/experimental/mp4/mp4_meta.h | 126 +++----
plugins/experimental/multiplexer/fetcher.h | 4 +-
plugins/experimental/multiplexer/ts.h | 6 +-
plugins/experimental/prefetch/configs.h | 15 +-
plugins/experimental/prefetch/fetch.cc | 2 +-
plugins/experimental/prefetch/fetch.h | 14 +-
plugins/experimental/prefetch/fetch_policy_lru.h | 6 +-
plugins/experimental/prefetch/pattern.cc | 2 +-
plugins/experimental/prefetch/pattern.h | 6 +-
plugins/experimental/prefetch/plugin.cc | 4 +-
plugins/experimental/slice/ContentRange.h | 8 +-
plugins/experimental/slice/Range.h | 6 +-
.../experimental/ssl_session_reuse/src/publish.cc | 6 +-
.../experimental/ssl_session_reuse/src/publisher.h | 4 +-
.../experimental/ssl_session_reuse/src/ssl_init.cc | 2 +-
.../experimental/ssl_session_reuse/src/ssl_utils.h | 2 +-
plugins/experimental/sslheaders/sslheaders.cc | 3 +-
plugins/experimental/sslheaders/sslheaders.h | 8 +-
.../experimental/stream_editor/stream_editor.cc | 16 +-
plugins/generator/generator.cc | 14 +-
plugins/regex_remap/regex_remap.cc | 74 ++--
plugins/s3_auth/aws_auth_v4_wrap.h | 4 +-
proxy/CacheControl.h | 48 +--
proxy/ControlBase.h | 4 +-
proxy/ControlMatcher.h | 28 +-
proxy/InkAPIInternal.h | 4 +-
proxy/Plugin.cc | 5 +-
proxy/Plugin.h | 12 +-
proxy/PluginVC.cc | 6 +-
proxy/PluginVC.h | 36 +-
proxy/ProxyClientTransaction.cc | 10 +-
proxy/ProxyClientTransaction.h | 10 +-
proxy/StatPages.h | 12 +-
proxy/Transform.cc | 3 +-
proxy/Transform.h | 8 +-
proxy/TransformInternal.h | 6 +-
proxy/hdrs/HTTP.cc | 15 +-
proxy/hdrs/HTTP.h | 24 +-
proxy/hdrs/HdrHeap.h | 12 +-
proxy/hdrs/HdrTest.h | 4 +-
proxy/hdrs/MIME.h | 6 +-
proxy/hdrs/URL.h | 4 +-
proxy/http/Http1ClientSession.cc | 19 +-
proxy/http/Http1ClientSession.h | 30 +-
proxy/http/HttpCacheSM.cc | 24 +-
proxy/http/HttpCacheSM.h | 38 +--
proxy/http/HttpConfig.h | 379 +++++++--------------
proxy/http/HttpProxyServerMain.cc | 4 +-
proxy/http/HttpSM.h | 6 +-
proxy/http/HttpSessionAccept.h | 10 +-
proxy/http/HttpSessionManager.h | 4 +-
proxy/http/HttpTunnel.cc | 66 +---
proxy/http/HttpTunnel.h | 110 +++---
proxy/http/HttpUpdateSM.cc | 2 +-
proxy/http/HttpUpdateSM.h | 4 +-
proxy/http/remap/AclFiltering.cc | 3 +-
proxy/http/remap/AclFiltering.h | 10 +-
proxy/http/remap/RemapConfig.cc | 2 +-
proxy/http/remap/RemapConfig.h | 14 +-
proxy/http/remap/RemapProcessor.h | 6 +-
proxy/http/remap/UrlMapping.h | 18 +-
proxy/http2/HPACK.h | 8 +-
proxy/http2/HTTP2.h | 23 +-
proxy/http2/Http2ClientSession.h | 4 +-
proxy/logging/LogConfig.cc | 14 +-
proxy/logging/LogConfig.h | 20 +-
proxy/logging/LogField.cc | 2 +-
proxy/logging/LogField.h | 2 +-
proxy/logging/LogFieldAliasMap.h | 18 +-
proxy/logging/LogFilter.cc | 2 +-
proxy/logging/LogFilter.h | 2 +-
proxy/logging/LogObject.h | 4 +-
proxy/logging/LogSock.cc | 2 +-
proxy/logging/LogSock.h | 4 +-
src/traffic_logstats/logstats.cc | 52 ++-
src/traffic_server/traffic_server.cc | 55 ++-
src/tscore/BaseLogFile.cc | 10 +-
src/tscore/HashMD5.cc | 2 +-
src/tscore/ink_cap.cc | 3 +-
src/tscore/ink_resource.cc | 10 +-
src/tscpp/api/Headers.cc | 10 +-
src/tscpp/api/InterceptPlugin.cc | 8 +-
src/tscpp/api/Logger.cc | 23 +-
src/tscpp/api/Request.cc | 22 +-
src/tscpp/api/Response.cc | 6 +-
src/tscpp/api/Stat.cc | 2 +-
195 files changed, 1180 insertions(+), 1787 deletions(-)
diff --git a/.clang-tidy b/.clang-tidy
index a1ea4a3..996a488 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,2 +1,5 @@
-Checks: -*,modernize-loop-convert,modernize-use-bool-literals,modernize-deprecated-headers,performance-unnecessary-value-param,performance-faster-string-find,modernize-raw-string-literal,modernize-redundant-void-arg,modernize-use-nullptr,modernize-use-override
+Checks: -*,modernize-use-default-member-init,modernize-loop-convert,modernize-use-bool-literals,modernize-deprecated-headers,performance-unnecessary-value-param,performance-faster-string-find,modernize-raw-string-literal,modernize-redundant-void-arg,modernize-use-nullptr,modernize-use-override
+CheckOptions:
+ - key: modernize-use-default-member-init.UseAssignment
+ value: '1'
HeaderFilterRegex: (?!(\/openssl\/|\/pcre\/|\/lib\/yaml\/)).*
diff --git a/example/cppapi/websocket/WSBuffer.cc b/example/cppapi/websocket/WSBuffer.cc
index 66e4f80..f6e6899 100644
--- a/example/cppapi/websocket/WSBuffer.cc
+++ b/example/cppapi/websocket/WSBuffer.cc
@@ -56,7 +56,7 @@
static const std::string magic = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
-WSBuffer::WSBuffer() : frame_(0) {}
+WSBuffer::WSBuffer() {}
void
WSBuffer::buffer(std::string const &data)
diff --git a/example/cppapi/websocket/WSBuffer.h b/example/cppapi/websocket/WSBuffer.h
index 4b12f16..cf7bdc5 100644
--- a/example/cppapi/websocket/WSBuffer.h
+++ b/example/cppapi/websocket/WSBuffer.h
@@ -84,6 +84,6 @@ public:
private:
std::string ws_buf_; // incoming data.
- int frame_; // frame type of current message
+ int frame_ = 0; // frame type of current message
std::string msg_buf_; // decoded message data
};
diff --git a/example/intercept/intercept.cc b/example/intercept/intercept.cc
index 8369667..c793e19 100644
--- a/example/intercept/intercept.cc
+++ b/example/intercept/intercept.cc
@@ -70,11 +70,11 @@ static int InterceptTxnHook(TSCont contp, TSEvent event, void *edata);
// a write). We need two of these for each TSVConn; one to push
// data into the TSVConn and one to pull data out.
struct InterceptIOChannel {
- TSVIO vio;
- TSIOBuffer iobuf;
- TSIOBufferReader reader;
+ TSVIO vio = nullptr;
+ TSIOBuffer iobuf = nullptr;
+ TSIOBufferReader reader = nullptr;
- InterceptIOChannel() : vio(nullptr), iobuf(nullptr), reader(nullptr) {}
+ InterceptIOChannel() {}
~InterceptIOChannel()
{
if (this->reader) {
@@ -130,12 +130,12 @@ struct InterceptIO {
// are intercepting is the server. Hence the "client" and
// "server" nomenclature here.
struct InterceptState {
- TSHttpTxn txn; // The transaction on whose behalf we are intercepting.
+ TSHttpTxn txn = nullptr; // The transaction on whose behalf we are intercepting.
InterceptIO client; // Server intercept VC state.
InterceptIO server; // Intercept origin VC state.
- InterceptState() : txn(nullptr) {}
+ InterceptState() {}
~InterceptState() {}
};
diff --git a/example/passthru/passthru.cc b/example/passthru/passthru.cc
index 09f386f..587f35a 100644
--- a/example/passthru/passthru.cc
+++ b/example/passthru/passthru.cc
@@ -53,11 +53,11 @@ union EventArgument {
};
struct PassthruIO {
- TSVIO vio;
- TSIOBuffer iobuf;
- TSIOBufferReader reader;
+ TSVIO vio = nullptr;
+ TSIOBuffer iobuf = nullptr;
+ TSIOBufferReader reader = nullptr;
- PassthruIO() : vio(nullptr), iobuf(nullptr), reader(nullptr) {}
+ PassthruIO() {}
~PassthruIO() { clear(); }
void
clear()
diff --git a/include/tscore/Arena.h b/include/tscore/Arena.h
index c885c98..6d359bd 100644
--- a/include/tscore/Arena.h
+++ b/include/tscore/Arena.h
@@ -37,7 +37,7 @@ struct ArenaBlock {
class Arena
{
public:
- Arena() : m_blocks(nullptr) {}
+ Arena() {}
~Arena() { reset(); }
inkcoreapi void *alloc(size_t size, size_t alignment = sizeof(double));
void free(void *mem, size_t size);
@@ -49,7 +49,7 @@ public:
inkcoreapi void reset();
private:
- ArenaBlock *m_blocks;
+ ArenaBlock *m_blocks = nullptr;
};
/*-------------------------------------------------------------------------
diff --git a/include/tscore/HashMD5.h b/include/tscore/HashMD5.h
index 1447786..09c7bd6 100644
--- a/include/tscore/HashMD5.h
+++ b/include/tscore/HashMD5.h
@@ -36,6 +36,6 @@ struct ATSHashMD5 : ATSHash {
private:
EVP_MD_CTX *ctx;
unsigned char md_value[EVP_MAX_MD_SIZE];
- unsigned int md_len;
- bool finalized;
+ unsigned int md_len = 0;
+ bool finalized = false;
};
diff --git a/include/tscore/IpMap.h b/include/tscore/IpMap.h
index 754f506..568374e 100644
--- a/include/tscore/IpMap.h
+++ b/include/tscore/IpMap.h
@@ -123,7 +123,7 @@ public:
public:
using self_type = Node; ///< Self reference type.
/// Default constructor.
- Node() : _data(nullptr) {}
+ Node() {}
/// Construct with @a data.
Node(void *data) : _data(data) {}
/// @return Client data for the node.
@@ -146,7 +146,7 @@ public:
virtual sockaddr const *max() const = 0;
protected:
- void *_data; ///< Client data.
+ void *_data = nullptr; ///< Client data.
};
/** Iterator over nodes / intervals.
diff --git a/include/tscore/List.h b/include/tscore/List.h
index aeea32b..25bfac5 100644
--- a/include/tscore/List.h
+++ b/include/tscore/List.h
@@ -506,8 +506,8 @@ template <class C, class L = typename C::Link_link> struct SortableQueue : publi
//
template <class C, class L = typename C::Link_link> struct CountQueue : public Queue<C, L> {
- int size;
- inline CountQueue() : size(0) {}
+ int size = 0;
+ inline CountQueue() {}
inline void push(C *e);
inline C *pop();
inline void enqueue(C *e);
diff --git a/include/tscore/MT_hashtable.h b/include/tscore/MT_hashtable.h
index f3b7c91..cb6a80d 100644
--- a/include/tscore/MT_hashtable.h
+++ b/include/tscore/MT_hashtable.h
@@ -69,8 +69,8 @@ struct MT_ListEntry{
template <class key_t, class data_t> class HashTableIteratorState
{
public:
- HashTableIteratorState() : cur_buck(-1), ppcur(NULL) {}
- int cur_buck;
+ HashTableIteratorState() : ppcur(NULL) {}
+ int cur_buck = -1;
HashTableEntry<key_t, data_t> **ppcur;
};
diff --git a/include/tscore/PriorityQueue.h b/include/tscore/PriorityQueue.h
index 3d2c0d3..e1111da 100644
--- a/include/tscore/PriorityQueue.h
+++ b/include/tscore/PriorityQueue.h
@@ -28,9 +28,9 @@
#include <algorithm>
template <typename T> struct PriorityQueueEntry {
- PriorityQueueEntry(T n) : index(0), node(n){};
- PriorityQueueEntry() : index(0), node(NULL){};
- uint32_t index;
+ PriorityQueueEntry(T n) : node(n){};
+ PriorityQueueEntry() : node(NULL){};
+ uint32_t index = 0;
T node;
};
diff --git a/include/tscore/Ptr.h b/include/tscore/Ptr.h
index d067604..559f346 100644
--- a/include/tscore/Ptr.h
+++ b/include/tscore/Ptr.h
@@ -44,8 +44,8 @@ struct ForceVFPTToTop {
class RefCountObj : public ForceVFPTToTop
{
public:
- RefCountObj() : m_refcount(0) {}
- RefCountObj(const RefCountObj &s) : m_refcount(0)
+ RefCountObj() {}
+ RefCountObj(const RefCountObj &s)
{
(void)s;
return;
@@ -86,7 +86,7 @@ public:
}
private:
- int m_refcount;
+ int m_refcount = 0;
};
////////////////////////////////////////////////////////////////////////
diff --git a/include/tscore/RbTree.h b/include/tscore/RbTree.h
index 4d936d9..dcb52f5 100644
--- a/include/tscore/RbTree.h
+++ b/include/tscore/RbTree.h
@@ -108,7 +108,7 @@ namespace detail
int validate();
/// Default constructor.
- RBNode() : _color(RED), _parent(nullptr), _left(nullptr), _right(nullptr), _next(nullptr), _prev(nullptr) {}
+ RBNode() {}
/// Destructor (force virtual).
virtual ~RBNode() {}
/** Rotate the subtree rooted at this node.
@@ -206,12 +206,12 @@ namespace detail
//! Invoke @c structure_fixup() on this node and all of its ancestors.
self *rippleStructureFixup();
- Color _color; ///< node color
- self *_parent; ///< parent node (needed for rotations)
- self *_left; ///< left child
- self *_right; ///< right child
- self *_next; ///< Next node.
- self *_prev; ///< Previous node.
+ Color _color = RED; ///< node color
+ self *_parent = nullptr; ///< parent node (needed for rotations)
+ self *_left = nullptr; ///< left child
+ self *_right = nullptr; ///< right child
+ self *_next = nullptr; ///< Next node.
+ self *_prev = nullptr; ///< Previous node.
};
} /* namespace detail */
diff --git a/include/tscore/SimpleTokenizer.h b/include/tscore/SimpleTokenizer.h
index 3f0e7fa..15471ef 100644
--- a/include/tscore/SimpleTokenizer.h
+++ b/include/tscore/SimpleTokenizer.h
@@ -123,14 +123,13 @@ public:
OVERWRITE_INPUT_STRING = 8
};
- SimpleTokenizer(char delimiter = ' ', unsigned mode = 0, char escape = '\\')
- : _data(nullptr), _delimiter(delimiter), _mode(mode), _escape(escape), _start(0), _length(0)
+ SimpleTokenizer(char delimiter = ' ', unsigned mode = 0, char escape = '\\') : _delimiter(delimiter), _mode(mode), _escape(escape)
{
}
// NOTE: The input strring 's' is overwritten for mode OVERWRITE_INPUT_STRING.
SimpleTokenizer(const char *s, char delimiter = ' ', unsigned mode = 0, char escape = '\\')
- : _data(nullptr), _delimiter(delimiter), _mode(mode), _escape(escape)
+ : _delimiter(delimiter), _mode(mode), _escape(escape)
{
setString(s);
}
@@ -188,15 +187,15 @@ public:
}
private:
- char *_data; // a pointer to the input data itself,
+ char *_data = nullptr; // a pointer to the input data itself,
// or to a copy of it
char _delimiter; // the token delimiter
unsigned _mode; // flags that determine the
// mode of operation
- char _escape; // the escape character
- size_t _start; // pointer to the start of the next
+ char _escape; // the escape character
+ size_t _start = 0; // pointer to the start of the next
// token
- size_t _length; // the length of _data
+ size_t _length = 0; // the length of _data
void
_clearData()
diff --git a/include/tscore/TsBuffer.h b/include/tscore/TsBuffer.h
index 2ccb9a4..39e55b8 100644
--- a/include/tscore/TsBuffer.h
+++ b/include/tscore/TsBuffer.h
@@ -49,8 +49,8 @@ struct Buffer {
typedef Buffer self; ///< Self reference type.
typedef bool (self::*pseudo_bool)() const;
- char *_ptr; ///< Pointer to base of memory chunk.
- size_t _size; ///< Size of memory chunk.
+ char *_ptr = nullptr; ///< Pointer to base of memory chunk.
+ size_t _size = 0; ///< Size of memory chunk.
/// Default constructor (empty buffer).
Buffer();
@@ -129,8 +129,8 @@ struct ConstBuffer {
typedef ConstBuffer self; ///< Self reference type.
typedef bool (self::*pseudo_bool)() const;
- char const *_ptr; ///< Pointer to base of memory chunk.
- size_t _size; ///< Size of memory chunk.
+ char const *_ptr = nullptr; ///< Pointer to base of memory chunk.
+ size_t _size = 0; ///< Size of memory chunk.
/// Default constructor (empty buffer).
ConstBuffer();
@@ -286,7 +286,7 @@ struct ConstBuffer {
// ----------------------------------------------------------
// Inline implementations.
-inline Buffer::Buffer() : _ptr(nullptr), _size(0) {}
+inline Buffer::Buffer() {}
inline Buffer::Buffer(char *ptr, size_t n) : _ptr(ptr), _size(n) {}
inline Buffer &
Buffer::set(char *ptr, size_t n)
@@ -353,7 +353,7 @@ Buffer::size() const
return _size;
}
-inline ConstBuffer::ConstBuffer() : _ptr(nullptr), _size(0) {}
+inline ConstBuffer::ConstBuffer() {}
inline ConstBuffer::ConstBuffer(char const *ptr, size_t n) : _ptr(ptr), _size(n) {}
inline ConstBuffer::ConstBuffer(char const *start, char const *end) : _ptr(start), _size(end - start) {}
inline ConstBuffer::ConstBuffer(Buffer const &that) : _ptr(that._ptr), _size(that._size) {}
diff --git a/include/tscore/ink_cap.h b/include/tscore/ink_cap.h
index c5ed681..4a2c7d5 100644
--- a/include/tscore/ink_cap.h
+++ b/include/tscore/ink_cap.h
@@ -90,7 +90,7 @@ public:
void demote();
private:
- bool elevated;
+ bool elevated = false;
uid_t saved_uid;
unsigned level;
diff --git a/include/tscore/ink_inet.h b/include/tscore/ink_inet.h
index 3de20ba..3940337 100644
--- a/include/tscore/ink_inet.h
+++ b/include/tscore/ink_inet.h
@@ -1149,7 +1149,7 @@ struct IpAddr {
typedef IpAddr self; ///< Self reference type.
/// Default construct (invalid address).
- IpAddr() : _family(AF_UNSPEC) {}
+ IpAddr() {}
/** Construct from IPv4 address.
*
@@ -1284,7 +1284,7 @@ struct IpAddr {
/// Test for any addr
bool isAnyAddr() const;
- uint16_t _family; ///< Protocol family.
+ uint16_t _family = AF_UNSPEC; ///< Protocol family.
/// Address data.
union Addr {
in_addr_t _ip4; ///< IPv4 address storage.
diff --git a/include/tscore/ink_lockfile.h b/include/tscore/ink_lockfile.h
index d3d6878..8f5aa2e 100644
--- a/include/tscore/ink_lockfile.h
+++ b/include/tscore/ink_lockfile.h
@@ -33,9 +33,9 @@
class Lockfile
{
public:
- Lockfile() : fd(0) { fname[0] = '\0'; }
+ Lockfile() { fname[0] = '\0'; }
// coverity[uninit_member]
- Lockfile(const char *filename) : fd(0) { ink_strlcpy(fname, filename, sizeof(fname)); }
+ Lockfile(const char *filename) { ink_strlcpy(fname, filename, sizeof(fname)); }
~Lockfile() {}
void
SetLockfileName(const char *filename)
@@ -86,5 +86,5 @@ public:
private:
char fname[PATH_NAME_MAX];
- int fd;
+ int fd = 0;
};
diff --git a/include/tscore/ink_string++.h b/include/tscore/ink_string++.h
index 126ca25..fc9d86c 100644
--- a/include/tscore/ink_string++.h
+++ b/include/tscore/ink_string++.h
@@ -41,12 +41,12 @@
***********************************************************************/
struct Str {
- const char *str; // string pointer
- size_t len; // length of string (not counting NUL)
- struct Str *next; // next in list
- struct Str *prev; // prev in list
+ const char *str = nullptr; // string pointer
+ size_t len = 0; // length of string (not counting NUL)
+ struct Str *next = nullptr; // next in list
+ struct Str *prev = nullptr; // prev in list
- Str() : str(nullptr), len(0), next(nullptr), prev(nullptr) {}
+ Str() {}
Str(char *s)
{
str = s;
diff --git a/include/tscore/ink_uuid.h b/include/tscore/ink_uuid.h
index fe6f3a9..32127dc 100644
--- a/include/tscore/ink_uuid.h
+++ b/include/tscore/ink_uuid.h
@@ -33,7 +33,7 @@ class ATSUuid
{
public:
// Constructors
- ATSUuid() : _version(TS_UUID_UNDEFINED) {}
+ ATSUuid() {}
ATSUuid &operator=(const ATSUuid other);
// Initialize the UUID from a string
@@ -122,7 +122,7 @@ private:
} _uuid;
// This is the typically used visible portion of the UUID
- TSUuidVersion _version;
+ TSUuidVersion _version = TS_UUID_UNDEFINED;
char _string[TS_UUID_STRING_LEN + 1];
bool
diff --git a/include/tscpp/api/Continuation.h b/include/tscpp/api/Continuation.h
index 62e40a1..ef25dab 100644
--- a/include/tscpp/api/Continuation.h
+++ b/include/tscpp/api/Continuation.h
@@ -43,7 +43,7 @@ public:
// Create "empty" continuation, can only be populated by move assignement.
//
- Continuation() : _cont(nullptr) {}
+ Continuation() {}
TSCont
asTSCont() const
@@ -139,7 +139,7 @@ protected:
//
static int _generalEventFunc(TSCont cont, TSEvent event, void *edata);
- TSCont _cont;
+ TSCont _cont = nullptr;
};
} // end namespace atscppapi
diff --git a/include/tscpp/api/Stat.h b/include/tscpp/api/Stat.h
index 25d633d..a5a8440 100644
--- a/include/tscpp/api/Stat.h
+++ b/include/tscpp/api/Stat.h
@@ -21,7 +21,9 @@
#pragma once
+#include "ts/apidefs.h"
#include "tscpp/api/noncopyable.h"
+
#include <cstdint>
#include <string>
@@ -97,7 +99,7 @@ public:
void set(int64_t value);
private:
- int stat_id_; /**< The internal stat ID */
+ int stat_id_ = TS_ERROR; /**< The internal stat ID */
};
} // namespace atscppapi
diff --git a/include/tscpp/util/MemSpan.h b/include/tscpp/util/MemSpan.h
index 5a4d631..f0a2890 100644
--- a/include/tscpp/util/MemSpan.h
+++ b/include/tscpp/util/MemSpan.h
@@ -317,7 +317,7 @@ inline MemSpan::MemSpan(void *start, void *end) : _data(start), _size(static_cas
template <typename T, size_t N> MemSpan::MemSpan(T (&a)[N]) : _data(a), _size(N * sizeof(T)) {}
-inline constexpr MemSpan::MemSpan(std::nullptr_t) : _data(nullptr), _size(0) {}
+inline constexpr MemSpan::MemSpan(std::nullptr_t) {}
inline ptrdiff_t
MemSpan::distance(void const *lhs, void const *rhs)
diff --git a/include/wccp/Wccp.h b/include/wccp/Wccp.h
index 7f58e92..40dff8f 100644
--- a/include/wccp/Wccp.h
+++ b/include/wccp/Wccp.h
@@ -372,8 +372,8 @@ public:
private:
Service(Cache const &cache, detail::cache::GroupData &group);
- Cache m_cache; ///< Parent cache.
- detail::cache::GroupData *m_group; ///< Service Group data.
+ Cache m_cache; ///< Parent cache.
+ detail::cache::GroupData *m_group = nullptr; ///< Service Group data.
friend class Cache;
};
@@ -499,7 +499,7 @@ ServiceGroup::clearPorts()
return *this;
}
-inline Cache::Service::Service() : m_group(nullptr) {}
+inline Cache::Service::Service() {}
inline Cache::Service::Service(Cache const &cache, detail::cache::GroupData &group) : m_cache(cache), m_group(&group) {}
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index dd408c9..9d98607 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -285,7 +285,7 @@ update_cache_config(const char * /* name ATS_UNUSED */, RecDataT /* data_type AT
return 0;
}
-CacheVC::CacheVC() : alternate_index(CACHE_ALT_INDEX_DEFAULT)
+CacheVC::CacheVC()
{
size_to_init = sizeof(CacheVC) - (size_t) & ((CacheVC *)nullptr)->vio;
memset((void *)&vio, 0, size_to_init);
diff --git a/iocore/cache/CacheHttp.cc b/iocore/cache/CacheHttp.cc
index e78845f..b4ff5d0 100644
--- a/iocore/cache/CacheHttp.cc
+++ b/iocore/cache/CacheHttp.cc
@@ -32,7 +32,7 @@ static vec_info default_vec_info;
static CacheHTTPInfo default_http_info;
-CacheHTTPInfoVector::CacheHTTPInfoVector() : magic(nullptr), data(&default_vec_info, 4), xcount(0) {}
+CacheHTTPInfoVector::CacheHTTPInfoVector() : data(&default_vec_info, 4) {}
/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/
diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
index 57f574a..8d4447b 100644
--- a/iocore/cache/I_Cache.h
+++ b/iocore/cache/I_Cache.h
@@ -62,9 +62,8 @@ typedef HTTPInfo CacheHTTPInfo;
struct CacheProcessor : public Processor {
CacheProcessor()
: min_stripe_version(CACHE_DB_MAJOR_VERSION, CACHE_DB_MINOR_VERSION),
- max_stripe_version(CACHE_DB_MAJOR_VERSION, CACHE_DB_MINOR_VERSION),
- cb_after_init(nullptr),
- wait_for_cache(0)
+ max_stripe_version(CACHE_DB_MAJOR_VERSION, CACHE_DB_MINOR_VERSION)
+
{
}
@@ -159,8 +158,8 @@ struct CacheProcessor : public Processor {
ts::VersionNumber min_stripe_version;
ts::VersionNumber max_stripe_version;
- CALLBACK_FUNC cb_after_init;
- int wait_for_cache;
+ CALLBACK_FUNC cb_after_init = nullptr;
+ int wait_for_cache = 0;
};
inline void
diff --git a/iocore/cache/I_Store.h b/iocore/cache/I_Store.h
index fbb48b8..901ae9f 100644
--- a/iocore/cache/I_Store.h
+++ b/iocore/cache/I_Store.h
@@ -70,17 +70,17 @@ struct span_diskid_t {
// Those on the same disk should be in a linked list.
//
struct Span {
- int64_t blocks; // in STORE_BLOCK_SIZE blocks
- int64_t offset; // used only if (file == true); in bytes
- unsigned hw_sector_size;
- unsigned alignment;
+ int64_t blocks = 0; // in STORE_BLOCK_SIZE blocks
+ int64_t offset = 0; // used only if (file == true); in bytes
+ unsigned hw_sector_size = DEFAULT_HW_SECTOR_SIZE;
+ unsigned alignment = 0;
span_diskid_t disk_id;
- int forced_volume_num; ///< Force span in to specific volume.
+ int forced_volume_num = -1; ///< Force span in to specific volume.
private:
- bool is_mmapable_internal;
+ bool is_mmapable_internal = false;
public:
- bool file_pathname; // the pathname is a file
+ bool file_pathname = false; // the pathname is a file
// v- used as a magic location for copy constructor.
// we memcpy everything before this member and do explicit assignment for the rest.
ats_scoped_str pathname;
@@ -157,17 +157,7 @@ public:
/// Set the volume number.
void volume_number_set(int n);
- Span()
- : blocks(0),
- offset(0),
- hw_sector_size(DEFAULT_HW_SECTOR_SIZE),
- alignment(0),
- forced_volume_num(-1),
- is_mmapable_internal(false),
- file_pathname(false)
- {
- disk_id[0] = disk_id[1] = 0;
- }
+ Span() { disk_id[0] = disk_id[1] = 0; }
/// Copy constructor.
/// @internal Prior to this implementation handling the char* pointers was done manual
@@ -259,10 +249,10 @@ struct Store {
~Store();
// The number of disks/paths defined in storage.config
- unsigned n_disks_in_config;
+ unsigned n_disks_in_config = 0;
// The number of disks/paths we could actually read and parse.
- unsigned n_disks;
- Span **disk;
+ unsigned n_disks = 0;
+ Span **disk = nullptr;
Result read_config();
diff --git a/iocore/cache/P_CacheDir.h b/iocore/cache/P_CacheDir.h
index 27a31b4..576224f 100644
--- a/iocore/cache/P_CacheDir.h
+++ b/iocore/cache/P_CacheDir.h
@@ -258,29 +258,18 @@ struct OpenDir : public Continuation {
};
struct CacheSync : public Continuation {
- int vol_idx;
- char *buf;
- size_t buflen;
- bool buf_huge;
- off_t writepos;
+ int vol_idx = 0;
+ char *buf = nullptr;
+ size_t buflen = 0;
+ bool buf_huge = false;
+ off_t writepos = 0;
AIOCallbackInternal io;
- Event *trigger;
- ink_hrtime start_time;
+ Event *trigger = nullptr;
+ ink_hrtime start_time = 0;
int mainEvent(int event, Event *e);
void aio_write(int fd, char *b, int n, off_t o);
- CacheSync()
- : Continuation(new_ProxyMutex()),
- vol_idx(0),
- buf(nullptr),
- buflen(0),
- buf_huge(false),
- writepos(0),
- trigger(nullptr),
- start_time(0)
- {
- SET_HANDLER(&CacheSync::mainEvent);
- }
+ CacheSync() : Continuation(new_ProxyMutex()) { SET_HANDLER(&CacheSync::mainEvent); }
};
// Global Functions
diff --git a/iocore/cache/P_CacheDisk.h b/iocore/cache/P_CacheDisk.h
index 51f2462..18379de 100644
--- a/iocore/cache/P_CacheDisk.h
+++ b/iocore/cache/P_CacheDisk.h
@@ -53,11 +53,11 @@ struct DiskVolBlock {
};
struct DiskVolBlockQueue {
- DiskVolBlock *b;
- int new_block; /* whether an existing vol or a new one */
+ DiskVolBlock *b = nullptr;
+ int new_block = 0; /* whether an existing vol or a new one */
LINK(DiskVolBlockQueue, link);
- DiskVolBlockQueue() : b(nullptr), new_block(0) {}
+ DiskVolBlockQueue() {}
};
struct DiskVol {
diff --git a/iocore/cache/P_CacheHosting.h b/iocore/cache/P_CacheHosting.h
index e78b2a1..765c695 100644
--- a/iocore/cache/P_CacheHosting.h
+++ b/iocore/cache/P_CacheHosting.h
@@ -46,34 +46,24 @@ struct CacheHostRecord {
ats_free(cp);
}
- CacheType type;
- Vol **vols;
- int good_num_vols;
- int num_vols;
- int num_initialized;
- unsigned short *vol_hash_table;
- CacheVol **cp;
- int num_cachevols;
-
- CacheHostRecord()
- : type(CACHE_NONE_TYPE),
- vols(nullptr),
- good_num_vols(0),
- num_vols(0),
- num_initialized(0),
- vol_hash_table(nullptr),
- cp(nullptr),
- num_cachevols(0)
- {
- }
+ CacheType type = CACHE_NONE_TYPE;
+ Vol **vols = nullptr;
+ int good_num_vols = 0;
+ int num_vols = 0;
+ int num_initialized = 0;
+ unsigned short *vol_hash_table = nullptr;
+ CacheVol **cp = nullptr;
+ int num_cachevols = 0;
+
+ CacheHostRecord() {}
};
void build_vol_hash_table(CacheHostRecord *cp);
struct CacheHostResult {
- CacheHostRecord *record;
+ CacheHostRecord *record = nullptr;
- CacheHostResult() : record(nullptr) {}
+ CacheHostResult() {}
};
class CacheHostMatcher
diff --git a/iocore/cache/P_CacheHttp.h b/iocore/cache/P_CacheHttp.h
index 24ddabe..c9932a8 100644
--- a/iocore/cache/P_CacheHttp.h
+++ b/iocore/cache/P_CacheHttp.h
@@ -43,7 +43,7 @@ struct vec_info {
};
struct CacheHTTPInfoVector {
- void *magic;
+ void *magic = nullptr;
CacheHTTPInfoVector();
~CacheHTTPInfoVector();
@@ -72,7 +72,7 @@ struct CacheHTTPInfoVector {
int unmarshal(const char *buf, int length, RefCountObj *block_ptr);
CacheArray<vec_info> data;
- int xcount;
+ int xcount = 0;
Ptr<RefCountObj> vector_buf;
};
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index fb2fb71..54d5314 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -425,7 +425,7 @@ struct CacheVC : public CacheVConnection {
OpenDirEntry *od;
AIOCallbackInternal io;
- int alternate_index; // preferred position in vector
+ int alternate_index = CACHE_ALT_INDEX_DEFAULT; // preferred position in vector
LINK(CacheVC, opendir_link);
#ifdef CACHE_STAT_PAGES
LINK(CacheVC, stat_link);
@@ -971,14 +971,14 @@ struct Vol;
class CacheHostTable;
struct Cache {
- int cache_read_done;
- int total_good_nvol;
- int total_nvol;
- int ready;
- int64_t cache_size; // in store block size
- CacheHostTable *hosttable;
- int total_initialized_vol;
- CacheType scheme;
+ int cache_read_done = 0;
+ int total_good_nvol = 0;
+ int total_nvol = 0;
+ int ready = CACHE_INITIALIZING;
+ int64_t cache_size = 0; // in store block size
+ CacheHostTable *hosttable = nullptr;
+ int total_initialized_vol = 0;
+ CacheType scheme = CACHE_NONE_TYPE;
int open(bool reconfigure, bool fix);
int close();
@@ -1009,17 +1009,7 @@ struct Cache {
Vol *key_to_vol(const CacheKey *key, const char *hostname, int host_len);
- Cache()
- : cache_read_done(0),
- total_good_nvol(0),
- total_nvol(0),
- ready(CACHE_INITIALIZING),
- cache_size(0), // in store block size
- hosttable(nullptr),
- total_initialized_vol(0),
- scheme(CACHE_NONE_TYPE)
- {
- }
+ Cache() {}
};
extern Cache *theCache;
diff --git a/iocore/cache/P_CacheTest.h b/iocore/cache/P_CacheTest.h
index 3b369fd..ba9814e 100644
--- a/iocore/cache/P_CacheTest.h
+++ b/iocore/cache/P_CacheTest.h
@@ -48,17 +48,17 @@ struct PinnedDocTable : public Continuation {
};
struct CacheTestHost {
- char *name;
- unsigned int xlast_cachable_id;
- double xprev_host_prob;
- double xnext_host_prob;
+ char *name = nullptr;
+ unsigned int xlast_cachable_id = 0;
+ double xprev_host_prob = 0;
+ double xnext_host_prob = 0;
- CacheTestHost() : name(nullptr), xlast_cachable_id(0), xprev_host_prob(0), xnext_host_prob(0) {}
+ CacheTestHost() {}
};
struct CacheTestHeader {
- CacheTestHeader() : serial(0) {}
- uint64_t serial;
+ CacheTestHeader() {}
+ uint64_t serial = 0;
};
struct CacheTestSM : public RegressionSM {
diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h
index a927eb4..5b3254e 100644
--- a/iocore/cache/P_CacheVol.h
+++ b/iocore/cache/P_CacheVol.h
@@ -279,17 +279,17 @@ struct AIO_Callback_handler : public Continuation {
};
struct CacheVol {
- int vol_number;
- int scheme;
- off_t size;
- int num_vols;
- Vol **vols;
- DiskVol **disk_vols;
+ int vol_number = -1;
+ int scheme = 0;
+ off_t size = 0;
+ int num_vols = 0;
+ Vol **vols = nullptr;
+ DiskVol **disk_vols = nullptr;
LINK(CacheVol, link);
// per volume stats
- RecRawStatBlock *vol_rsb;
+ RecRawStatBlock *vol_rsb = nullptr;
- CacheVol() : vol_number(-1), scheme(0), size(0), num_vols(0), vols(nullptr), disk_vols(nullptr), vol_rsb(nullptr) {}
+ CacheVol() {}
};
// Note : hdr() needs to be 8 byte aligned.
diff --git a/iocore/cache/RamCacheCLFUS.cc b/iocore/cache/RamCacheCLFUS.cc
index 9cb4c44..3fe4af0 100644
--- a/iocore/cache/RamCacheCLFUS.cc
+++ b/iocore/cache/RamCacheCLFUS.cc
@@ -71,9 +71,9 @@ struct RamCacheCLFUSEntry {
};
struct RamCacheCLFUS : public RamCache {
- int64_t max_bytes;
- int64_t bytes;
- int64_t objects;
+ int64_t max_bytes = 0;
+ int64_t bytes = 0;
+ int64_t objects = 0;
// returns 1 on found/stored, 0 on not found/stored, if provided auxkey1 and auxkey2 must match
int get(CryptoHash *key, Ptr<IOBufferData> *ret_data, uint32_t auxkey1 = 0, uint32_t auxkey2 = 0) override;
@@ -85,16 +85,16 @@ struct RamCacheCLFUS : public RamCache {
void init(int64_t max_bytes, Vol *vol) override;
// private
- Vol *vol; // for stats
- double average_value;
- int64_t history;
- int ibuckets;
- int nbuckets;
+ Vol *vol = nullptr; // for stats
+ double average_value = 0;
+ int64_t history = 0;
+ int ibuckets = 0;
+ int nbuckets = 0;
DList(RamCacheCLFUSEntry, hash_link) * bucket;
Que(RamCacheCLFUSEntry, lru_link) lru[2];
- uint16_t *seen;
- int ncompressed;
- RamCacheCLFUSEntry *compressed; // first uncompressed lru[0] entry
+ uint16_t *seen = nullptr;
+ int ncompressed = 0;
+ RamCacheCLFUSEntry *compressed = nullptr; // first uncompressed lru[0] entry
void compress_entries(EThread *thread, int do_at_most = INT_MAX);
void resize_hashtable();
void victimize(RamCacheCLFUSEntry *e);
@@ -102,21 +102,7 @@ struct RamCacheCLFUS : public RamCache {
RamCacheCLFUSEntry *destroy(RamCacheCLFUSEntry *e);
void requeue_victims(Que(RamCacheCLFUSEntry, lru_link) & victims);
void tick(); // move CLOCK on history
- RamCacheCLFUS()
- : max_bytes(0),
- bytes(0),
- objects(0),
- vol(nullptr),
- average_value(0),
- history(0),
- ibuckets(0),
- nbuckets(0),
- bucket(nullptr),
- seen(nullptr),
- ncompressed(0),
- compressed(nullptr)
- {
- }
+ RamCacheCLFUS() : bucket(nullptr) {}
};
int64_t
diff --git a/iocore/cache/Store.cc b/iocore/cache/Store.cc
index bcafbd4..38deecd 100644
--- a/iocore/cache/Store.cc
+++ b/iocore/cache/Store.cc
@@ -72,7 +72,7 @@ span_file_typename(mode_t st_mode)
}
Ptr<ProxyMutex> tmp_p;
-Store::Store() : n_disks_in_config(0), n_disks(0), disk(nullptr) {}
+Store::Store() {}
void
Store::add(Span *ds)
diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index aae4c6b..38e1e2e 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -386,7 +386,7 @@ ink_dn_expand(const u_char *msg, const u_char *eom, const u_char *comp_dn, u_cha
return ::dn_expand((unsigned char *)msg, (unsigned char *)eom, (unsigned char *)comp_dn, (char *)exp_dn, length);
}
-DNSProcessor::DNSProcessor() : thread(nullptr), handler(nullptr)
+DNSProcessor::DNSProcessor()
{
ink_zero(l_res);
ink_zero(local_ipv6);
diff --git a/iocore/dns/DNSConnection.cc b/iocore/dns/DNSConnection.cc
index 311ff93..fc4cb32 100644
--- a/iocore/dns/DNSConnection.cc
+++ b/iocore/dns/DNSConnection.cc
@@ -48,8 +48,7 @@ DNSConnection::Options const DNSConnection::DEFAULT_OPTIONS;
// Functions
//
-DNSConnection::DNSConnection()
- : fd(NO_FD), num(0), generator((uint32_t)((uintptr_t)time(nullptr) ^ (uintptr_t)this)), handler(nullptr)
+DNSConnection::DNSConnection() : fd(NO_FD), generator((uint32_t)((uintptr_t)time(nullptr) ^ (uintptr_t)this))
{
memset(&ip, 0, sizeof(ip));
}
diff --git a/iocore/dns/I_DNSProcessor.h b/iocore/dns/I_DNSProcessor.h
index 15af750..a0ec651 100644
--- a/iocore/dns/I_DNSProcessor.h
+++ b/iocore/dns/I_DNSProcessor.h
@@ -68,13 +68,13 @@ struct DNSProcessor : public Processor {
/// Query handler to use.
/// Default: single threaded handler.
- DNSHandler *handler;
+ DNSHandler *handler = nullptr;
/// Query timeout value.
/// Default: @c DEFAULT_DNS_TIMEOUT (or as set in records.config)
- int timeout; ///< Timeout value for request.
+ int timeout = 0; ///< Timeout value for request.
/// Host resolution style.
/// Default: IPv4, IPv6 ( @c HOST_RES_IPV4 )
- HostResStyle host_res_style;
+ HostResStyle host_res_style = HOST_RES_IPV4;
/// Default constructor.
Options();
@@ -121,8 +121,8 @@ struct DNSProcessor : public Processor {
// private:
//
- EThread *thread;
- DNSHandler *handler;
+ EThread *thread = nullptr;
+ DNSHandler *handler = nullptr;
ts_imp_res_state l_res;
IpEndpoint local_ipv6;
IpEndpoint local_ipv4;
@@ -172,7 +172,7 @@ DNSProcessor::gethostbyaddr(Continuation *cont, IpAddr const *addr, Options cons
return getby(reinterpret_cast<const char *>(addr), 0, T_PTR, cont, opt);
}
-inline DNSProcessor::Options::Options() : handler(nullptr), timeout(0), host_res_style(HOST_RES_IPV4) {}
+inline DNSProcessor::Options::Options() {}
inline DNSProcessor::Options &
DNSProcessor::Options::setHandler(DNSHandler *h)
diff --git a/iocore/dns/P_DNSConnection.h b/iocore/dns/P_DNSConnection.h
index d4a3e5f..b31c39b 100644
--- a/iocore/dns/P_DNSConnection.h
+++ b/iocore/dns/P_DNSConnection.h
@@ -46,22 +46,22 @@ struct DNSConnection {
/// Connection is done non-blocking.
/// Default: @c true.
- bool _non_blocking_connect;
+ bool _non_blocking_connect = true;
/// Set socket to have non-blocking I/O.
/// Default: @c true.
- bool _non_blocking_io;
+ bool _non_blocking_io = true;
/// Use TCP if @c true, use UDP if @c false.
/// Default: @c false.
- bool _use_tcp;
+ bool _use_tcp = false;
/// Bind to a random port.
/// Default: @c true.
- bool _bind_random_port;
+ bool _bind_random_port = true;
/// Bind to this local address when using IPv6.
/// Default: unset, bind to IN6ADDR_ANY.
- sockaddr const *_local_ipv6;
+ sockaddr const *_local_ipv6 = nullptr;
/// Bind to this local address when using IPv4.
/// Default: unset, bind to INADDRY_ANY.
- sockaddr const *_local_ipv4;
+ sockaddr const *_local_ipv4 = nullptr;
Options();
@@ -75,12 +75,12 @@ struct DNSConnection {
int fd;
IpEndpoint ip;
- int num;
+ int num = 0;
Options opt;
LINK(DNSConnection, link);
EventIO eio;
InkRand generator;
- DNSHandler *handler;
+ DNSHandler *handler = nullptr;
/// TCPData structure is to track the reading progress of a TCP connection
struct TCPData {
@@ -110,15 +110,7 @@ struct DNSConnection {
static Options const DEFAULT_OPTIONS;
};
-inline DNSConnection::Options::Options()
- : _non_blocking_connect(true),
- _non_blocking_io(true),
- _use_tcp(false),
- _bind_random_port(true),
- _local_ipv6(nullptr),
- _local_ipv4(nullptr)
-{
-}
+inline DNSConnection::Options::Options() {}
inline DNSConnection::Options &
DNSConnection::Options::setNonBlockingIo(bool p)
diff --git a/iocore/dns/P_DNSProcessor.h b/iocore/dns/P_DNSProcessor.h
index 391f534..4eb5045 100644
--- a/iocore/dns/P_DNSProcessor.h
+++ b/iocore/dns/P_DNSProcessor.h
@@ -187,25 +187,25 @@ struct DNSHandler : public Continuation {
IpEndpoint local_ipv6; ///< Local V6 address if set.
IpEndpoint local_ipv4; ///< Local V4 address if set.
int ifd[MAX_NAMED];
- int n_con;
+ int n_con = 0;
DNSConnection tcpcon[MAX_NAMED];
DNSConnection udpcon[MAX_NAMED];
Queue<DNSEntry> entries;
Queue<DNSConnection> triggered;
- int in_flight;
- int name_server;
- int in_write_dns;
- HostEnt *hostent_cache;
+ int in_flight = 0;
+ int name_server = 0;
+ int in_write_dns = 0;
+ HostEnt *hostent_cache = nullptr;
int ns_down[MAX_NAMED];
int failover_number[MAX_NAMED];
int failover_soon_number[MAX_NAMED];
ink_hrtime crossed_failover_number[MAX_NAMED];
- ink_hrtime last_primary_retry;
- ink_hrtime last_primary_reopen;
+ ink_hrtime last_primary_retry = 0;
+ ink_hrtime last_primary_reopen = 0;
- ink_res_state m_res;
- int txn_lookup_timeout;
+ ink_res_state m_res = nullptr;
+ int txn_lookup_timeout = 0;
InkRand generator;
// bitmap of query ids in use
@@ -298,9 +298,9 @@ struct DNSServer {
char x_def_domain[MAXDNAME];
char x_domain_srch_list[MAXDNAME];
- DNSHandler *x_dnsH;
+ DNSHandler *x_dnsH = nullptr;
- DNSServer() : x_dnsH(nullptr)
+ DNSServer()
{
memset(x_server_ip, 0, sizeof(x_server_ip));
@@ -313,15 +313,7 @@ struct DNSServer {
TS_INLINE
DNSHandler::DNSHandler()
: Continuation(nullptr),
- n_con(0),
- in_flight(0),
- name_server(0),
- in_write_dns(0),
- hostent_cache(nullptr),
- last_primary_retry(0),
- last_primary_reopen(0),
- m_res(nullptr),
- txn_lookup_timeout(0),
+
generator((uint32_t)((uintptr_t)time(nullptr) ^ (uintptr_t)this))
{
ats_ip_invalidate(&ip);
diff --git a/iocore/dns/P_SplitDNSProcessor.h b/iocore/dns/P_SplitDNSProcessor.h
index d180aad..41d0fb9 100644
--- a/iocore/dns/P_SplitDNSProcessor.h
+++ b/iocore/dns/P_SplitDNSProcessor.h
@@ -70,7 +70,7 @@ struct SplitDNSResult {
/* ------------
public
------------ */
- DNSResultType r;
+ DNSResultType r = DNS_SRVR_UNDEFINED;
DNSServer *get_dns_record();
int get_dns_srvr_count();
@@ -78,10 +78,10 @@ struct SplitDNSResult {
/* ------------
private
------------ */
- int m_line_number;
+ int m_line_number = 0;
- SplitDNSRecord *m_rec;
- bool m_wrap_around;
+ SplitDNSRecord *m_rec = nullptr;
+ bool m_wrap_around = false;
};
/* --------------------------------------------------------------
@@ -94,17 +94,17 @@ struct SplitDNS : public ConfigInfo {
void *getDNSRecord(const char *hostname);
void findServer(RequestData *rdata, SplitDNSResult *result);
- DNS_table *m_DNSSrvrTable;
+ DNS_table *m_DNSSrvrTable = nullptr;
- int32_t m_SplitDNSlEnable;
+ int32_t m_SplitDNSlEnable = 0;
/* ----------------------------
required by the alleged fast
path
---------------------------- */
- bool m_bEnableFastPath;
- void *m_pxLeafArray;
- int m_numEle;
+ bool m_bEnableFastPath = false;
+ void *m_pxLeafArray = nullptr;
+ int m_numEle = 0;
};
/* --------------------------------------------------------------
@@ -137,14 +137,14 @@ public:
sockaddr const *get_ip() override; // unused required virtual method.
sockaddr const *get_client_ip() override; // unused required virtual method.
- const char *m_pHost;
+ const char *m_pHost = nullptr;
};
/* --------------------------------------------------------------
DNSRequestData::get_string()
-------------------------------------------------------------- */
TS_INLINE
-DNSRequestData::DNSRequestData() : m_pHost(nullptr) {}
+DNSRequestData::DNSRequestData() {}
/* --------------------------------------------------------------
DNSRequestData::get_string()
@@ -203,15 +203,15 @@ public:
void Print();
DNSServer m_servers;
- int m_dnsSrvr_cnt;
- int m_domain_srch_list;
+ int m_dnsSrvr_cnt = 0;
+ int m_domain_srch_list = 0;
};
/* --------------------------------------------------------------
SplitDNSRecord::SplitDNSRecord()
-------------------------------------------------------------- */
TS_INLINE
-SplitDNSRecord::SplitDNSRecord() : m_dnsSrvr_cnt(0), m_domain_srch_list(0) {}
+SplitDNSRecord::SplitDNSRecord() {}
/* --------------------------------------------------------------
SplitDNSRecord::~SplitDNSRecord()
diff --git a/iocore/dns/SplitDNS.cc b/iocore/dns/SplitDNS.cc
index 998ef74..11bef36 100644
--- a/iocore/dns/SplitDNS.cc
+++ b/iocore/dns/SplitDNS.cc
@@ -74,14 +74,12 @@ Ptr<ProxyMutex> SplitDNSConfig::dnsHandler_mutex;
/* --------------------------------------------------------------
SplitDNSResult::SplitDNSResult()
-------------------------------------------------------------- */
-inline SplitDNSResult::SplitDNSResult() : r(DNS_SRVR_UNDEFINED), m_line_number(0), m_rec(nullptr), m_wrap_around(false) {}
+inline SplitDNSResult::SplitDNSResult() {}
/* --------------------------------------------------------------
SplitDNS::SplitDNS()
-------------------------------------------------------------- */
-SplitDNS::SplitDNS() : m_DNSSrvrTable(nullptr), m_SplitDNSlEnable(0), m_bEnableFastPath(false), m_pxLeafArray(nullptr), m_numEle(0)
-{
-}
+SplitDNS::SplitDNS() {}
SplitDNS::~SplitDNS()
{
diff --git a/iocore/eventsystem/I_EThread.h b/iocore/eventsystem/I_EThread.h
index 8ce926a..9a1bbcd 100644
--- a/iocore/eventsystem/I_EThread.h
+++ b/iocore/eventsystem/I_EThread.h
@@ -388,27 +388,27 @@ public:
struct EventMetrics {
/// Time the loop was active, not including wait time but including event dispatch time.
struct LoopTimes {
- ink_hrtime _start; ///< The time of the first loop for this sample. Used to mark valid entries.
- ink_hrtime _min; ///< Shortest loop time.
- ink_hrtime _max; ///< Longest loop time.
- LoopTimes() : _start(0), _min(INT64_MAX), _max(0) {}
+ ink_hrtime _start = 0; ///< The time of the first loop for this sample. Used to mark valid entries.
+ ink_hrtime _min = INT64_MAX; ///< Shortest loop time.
+ ink_hrtime _max = 0; ///< Longest loop time.
+ LoopTimes() {}
} _loop_time;
struct Events {
- int _min;
- int _max;
- int _total;
- Events() : _min(INT_MAX), _max(0), _total(0) {}
+ int _min = INT_MAX;
+ int _max = 0;
+ int _total = 0;
+ Events() {}
} _events;
- int _count; ///< # of times the loop executed.
- int _wait; ///< # of timed wait for events
+ int _count = 0; ///< # of times the loop executed.
+ int _wait = 0; ///< # of timed wait for events
/// Add @a that to @a this data.
/// This embodies the custom logic per member concerning whether each is a sum, min, or max.
EventMetrics &operator+=(EventMetrics const &that);
- EventMetrics() : _count(0), _wait(0) {}
+ EventMetrics() {}
};
/** The number of metric blocks kept.
diff --git a/iocore/eventsystem/I_IOBuffer.h b/iocore/eventsystem/I_IOBuffer.h
index b57d28f..88a54cf 100644
--- a/iocore/eventsystem/I_IOBuffer.h
+++ b/iocore/eventsystem/I_IOBuffer.h
@@ -239,7 +239,7 @@ public:
alloc or dealloc methods.
*/
- AllocType _mem_type;
+ AllocType _mem_type = NO_ALLOC;
/**
Points to the allocated memory. This member stores the address of
@@ -247,10 +247,10 @@ public:
instead use the alloc or dealloc methods.
*/
- char *_data;
+ char *_data = nullptr;
#ifdef TRACK_BUFFER_USER
- const char *_location;
+ const char *_location = nullptr;
#endif
/**
@@ -258,16 +258,7 @@ public:
this method. Use one of the functions with the 'new_' prefix instead.
*/
- IOBufferData()
- : _size_index(BUFFER_SIZE_NOT_ALLOCATED),
- _mem_type(NO_ALLOC),
- _data(nullptr)
-#ifdef TRACK_BUFFER_USER
- ,
- _location(nullptr)
-#endif
- {
- }
+ IOBufferData() : _size_index(BUFFER_SIZE_NOT_ALLOCATED) {}
// noncopyable, declaration only
IOBufferData(const IOBufferData &) = delete;
@@ -489,12 +480,12 @@ public:
*/
void free() override;
- char *_start;
- char *_end;
- char *_buf_end;
+ char *_start = nullptr;
+ char *_end = nullptr;
+ char *_buf_end = nullptr;
#ifdef TRACK_BUFFER_USER
- const char *_location;
+ const char *_location = nullptr;
#endif
/**
@@ -893,14 +884,14 @@ public:
return mbuf;
}
- MIOBufferAccessor *accessor; // pointer back to the accessor
+ MIOBufferAccessor *accessor = nullptr; // pointer back to the accessor
/**
Back pointer to this object's MIOBuffer. A pointer back to the
MIOBuffer this reader is allocated from.
*/
- MIOBuffer *mbuf;
+ MIOBuffer *mbuf = nullptr;
Ptr<IOBufferBlock> block;
/**
@@ -909,10 +900,10 @@ public:
of the available data.
*/
- int64_t start_offset;
- int64_t size_limit;
+ int64_t start_offset = 0;
+ int64_t size_limit = INT64_MAX;
- IOBufferReader() : accessor(nullptr), mbuf(nullptr), start_offset(0), size_limit(INT64_MAX) {}
+ IOBufferReader() {}
};
/**
@@ -1303,7 +1294,7 @@ public:
IOBufferReader readers[MAX_MIOBUFFER_READERS];
#ifdef TRACK_BUFFER_USER
- const char *_location;
+ const char *_location = nullptr;
#endif
MIOBuffer(void *b, int64_t bufsize, int64_t aWater_mark);
@@ -1352,20 +1343,12 @@ struct MIOBufferAccessor {
entry = nullptr;
}
- MIOBufferAccessor()
- :
-#ifdef DEBUG
- name(nullptr),
-#endif
- mbuf(nullptr),
- entry(nullptr)
- {
- }
+ MIOBufferAccessor() {}
~MIOBufferAccessor();
#ifdef DEBUG
- const char *name;
+ const char *name = nullptr;
#endif
// noncopyable
@@ -1373,8 +1356,8 @@ struct MIOBufferAccessor {
MIOBufferAccessor &operator=(const MIOBufferAccessor &) = delete;
private:
- MIOBuffer *mbuf;
- IOBufferReader *entry;
+ MIOBuffer *mbuf = nullptr;
+ IOBufferReader *entry = nullptr;
};
extern MIOBuffer *new_MIOBuffer_internal(
diff --git a/iocore/eventsystem/I_ProxyAllocator.h b/iocore/eventsystem/I_ProxyAllocator.h
index 4cf8eae..a5edd12 100644
--- a/iocore/eventsystem/I_ProxyAllocator.h
+++ b/iocore/eventsystem/I_ProxyAllocator.h
@@ -39,10 +39,10 @@ extern int thread_freelist_low_watermark;
extern int cmd_disable_pfreelist;
struct ProxyAllocator {
- int allocated;
- void *freelist;
+ int allocated = 0;
+ void *freelist = nullptr;
- ProxyAllocator() : allocated(0), freelist(nullptr) {}
+ ProxyAllocator() {}
};
template <class C>
diff --git a/iocore/eventsystem/I_VIO.h b/iocore/eventsystem/I_VIO.h
index 6e7748c..40d8fa4 100644
--- a/iocore/eventsystem/I_VIO.h
+++ b/iocore/eventsystem/I_VIO.h
@@ -165,7 +165,7 @@ public:
call with events for this operation.
*/
- Continuation *cont;
+ Continuation *cont = nullptr;
/**
Number of bytes to be done for this operation.
@@ -173,7 +173,7 @@ public:
The total number of bytes this operation must complete.
*/
- int64_t nbytes;
+ int64_t nbytes = 0;
/**
Number of bytes already completed.
@@ -183,7 +183,7 @@ public:
the lock.
*/
- int64_t ndone;
+ int64_t ndone = 0;
/**
Type of operation.
@@ -191,7 +191,7 @@ public:
The type of operation that this VIO represents.
*/
- int op;
+ int op = VIO::NONE;
/**
Provides access to the reader or writer for this operation.
@@ -207,7 +207,7 @@ public:
functions.
*/
- VConnection *vc_server;
+ VConnection *vc_server = nullptr;
/**
Reference to the state machine's mutex.
diff --git a/iocore/eventsystem/P_IOBuffer.h b/iocore/eventsystem/P_IOBuffer.h
index d6a4bb4..4968ff9 100644
--- a/iocore/eventsystem/P_IOBuffer.h
+++ b/iocore/eventsystem/P_IOBuffer.h
@@ -382,13 +382,6 @@ new_IOBufferBlock_internal(
TS_INLINE
IOBufferBlock::IOBufferBlock()
- : _start(nullptr),
- _end(nullptr),
- _buf_end(nullptr)
-#ifdef TRACK_BUFFER_USER
- ,
- _location(nullptr)
-#endif
{
return;
}
diff --git a/iocore/eventsystem/P_VIO.h b/iocore/eventsystem/P_VIO.h
index d8fcb05..296296c 100644
--- a/iocore/eventsystem/P_VIO.h
+++ b/iocore/eventsystem/P_VIO.h
@@ -25,7 +25,7 @@
#include "I_VIO.h"
TS_INLINE
-VIO::VIO(int aop) : cont(nullptr), nbytes(0), ndone(0), op(aop), buffer(), vc_server(nullptr), mutex(nullptr) {}
+VIO::VIO(int aop) : op(aop), buffer(), mutex(nullptr) {}
/////////////////////////////////////////////////////////////
//
@@ -33,7 +33,7 @@ VIO::VIO(int aop) : cont(nullptr), nbytes(0), ndone(0), op(aop), buffer(), vc_se
//
/////////////////////////////////////////////////////////////
TS_INLINE
-VIO::VIO() : cont(nullptr), nbytes(0), ndone(0), op(VIO::NONE), buffer(), vc_server(nullptr), mutex(nullptr) {}
+VIO::VIO() : buffer(), mutex(nullptr) {}
TS_INLINE Continuation *
VIO::get_continuation()
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 91ea46a..e4a1427 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -217,9 +217,7 @@ HostDBHash::refresh()
ctx.finalize(hash);
}
-HostDBHash::HostDBHash() : host_name(nullptr), host_len(0), port(0), dns_server(nullptr), pSD(nullptr), db_mark(HOSTDB_MARK_GENERIC)
-{
-}
+HostDBHash::HostDBHash() {}
HostDBHash::~HostDBHash()
{
@@ -228,7 +226,7 @@ HostDBHash::~HostDBHash()
}
}
-HostDBCache::HostDBCache() : refcountcache(nullptr), pending_dns(nullptr), remoteHostDBQueue(nullptr)
+HostDBCache::HostDBCache()
{
hosts_file_ptr = new RefCountedHostsFileMap();
}
diff --git a/iocore/hostdb/I_HostDBProcessor.h b/iocore/hostdb/I_HostDBProcessor.h
index 347f1a9..2587131 100644
--- a/iocore/hostdb/I_HostDBProcessor.h
+++ b/iocore/hostdb/I_HostDBProcessor.h
@@ -349,13 +349,13 @@ struct HostDBInfo : public RefCountObj {
struct HostDBRoundRobin {
/** Total number (to compute space used). */
- short rrcount;
+ short rrcount = 0;
/** Number which have not failed a connect. */
- short good;
+ short good = 0;
- unsigned short current;
- ink_time_t timed_rr_ctime;
+ unsigned short current = 0;
+ ink_time_t timed_rr_ctime = 0;
// This is the equivalent of a variable length array, we can't use a VLA because
// HostDBInfo is a non-POD type-- so this is the best we can do.
@@ -389,7 +389,7 @@ struct HostDBRoundRobin {
HostDBInfo *select_next(sockaddr const *addr);
HostDBInfo *select_best_http(sockaddr const *client_ip, ink_time_t now, int32_t fail_window);
HostDBInfo *select_best_srv(char *target, InkRand *rand, ink_time_t now, int32_t fail_window);
- HostDBRoundRobin() : rrcount(0), good(0), current(0), timed_rr_ctime(0) {}
+ HostDBRoundRobin() {}
};
struct HostDBCache;
@@ -424,13 +424,13 @@ struct HostDBProcessor : public Processor {
/// Optional parameters for getby...
struct Options {
- typedef Options self; ///< Self reference type.
- int port; ///< Target service port (default 0 -> don't care)
- int flags; ///< Processing flags (default HOSTDB_DO_NOT_FORCE_DNS)
- int timeout; ///< Timeout value (default 0 -> default timeout)
- HostResStyle host_res_style; ///< How to query host (default HOST_RES_IPV4)
+ typedef Options self; ///< Self reference type.
+ int port = 0; ///< Target service port (default 0 -> don't care)
+ int flags = HOSTDB_DO_NOT_FORCE_DNS; ///< Processing flags (default HOSTDB_DO_NOT_FORCE_DNS)
+ int timeout = 0; ///< Timeout value (default 0 -> default timeout)
+ HostResStyle host_res_style = HOST_RES_IPV4; ///< How to query host (default HOST_RES_IPV4)
- Options() : port(0), flags(HOSTDB_DO_NOT_FORCE_DNS), timeout(0), host_res_style(HOST_RES_IPV4) {}
+ Options() {}
/// Set the flags.
self &
setFlags(int f)
diff --git a/iocore/hostdb/P_HostDBProcessor.h b/iocore/hostdb/P_HostDBProcessor.h
index 15d1c47..00b8731 100644
--- a/iocore/hostdb/P_HostDBProcessor.h
+++ b/iocore/hostdb/P_HostDBProcessor.h
@@ -194,12 +194,12 @@ struct HostDBCache {
// Map to contain all of the host file overrides, initialize it to empty
Ptr<RefCountedHostsFileMap> hosts_file_ptr;
// TODO: make ATS call a close() method or something on shutdown (it does nothing of the sort today)
- RefCountCache<HostDBInfo> *refcountcache;
+ RefCountCache<HostDBInfo> *refcountcache = nullptr;
// TODO configurable number of items in the cache
- Queue<HostDBContinuation, Continuation::Link_link> *pending_dns;
+ Queue<HostDBContinuation, Continuation::Link_link> *pending_dns = nullptr;
Queue<HostDBContinuation, Continuation::Link_link> &pending_dns_for_hash(const CryptoHash &hash);
- Queue<HostDBContinuation, Continuation::Link_link> *remoteHostDBQueue;
+ Queue<HostDBContinuation, Continuation::Link_link> *remoteHostDBQueue = nullptr;
HostDBCache();
bool is_pending_dns_for_hash(const CryptoHash &hash);
};
@@ -399,16 +399,16 @@ struct HostDBHash {
CryptoHash hash; ///< The hash value.
- const char *host_name; ///< Host name.
- int host_len; ///< Length of @a _host_name
- IpAddr ip; ///< IP address.
- in_port_t port; ///< IP port (host order).
+ const char *host_name = nullptr; ///< Host name.
+ int host_len = 0; ///< Length of @a _host_name
+ IpAddr ip; ///< IP address.
+ in_port_t port = 0; ///< IP port (host order).
/// DNS server. Not strictly part of the hash data but
/// it's both used by @c HostDBContinuation and provides access to
/// hash data. It's just handier to store it here for both uses.
- DNSServer *dns_server;
- SplitDNS *pSD; ///< Hold the container for @a dns_server.
- HostDBMark db_mark; ///< Mark / type of record.
+ DNSServer *dns_server = nullptr;
+ SplitDNS *pSD = nullptr; ///< Hold the container for @a dns_server.
+ HostDBMark db_mark = HOSTDB_MARK_GENERIC; ///< Mark / type of record.
/// Default constructor.
HostDBHash();
@@ -490,12 +490,12 @@ struct HostDBContinuation : public Continuation {
struct Options {
typedef Options self; ///< Self reference type.
- int timeout; ///< Timeout value. Default 0
- HostResStyle host_res_style; ///< IP address family fallback. Default @c HOST_RES_NONE
- bool force_dns; ///< Force DNS lookup. Default @c false
- Continuation *cont; ///< Continuation / action. Default @c nullptr (none)
+ int timeout = 0; ///< Timeout value. Default 0
+ HostResStyle host_res_style = HOST_RES_NONE; ///< IP address family fallback. Default @c HOST_RES_NONE
+ bool force_dns = false; ///< Force DNS lookup. Default @c false
+ Continuation *cont = nullptr; ///< Continuation / action. Default @c nullptr (none)
- Options() : timeout(0), host_res_style(HOST_RES_NONE), force_dns(false), cont(nullptr) {}
+ Options() {}
};
static const Options DEFAULT_OPTIONS; ///< Default defaults.
void init(HostDBHash const &hash, Options const &opt = DEFAULT_OPTIONS);
diff --git a/iocore/hostdb/P_RefCountCache.h b/iocore/hostdb/P_RefCountCache.h
index 1d734e4..60feab1 100644
--- a/iocore/hostdb/P_RefCountCache.h
+++ b/iocore/hostdb/P_RefCountCache.h
@@ -77,11 +77,11 @@ public:
Ptr<RefCountObj> item;
RefCountCacheHashEntry *_next{nullptr};
RefCountCacheHashEntry *_prev{nullptr};
- PriorityQueueEntry<RefCountCacheHashEntry *> *expiry_entry;
+ PriorityQueueEntry<RefCountCacheHashEntry *> *expiry_entry = nullptr;
RefCountCacheItemMeta meta;
// Need a no-argument constructor to use the classAllocator
- RefCountCacheHashEntry() : item(Ptr<RefCountObj>()), expiry_entry(nullptr), meta(0, 0) {}
+ RefCountCacheHashEntry() : item(Ptr<RefCountObj>()), meta(0, 0) {}
void
set(RefCountObj *i, uint64_t key, unsigned int size, int expire_time)
{
@@ -368,7 +368,7 @@ RefCountCachePartition<C>::get_map()
class RefCountCacheHeader
{
public:
- unsigned int magic;
+ unsigned int magic = REFCOUNTCACHE_MAGIC_NUMBER;
ts::VersionNumber version{REFCOUNTCACHE_VERSION};
ts::VersionNumber object_version; // version passed in of whatever it is we are caching
diff --git a/iocore/hostdb/RefCountCache.cc b/iocore/hostdb/RefCountCache.cc
index 832a880..b7cecae 100644
--- a/iocore/hostdb/RefCountCache.cc
+++ b/iocore/hostdb/RefCountCache.cc
@@ -38,8 +38,7 @@ RefCountCacheHashEntry::dealloc(RefCountCacheHashEntry *e)
return refCountCacheHashingValueAllocator.free(e);
}
-RefCountCacheHeader::RefCountCacheHeader(ts::VersionNumber object_version)
- : magic(REFCOUNTCACHE_MAGIC_NUMBER), object_version(object_version){};
+RefCountCacheHeader::RefCountCacheHeader(ts::VersionNumber object_version) : object_version(object_version){};
bool
RefCountCacheHeader::operator==(const RefCountCacheHeader other) const
diff --git a/iocore/net/Connection.cc b/iocore/net/Connection.cc
index 1595bb9..a8370a6 100644
--- a/iocore/net/Connection.cc
+++ b/iocore/net/Connection.cc
@@ -57,7 +57,7 @@ NetVCOptions::toString(addr_bind_style s)
return ANY_ADDR == s ? "any" : INTF_ADDR == s ? "interface" : "foreign";
}
-Connection::Connection() : fd(NO_FD), is_bound(false), is_connected(false), sock_type(0)
+Connection::Connection() : fd(NO_FD)
{
memset(&addr, 0, sizeof(addr));
}
diff --git a/iocore/net/I_NetVConnection.h b/iocore/net/I_NetVConnection.h
index 786c7af..e906568 100644
--- a/iocore/net/I_NetVConnection.h
+++ b/iocore/net/I_NetVConnection.h
@@ -612,8 +612,8 @@ public:
// is enabled by SocksProxy
SocksAddrType socks_addr;
- unsigned int attributes;
- EThread *thread;
+ unsigned int attributes = 0;
+ EThread *thread = nullptr;
/// PRIVATE: The public interface is VIO::reenable()
void reenable(VIO *vio) override = 0;
@@ -815,31 +815,22 @@ protected:
IpEndpoint local_addr;
IpEndpoint remote_addr;
- bool got_local_addr;
- bool got_remote_addr;
+ bool got_local_addr = false;
+ bool got_remote_addr = false;
- bool is_internal_request;
+ bool is_internal_request = false;
/// Set if this connection is transparent.
- bool is_transparent;
+ bool is_transparent = false;
/// Set if proxy protocol is enabled
- bool is_proxy_protocol;
+ bool is_proxy_protocol = false;
/// Set if the next write IO that empties the write buffer should generate an event.
- int write_buffer_empty_event;
+ int write_buffer_empty_event = 0;
/// NetVConnection Context.
- NetVConnectionContext_t netvc_context;
+ NetVConnectionContext_t netvc_context = NET_VCONNECTION_UNSET;
};
-inline NetVConnection::NetVConnection()
- : AnnotatedVConnection(nullptr),
- attributes(0),
- thread(nullptr),
- got_local_addr(false),
- got_remote_addr(false),
- is_internal_request(false),
- is_transparent(false),
- is_proxy_protocol(false),
- write_buffer_empty_event(0),
- netvc_context(NET_VCONNECTION_UNSET)
+inline NetVConnection::NetVConnection() : AnnotatedVConnection(nullptr)
+
{
ink_zero(local_addr);
ink_zero(remote_addr);
diff --git a/iocore/net/I_Socks.h b/iocore/net/I_Socks.h
index 0c2b5c6..b1e7e5c 100644
--- a/iocore/net/I_Socks.h
+++ b/iocore/net/I_Socks.h
@@ -56,7 +56,7 @@ enum {
};
struct SocksAddrType {
- unsigned char type;
+ unsigned char type = SOCKS_ATYPE_NONE;
union {
// mostly it is ipv4. in other cases we will xalloc().
unsigned char ipv4[4];
@@ -64,6 +64,6 @@ struct SocksAddrType {
} addr;
void reset();
- SocksAddrType() : type(SOCKS_ATYPE_NONE) { addr.buf = nullptr; }
+ SocksAddrType() { addr.buf = nullptr; }
~SocksAddrType() { reset(); }
};
diff --git a/iocore/net/NetVCTest.cc b/iocore/net/NetVCTest.cc
index 7889cd1..bda22bd 100644
--- a/iocore/net/NetVCTest.cc
+++ b/iocore/net/NetVCTest.cc
@@ -80,37 +80,7 @@ NVC_test_def netvc_tests_def[] = {
};
const unsigned num_netvc_tests = countof(netvc_tests_def);
-NetVCTest::NetVCTest()
- : Continuation(nullptr),
- test_cont_type(NET_VC_TEST_ACTIVE),
- test_vc(nullptr),
- regress(nullptr),
- driver(nullptr),
- read_vio(nullptr),
- write_vio(nullptr),
- read_buffer(nullptr),
- write_buffer(nullptr),
- reader_for_rbuf(nullptr),
- reader_for_wbuf(nullptr),
- write_bytes_to_add_per(0),
- timeout(0),
- actual_bytes_read(0),
- actual_bytes_sent(0),
- write_done(false),
- read_done(false),
- read_seed(0),
- write_seed(0),
- bytes_to_send(0),
- bytes_to_read(0),
- nbytes_read(0),
- nbytes_write(0),
- expected_read_term(0),
- expected_write_term(0),
- test_name(nullptr),
- module_name(nullptr),
- debug_tag(nullptr)
-{
-}
+NetVCTest::NetVCTest() : Continuation(nullptr) {}
NetVCTest::~NetVCTest()
{
@@ -395,6 +365,6 @@ NetVCTest::main_handler(int event, void *data)
return 0;
}
-NetTestDriver::NetTestDriver() : Continuation(nullptr), errors(0), r(nullptr), pstatus(nullptr) {}
+NetTestDriver::NetTestDriver() : Continuation(nullptr) {}
NetTestDriver::~NetTestDriver() {}
diff --git a/iocore/net/P_Connection.h b/iocore/net/P_Connection.h
index f7d4d68..9741fd7 100644
--- a/iocore/net/P_Connection.h
+++ b/iocore/net/P_Connection.h
@@ -78,11 +78,11 @@ struct NetVCOptions;
//
///////////////////////////////////////////////////////////////////////
struct Connection {
- SOCKET fd; ///< Socket for connection.
- IpEndpoint addr; ///< Associated address.
- bool is_bound; ///< Flag for already bound to a local address.
- bool is_connected; ///< Flag for already connected.
- int sock_type;
+ SOCKET fd; ///< Socket for connection.
+ IpEndpoint addr; ///< Associated address.
+ bool is_bound = false; ///< Flag for already bound to a local address.
+ bool is_connected = false; ///< Flag for already connected.
+ int sock_type = 0;
/** Create and initialize the socket for this connection.
@@ -160,7 +160,7 @@ struct Server : public Connection {
IpEndpoint accept_addr;
/// If set, a kernel HTTP accept filter
- bool http_accept_filter;
+ bool http_accept_filter = false;
int accept(Connection *c);
@@ -173,5 +173,5 @@ struct Server : public Connection {
int listen(bool non_blocking, const NetProcessor::AcceptOptions &opt);
int setup_fd_for_listen(bool non_blocking, const NetProcessor::AcceptOptions &opt);
- Server() : Connection(), http_accept_filter(false) { ink_zero(accept_addr); }
+ Server() : Connection() { ink_zero(accept_addr); }
};
diff --git a/iocore/net/P_NetVCTest.h b/iocore/net/P_NetVCTest.h
index 08be426..eedbb8d 100644
--- a/iocore/net/P_NetVCTest.h
+++ b/iocore/net/P_NetVCTest.h
@@ -73,11 +73,11 @@ public:
NetTestDriver();
~NetTestDriver() override;
- int errors;
+ int errors = 0;
protected:
- RegressionTest *r;
- int *pstatus;
+ RegressionTest *r = nullptr;
+ int *pstatus = nullptr;
};
class NetVCTest : public Continuation
@@ -85,7 +85,7 @@ class NetVCTest : public Continuation
public:
NetVCTest();
~NetVCTest() override;
- NetVcTestType_t test_cont_type;
+ NetVcTestType_t test_cont_type = NET_VC_TEST_ACTIVE;
int main_handler(int event, void *data);
void read_handler(int event);
@@ -103,41 +103,41 @@ public:
void finished();
void record_error(const char *msg);
- NetVConnection *test_vc;
- RegressionTest *regress;
- NetTestDriver *driver;
+ NetVConnection *test_vc = nullptr;
+ RegressionTest *regress = nullptr;
+ NetTestDriver *driver = nullptr;
- VIO *read_vio;
- VIO *write_vio;
+ VIO *read_vio = nullptr;
+ VIO *write_vio = nullptr;
- MIOBuffer *read_buffer;
- MIOBuffer *write_buffer;
+ MIOBuffer *read_buffer = nullptr;
+ MIOBuffer *write_buffer = nullptr;
- IOBufferReader *reader_for_rbuf;
- IOBufferReader *reader_for_wbuf;
+ IOBufferReader *reader_for_rbuf = nullptr;
+ IOBufferReader *reader_for_wbuf = nullptr;
- int write_bytes_to_add_per;
- int timeout;
+ int write_bytes_to_add_per = 0;
+ int timeout = 0;
- int actual_bytes_read;
- int actual_bytes_sent;
+ int actual_bytes_read = 0;
+ int actual_bytes_sent = 0;
- bool write_done;
- bool read_done;
+ bool write_done = false;
+ bool read_done = false;
- uint8_t read_seed;
- uint8_t write_seed;
+ uint8_t read_seed = 0;
+ uint8_t write_seed = 0;
- int bytes_to_send;
- int bytes_to_read;
+ int bytes_to_send = 0;
+ int bytes_to_read = 0;
- int nbytes_read;
- int nbytes_write;
+ int nbytes_read = 0;
+ int nbytes_write = 0;
- int expected_read_term;
- int expected_write_term;
+ int expected_read_term = 0;
+ int expected_write_term = 0;
- const char *test_name;
- const char *module_name;
- const char *debug_tag;
+ const char *test_name = nullptr;
+ const char *module_name = nullptr;
+ const char *debug_tag = nullptr;
};
diff --git a/iocore/net/P_SNIActionPerformer.h b/iocore/net/P_SNIActionPerformer.h
index 4c111f0..4c27c73 100644
--- a/iocore/net/P_SNIActionPerformer.h
+++ b/iocore/net/P_SNIActionPerformer.h
@@ -117,7 +117,7 @@ public:
class TLSValidProtocols : public ActionItem
{
- bool unset;
+ bool unset = true;
unsigned long protocol_mask;
public:
@@ -126,7 +126,7 @@ public:
#else
static const unsigned long max_mask = SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2;
#endif
- TLSValidProtocols() : unset(true), protocol_mask(max_mask) {}
+ TLSValidProtocols() : protocol_mask(max_mask) {}
TLSValidProtocols(unsigned long protocols) : unset(false), protocol_mask(protocols) {}
int
SNIAction(Continuation *cont) const override
diff --git a/iocore/net/P_SSLCertLookup.h b/iocore/net/P_SSLCertLookup.h
index 475d05d..3a79340 100644
--- a/iocore/net/P_SSLCertLookup.h
+++ b/iocore/net/P_SSLCertLookup.h
@@ -61,21 +61,21 @@ struct SSLCertContext {
OPT_TUNNEL ///< Just tunnel, don't terminate.
};
- SSLCertContext() : ctx(nullptr), opt(OPT_NONE), keyblock(nullptr) {}
- explicit SSLCertContext(SSL_CTX *c) : ctx(c), opt(OPT_NONE), keyblock(nullptr) {}
- SSLCertContext(SSL_CTX *c, Option o) : ctx(c), opt(o), keyblock(nullptr) {}
+ SSLCertContext() {}
+ explicit SSLCertContext(SSL_CTX *c) : ctx(c) {}
+ SSLCertContext(SSL_CTX *c, Option o) : ctx(c), opt(o) {}
SSLCertContext(SSL_CTX *c, Option o, ssl_ticket_key_block *kb) : ctx(c), opt(o), keyblock(kb) {}
void release();
- SSL_CTX *ctx; ///< openSSL context.
- Option opt; ///< Special handling option.
- ssl_ticket_key_block *keyblock; ///< session keys associated with this address
+ SSL_CTX *ctx = nullptr; ///< openSSL context.
+ Option opt = OPT_NONE; ///< Special handling option.
+ ssl_ticket_key_block *keyblock = nullptr; ///< session keys associated with this address
};
struct SSLCertLookup : public ConfigInfo {
SSLContextStorage *ssl_storage;
- SSL_CTX *ssl_default;
- bool is_valid;
+ SSL_CTX *ssl_default = nullptr;
+ bool is_valid = true;
int insert(const char *name, SSLCertContext const &cc);
int insert(const IpEndpoint &address, SSLCertContext const &cc);
diff --git a/iocore/net/P_SSLNextProtocolSet.h b/iocore/net/P_SSLNextProtocolSet.h
index 0676906..61d1ded 100644
--- a/iocore/net/P_SSLNextProtocolSet.h
+++ b/iocore/net/P_SSLNextProtocolSet.h
@@ -60,8 +60,8 @@ public:
SSLNextProtocolSet &operator=(const SSLNextProtocolSet &) = delete; // disabled
private:
- mutable unsigned char *npn;
- mutable size_t npnsz;
+ mutable unsigned char *npn = nullptr;
+ mutable size_t npnsz = 0;
NextProtocolEndpoint::list_type endpoints;
};
diff --git a/iocore/net/P_SSLUtils.h b/iocore/net/P_SSLUtils.h
index 7a8a975..b154dc1 100644
--- a/iocore/net/P_SSLUtils.h
+++ b/iocore/net/P_SSLUtils.h
@@ -43,10 +43,7 @@ typedef int ssl_error_t;
@brief Gather user provided settings from ssl_multicert.config in to this single struct
*/
struct SSLMultiCertConfigParams {
- SSLMultiCertConfigParams() : opt(SSLCertContext::OPT_NONE)
- {
- REC_ReadConfigInt32(session_ticket_enabled, "proxy.config.ssl.server.session_ticket.enable");
- }
+ SSLMultiCertConfigParams() { REC_ReadConfigInt32(session_ticket_enabled, "proxy.config.ssl.server.session_ticket.enable"); }
int session_ticket_enabled; ///< session ticket enabled
ats_scoped_str addr; ///< IPv[64] address to match
@@ -56,7 +53,7 @@ struct SSLMultiCertConfigParams {
ats_scoped_str key; ///< Private key
ats_scoped_str dialog; ///< Private key dialog
ats_scoped_str servername; ///< Destination server
- SSLCertContext::Option opt; ///< SSLCertContext special handling option
+ SSLCertContext::Option opt = SSLCertContext::OPT_NONE; ///< SSLCertContext special handling option
};
/**
diff --git a/iocore/net/P_Socks.h b/iocore/net/P_Socks.h
index aba0a0b..2f875c1 100644
--- a/iocore/net/P_Socks.h
+++ b/iocore/net/P_Socks.h
@@ -39,20 +39,20 @@ enum {
};
struct socks_conf_struct {
- int socks_needed;
- int server_connect_timeout;
- int socks_timeout;
- unsigned char default_version;
- char *user_name_n_passwd;
- int user_name_n_passwd_len;
+ int socks_needed = 0;
+ int server_connect_timeout = 0;
+ int socks_timeout = 100;
+ unsigned char default_version = 5;
+ char *user_name_n_passwd = nullptr;
+ int user_name_n_passwd_len = 0;
- int per_server_connection_attempts;
- int connection_attempts;
+ int per_server_connection_attempts = 1;
+ int connection_attempts = 0;
// the following ports are used by SocksProxy
- int accept_enabled;
- int accept_port;
- unsigned short http_port;
+ int accept_enabled = 0;
+ int accept_port = 0;
+ unsigned short http_port = 1080;
#ifdef SOCKS_WITH_TS
IpMap ip_map;
@@ -63,17 +63,7 @@ struct socks_conf_struct {
#endif
socks_conf_struct()
- : socks_needed(0),
- server_connect_timeout(0),
- socks_timeout(100),
- default_version(5),
- user_name_n_passwd(nullptr),
- user_name_n_passwd_len(0),
- per_server_connection_attempts(1),
- connection_attempts(0),
- accept_enabled(0),
- accept_port(0),
- http_port(1080)
+
{
#if !defined(SOCKS_WITH_TS)
memset(&server_addr, 0, sizeof(server_addr));
diff --git a/iocore/net/P_UDPConnection.h b/iocore/net/P_UDPConnection.h
index ed08d89..443df0e 100644
--- a/iocore/net/P_UDPConnection.h
+++ b/iocore/net/P_UDPConnection.h
@@ -38,14 +38,14 @@ public:
UDPConnectionInternal();
~UDPConnectionInternal() override;
- Continuation *continuation;
- int recvActive; // interested in receiving
- int refcount; // public for assertion
+ Continuation *continuation = nullptr;
+ int recvActive = 0; // interested in receiving
+ int refcount = 0; // public for assertion
SOCKET fd;
IpEndpoint binding;
- int binding_valid;
- int tobedestroyed;
+ int binding_valid = 0;
+ int tobedestroyed = 0;
int sendGenerationNum;
int64_t lastSentPktTSSeqNum;
@@ -60,8 +60,7 @@ public:
};
TS_INLINE
-UDPConnectionInternal::UDPConnectionInternal()
- : continuation(nullptr), recvActive(0), refcount(0), fd(-1), binding_valid(0), tobedestroyed(0)
+UDPConnectionInternal::UDPConnectionInternal() : fd(-1)
{
sendGenerationNum = 0;
lastSentPktTSSeqNum = -1;
diff --git a/iocore/net/P_UDPIOEvent.h b/iocore/net/P_UDPIOEvent.h
index b89c9c7..593929e 100644
--- a/iocore/net/P_UDPIOEvent.h
+++ b/iocore/net/P_UDPIOEvent.h
@@ -28,7 +28,7 @@
class UDPIOEvent : public Event
{
public:
- UDPIOEvent() : fd(-1), err(0), m(nullptr), handle(nullptr), b(nullptr), bytesTransferred(0){};
+ UDPIOEvent() : b(nullptr){};
~UDPIOEvent() override{};
void
@@ -90,12 +90,12 @@ public:
private:
void *operator new(size_t size); // undefined
- int fd;
- int err; // error code
- struct msghdr *m;
- void *handle; // some extra data for the client handler
- Ptr<IOBufferBlock> b; // holds buffer that I/O will go to
- int bytesTransferred; // actual bytes transferred
+ int fd = -1;
+ int err = 0; // error code
+ struct msghdr *m = nullptr;
+ void *handle = nullptr; // some extra data for the client handler
+ Ptr<IOBufferBlock> b; // holds buffer that I/O will go to
+ int bytesTransferred = 0; // actual bytes transferred
};
extern ClassAllocator<UDPIOEvent> UDPIOEventAllocator;
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index c23dc07..5340178 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -61,19 +61,19 @@ extern UDPNetProcessorInternal udpNetInternal;
class PacketQueue
{
public:
- PacketQueue() : nPackets(0), now_slot(0)
+ PacketQueue()
{
lastPullLongTermQ = 0;
init();
}
virtual ~PacketQueue() {}
- int nPackets;
+ int nPackets = 0;
ink_hrtime lastPullLongTermQ;
Queue<UDPPacketInternal> longTermQ;
Queue<UDPPacketInternal> bucket[N_SLOTS];
ink_hrtime delivery_time[N_SLOTS];
- int now_slot;
+ int now_slot = 0;
void
init()
diff --git a/iocore/net/P_UDPPacket.h b/iocore/net/P_UDPPacket.h
index c76deee..80426ca 100644
--- a/iocore/net/P_UDPPacket.h
+++ b/iocore/net/P_UDPPacket.h
@@ -44,24 +44,24 @@ public:
SLINK(UDPPacketInternal, alink); // atomic link
// packet scheduling stuff: keep it a doubly linked list
- uint64_t pktLength;
+ uint64_t pktLength = 0;
- int reqGenerationNum;
- ink_hrtime delivery_time; // when to deliver packet
+ int reqGenerationNum = 0;
+ ink_hrtime delivery_time = 0; // when to deliver packet
Ptr<IOBufferBlock> chain;
- Continuation *cont; // callback on error
- UDPConnectionInternal *conn; // connection where packet should be sent to.
+ Continuation *cont = nullptr; // callback on error
+ UDPConnectionInternal *conn = nullptr; // connection where packet should be sent to.
- int in_the_priority_queue;
- int in_heap;
+ int in_the_priority_queue = 0;
+ int in_heap = 0;
};
inkcoreapi extern ClassAllocator<UDPPacketInternal> udpPacketAllocator;
TS_INLINE
UDPPacketInternal::UDPPacketInternal()
- : pktLength(0), reqGenerationNum(0), delivery_time(0), cont(nullptr), conn(nullptr), in_the_priority_queue(0), in_heap(0)
+
{
memset(&from, '\0', sizeof(from));
memset(&to, '\0', sizeof(to));
diff --git a/iocore/net/P_UnixNetState.h b/iocore/net/P_UnixNetState.h
index 10cbf4c..3a2265c 100644
--- a/iocore/net/P_UnixNetState.h
+++ b/iocore/net/P_UnixNetState.h
@@ -43,12 +43,12 @@ class Event;
class UnixNetVConnection;
struct NetState {
- int enabled;
+ int enabled = 0;
VIO vio;
Link<UnixNetVConnection> ready_link;
SLink<UnixNetVConnection> enable_link;
- int in_enabled_list;
- int triggered;
+ int in_enabled_list = 0;
+ int triggered = 0;
- NetState() : enabled(0), vio(VIO::NONE), in_enabled_list(0), triggered(0) {}
+ NetState() : vio(VIO::NONE) {}
};
diff --git a/iocore/net/P_UnixNetVConnection.h b/iocore/net/P_UnixNetVConnection.h
index ba57091..f56a208 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -232,7 +232,7 @@ public:
UnixNetVConnection *migrateToCurrentThread(Continuation *c, EThread *t);
Action action_;
- int closed;
+ int closed = 0;
NetState read;
NetState write;
@@ -244,14 +244,14 @@ public:
LINK(UnixNetVConnection, keep_alive_queue_link);
LINK(UnixNetVConnection, active_queue_link);
- ink_hrtime inactivity_timeout_in;
- ink_hrtime active_timeout_in;
- ink_hrtime next_inactivity_timeout_at;
- ink_hrtime next_activity_timeout_at;
+ ink_hrtime inactivity_timeout_in = 0;
+ ink_hrtime active_timeout_in = 0;
+ ink_hrtime next_inactivity_timeout_at = 0;
+ ink_hrtime next_activity_timeout_at = 0;
EventIO ep;
- NetHandler *nh;
- unsigned int id;
+ NetHandler *nh = nullptr;
+ unsigned int id = 0;
union {
unsigned int flags;
@@ -264,11 +264,11 @@ public:
};
Connection con;
- int recursion;
- ink_hrtime submit_time;
- OOB_callback *oob_ptr;
- bool from_accept_thread;
- NetAccept *accept_object;
+ int recursion = 0;
+ ink_hrtime submit_time = 0;
+ OOB_callback *oob_ptr = nullptr;
+ bool from_accept_thread = false;
+ NetAccept *accept_object = nullptr;
// es - origin_trace associated connections
bool origin_trace;
diff --git a/iocore/net/SSLCertLookup.cc b/iocore/net/SSLCertLookup.cc
index bf6c1a0..641f7ab 100644
--- a/iocore/net/SSLCertLookup.cc
+++ b/iocore/net/SSLCertLookup.cc
@@ -113,14 +113,14 @@ private:
linkage required by @c Trie.
*/
struct ContextRef {
- ContextRef() : idx(-1) {}
+ ContextRef() {}
explicit ContextRef(int n) : idx(n) {}
void
Print() const
{
Debug("ssl", "Item=%p SSL_CTX=#%d", this, idx);
}
- int idx; ///< Index in the context store.
+ int idx = -1; ///< Index in the context store.
LINK(ContextRef, link); ///< Require by @c Trie
};
@@ -239,7 +239,7 @@ SSLCertContext::release()
ctx = nullptr;
}
-SSLCertLookup::SSLCertLookup() : ssl_storage(new SSLContextStorage()), ssl_default(nullptr), is_valid(true) {}
+SSLCertLookup::SSLCertLookup() : ssl_storage(new SSLContextStorage()) {}
SSLCertLookup::~SSLCertLookup()
{
diff --git a/iocore/net/SSLNextProtocolSet.cc b/iocore/net/SSLNextProtocolSet.cc
index 6c9d4df..2adefce 100644
--- a/iocore/net/SSLNextProtocolSet.cc
+++ b/iocore/net/SSLNextProtocolSet.cc
@@ -157,7 +157,7 @@ SSLNextProtocolSet::findEndpoint(const unsigned char *proto, unsigned len) const
return nullptr;
}
-SSLNextProtocolSet::SSLNextProtocolSet() : npn(nullptr), npnsz(0) {}
+SSLNextProtocolSet::SSLNextProtocolSet() {}
SSLNextProtocolSet::~SSLNextProtocolSet()
{
diff --git a/iocore/net/SSLSessionCache.cc b/iocore/net/SSLSessionCache.cc
index 1238b4b..57e01ab 100644
--- a/iocore/net/SSLSessionCache.cc
+++ b/iocore/net/SSLSessionCache.cc
@@ -36,7 +36,7 @@
#endif
/* Session Cache */
-SSLSessionCache::SSLSessionCache() : session_bucket(nullptr), nbuckets(SSLConfigParams::session_cache_number_buckets)
+SSLSessionCache::SSLSessionCache() : nbuckets(SSLConfigParams::session_cache_number_buckets)
{
Debug("ssl.session_cache", "Created new ssl session cache %p with %zu buckets each with size max size %zu", this, nbuckets,
SSLConfigParams::session_cache_max_bucket_size);
diff --git a/iocore/net/SSLSessionCache.h b/iocore/net/SSLSessionCache.h
index 9c763a8..5a5d50f 100644
--- a/iocore/net/SSLSessionCache.h
+++ b/iocore/net/SSLSessionCache.h
@@ -154,6 +154,6 @@ public:
~SSLSessionCache();
private:
- SSLSessionBucket *session_bucket;
+ SSLSessionBucket *session_bucket = nullptr;
size_t nbuckets;
};
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index 181deb3..456fa95 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -866,20 +866,8 @@ UnixNetVConnection::reenable_re(VIO *vio)
}
}
-UnixNetVConnection::UnixNetVConnection()
- : closed(0),
- inactivity_timeout_in(0),
- active_timeout_in(0),
- next_inactivity_timeout_at(0),
- next_activity_timeout_at(0),
- nh(nullptr),
- id(0),
- flags(0),
- recursion(0),
- submit_time(0),
- oob_ptr(nullptr),
- from_accept_thread(false),
- accept_object(nullptr)
+UnixNetVConnection::UnixNetVConnection() : flags(0)
+
{
SET_HANDLER((NetVConnHandler)&UnixNetVConnection::startEvent);
}
diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index e6951c6..eb7cf2b 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -297,13 +297,10 @@ UDPReadContinuation::UDPReadContinuation(Event *completionToken)
: Continuation(nullptr),
event(completionToken),
readbuf(nullptr),
- readlen(0),
- fromaddrlen(nullptr),
+
fd(-1),
- ifd(-1),
- period(0),
- elapsed_time(0),
- timeout_interval(0)
+ ifd(-1)
+
{
if (completionToken->continuation) {
this->mutex = completionToken->continuation->mutex;
diff --git a/iocore/utils/I_OneWayTunnel.h b/iocore/utils/I_OneWayTunnel.h
index 448737c..8a83564 100644
--- a/iocore/utils/I_OneWayTunnel.h
+++ b/iocore/utils/I_OneWayTunnel.h
@@ -189,21 +189,21 @@ struct OneWayTunnel : public Continuation {
bool last_connection();
- VIO *vioSource;
- VIO *vioTarget;
- Continuation *cont;
- Transform_fn manipulate_fn;
- int n_connections;
- int lerrno;
-
- bool single_buffer;
- bool close_source;
- bool close_target;
- bool tunnel_till_done;
+ VIO *vioSource = nullptr;
+ VIO *vioTarget = nullptr;
+ Continuation *cont = nullptr;
+ Transform_fn manipulate_fn = nullptr;
+ int n_connections = 0;
+ int lerrno = 0;
+
+ bool single_buffer = false;
+ bool close_source = false;
+ bool close_target = false;
+ bool tunnel_till_done = false;
/** Non-nullptr when this is one side of a two way tunnel. */
- OneWayTunnel *tunnel_peer;
- bool free_vcs;
+ OneWayTunnel *tunnel_peer = nullptr;
+ bool free_vcs = true;
// noncopyable
OneWayTunnel(const OneWayTunnel &) = delete;
diff --git a/iocore/utils/OneWayTunnel.cc b/iocore/utils/OneWayTunnel.cc
index 0760726..d4484f2 100644
--- a/iocore/utils/OneWayTunnel.cc
+++ b/iocore/utils/OneWayTunnel.cc
@@ -64,22 +64,7 @@ transfer_data(MIOBufferAccessor &in_buf, MIOBufferAccessor &out_buf)
out_buf.writer()->fill(n);
}
-OneWayTunnel::OneWayTunnel()
- : Continuation(nullptr),
- vioSource(nullptr),
- vioTarget(nullptr),
- cont(nullptr),
- manipulate_fn(nullptr),
- n_connections(0),
- lerrno(0),
- single_buffer(false),
- close_source(false),
- close_target(false),
- tunnel_till_done(false),
- tunnel_peer(nullptr),
- free_vcs(true)
-{
-}
+OneWayTunnel::OneWayTunnel() : Continuation(nullptr) {}
OneWayTunnel *
OneWayTunnel::OneWayTunnel_alloc()
diff --git a/lib/records/I_RecHttp.h b/lib/records/I_RecHttp.h
index c3db5a7..fda5176 100644
--- a/lib/records/I_RecHttp.h
+++ b/lib/records/I_RecHttp.h
@@ -239,20 +239,20 @@ public:
TRANSPORT_PLUGIN /// < Protocol plugin connection
};
- int m_fd; ///< Pre-opened file descriptor if present.
- TransportType m_type; ///< Type of connection.
- in_port_t m_port; ///< Port on which to listen.
- uint8_t m_family; ///< IP address family.
+ int m_fd; ///< Pre-opened file descriptor if present.
+ TransportType m_type = TRANSPORT_DEFAULT; ///< Type of connection.
+ in_port_t m_port = 0; ///< Port on which to listen.
+ uint8_t m_family = AF_INET; ///< IP address family.
/// True if proxy protocol is required on incoming requests.
- bool m_proxy_protocol;
+ bool m_proxy_protocol = false;
/// True if inbound connects (from client) are transparent.
- bool m_inbound_transparent_p;
+ bool m_inbound_transparent_p = false;
/// True if outbound connections (to origin servers) are transparent.
- bool m_outbound_transparent_p;
+ bool m_outbound_transparent_p = false;
// True if transparent pass-through is enabled on this port.
- bool m_transparent_passthrough;
+ bool m_transparent_passthrough = false;
/// True if MPTCP is enabled on this port.
- bool m_mptcp;
+ bool m_mptcp = false;
/// Local address for inbound connections (listen address).
IpAddr m_inbound_ip;
/// Local address for outbound connections (to origin server).
diff --git a/lib/records/RecHttp.cc b/lib/records/RecHttp.cc
index 0ad3378..5f5ddb7 100644
--- a/lib/records/RecHttp.cc
+++ b/lib/records/RecHttp.cc
@@ -197,16 +197,8 @@ HttpProxyPort::Group GLOBAL_DATA;
} // namespace
HttpProxyPort::Group &HttpProxyPort::m_global = GLOBAL_DATA;
-HttpProxyPort::HttpProxyPort()
- : m_fd(ts::NO_FD),
- m_type(TRANSPORT_DEFAULT),
- m_port(0),
- m_family(AF_INET),
- m_proxy_protocol(false),
- m_inbound_transparent_p(false),
- m_outbound_transparent_p(false),
- m_transparent_passthrough(false),
- m_mptcp(false)
+HttpProxyPort::HttpProxyPort() : m_fd(ts::NO_FD)
+
{
memcpy(m_host_res_preference, host_res_default_preference_order, sizeof(m_host_res_preference));
}
diff --git a/lib/tsconfig/Errata.h b/lib/tsconfig/Errata.h
index 6d391cc..eba5bac 100644
--- a/lib/tsconfig/Errata.h
+++ b/lib/tsconfig/Errata.h
@@ -517,7 +517,7 @@ struct Errata::Data : public IntrusivePtrCounter {
void push(Message && msg);
/// Log this when it is deleted.
- mutable bool m_log_on_delete;
+ mutable bool m_log_on_delete = true;
//! The message stack.
Container m_items;
@@ -867,7 +867,7 @@ inline Errata& Errata::doNotLog() {
return *this;
}
-inline Errata::Data::Data() : m_log_on_delete(true) {}
+inline Errata::Data::Data() {}
inline size_t Errata::Data::size() const { return m_items.size(); }
inline Errata::iterator::iterator() { }
diff --git a/lib/tsconfig/TsBuilder.h b/lib/tsconfig/TsBuilder.h
index f9da52d..de765be 100644
--- a/lib/tsconfig/TsBuilder.h
+++ b/lib/tsconfig/TsBuilder.h
@@ -36,9 +36,9 @@ class Builder {
public:
typedef Builder self;
struct Handler {
- self* _ptr; ///< Pointer to Builder instance.
+ self* _ptr = nullptr; ///< Pointer to Builder instance.
/// Pointer to method to invoke for this event.
- void (self::*_method)(Token const& token);
+ void (self::*_method)(Token const& token) = nullptr;
/// Default constructor.
Handler();
@@ -92,7 +92,7 @@ public:
self& init();
};
-inline Builder::Handler::Handler() : _ptr(nullptr), _method(nullptr) { }
+inline Builder::Handler::Handler() { }
inline Builder::Builder() { this->init(); }
inline Builder::Builder(Configuration const& config) : _config(config) { this->init(); }
diff --git a/lib/tsconfig/TsValue.h b/lib/tsconfig/TsValue.h
index 8863eb8..7d420df 100644
--- a/lib/tsconfig/TsValue.h
+++ b/lib/tsconfig/TsValue.h
@@ -217,13 +217,13 @@ namespace detail {
/// Get item type.
ValueType getType() const;
protected:
- ValueType _type; ///< Type of value.
+ ValueType _type = VoidValue; ///< Type of value.
ValueIndex _parent = 0; ///< Table index of parent value.
ConstBuffer _text; ///< Text of value (if scalar).
ConstBuffer _name; ///< Local name of value, if available.
- size_t _local_index; ///< Index among siblings.
- int _srcLine; ///< Source line.
- int _srcColumn; ///< Source column.
+ size_t _local_index = 0; ///< Index among siblings.
+ int _srcLine = 0; ///< Source line.
+ int _srcColumn = 0; ///< Source column.
/// Container for children of this item.
typedef std::vector<ValueIndex> ChildGroup;
@@ -645,8 +645,8 @@ namespace detail {
inline ValueItem const& ValueTable::operator [] (ValueIndex idx) const { return const_cast<self*>(this)->operator [] (idx); }
inline ValueTable& ValueTable::reset() { _ptr.reset(); return *this; }
- inline ValueItem::ValueItem() : _type(VoidValue), _local_index(0), _srcLine(0), _srcColumn(0) {}
- inline ValueItem::ValueItem(ValueType type) : _type(type), _local_index(0), _srcLine(0), _srcColumn(0) {}
+ inline ValueItem::ValueItem() {}
+ inline ValueItem::ValueItem(ValueType type) : _type(type) {}
inline ValueType ValueItem::getType() const { return _type; }
}
diff --git a/plugins/authproxy/authproxy.cc b/plugins/authproxy/authproxy.cc
index 4a5e5be..8ce13be 100644
--- a/plugins/authproxy/authproxy.cc
+++ b/plugins/authproxy/authproxy.cc
@@ -55,11 +55,11 @@ static TSCont AuthOsDnsContinuation;
struct AuthOptions {
std::string hostname;
- int hostport;
- AuthRequestTransform transform;
- bool force;
+ int hostport = -1;
+ AuthRequestTransform transform = nullptr;
+ bool force = false;
- AuthOptions() : hostport(-1), transform(nullptr), force(false) {}
+ AuthOptions() {}
~AuthOptions() {}
};
@@ -137,27 +137,19 @@ static const StateTransition StateTableInit[] = {{TS_EVENT_HTTP_POST_REMAP, Stat
{TS_EVENT_NONE, nullptr, nullptr}};
struct AuthRequestContext {
- TSHttpTxn txn; // Original client transaction we are authorizing.
- TSCont cont; // Continuation for this state machine.
- TSVConn vconn; // Virtual connection to the auth proxy.
- TSHttpParser hparser; // HTTP response header parser.
- HttpHeader rheader; // HTTP response header.
+ TSHttpTxn txn = nullptr; // Original client transaction we are authorizing.
+ TSCont cont = nullptr; // Continuation for this state machine.
+ TSVConn vconn = nullptr; // Virtual connection to the auth proxy.
+ TSHttpParser hparser; // HTTP response header parser.
+ HttpHeader rheader; // HTTP response header.
HttpIoBuffer iobuf;
- const char *method; // Client request method (e.g. GET)
- bool read_body;
-
- const StateTransition *state;
-
- AuthRequestContext()
- : txn(nullptr),
- cont(nullptr),
- vconn(nullptr),
- hparser(TSHttpParserCreate()),
- rheader(),
- iobuf(TS_IOBUFFER_SIZE_INDEX_4K),
- method(nullptr),
- read_body(true),
- state(nullptr)
+ const char *method = nullptr; // Client request method (e.g. GET)
+ bool read_body = true;
+
+ const StateTransition *state = nullptr;
+
+ AuthRequestContext() : hparser(TSHttpParserCreate()), rheader(), iobuf(TS_IOBUFFER_SIZE_INDEX_4K)
+
{
this->cont = TSContCreate(dispatch, TSMutexCreate());
TSContDataSet(this->cont, this);
diff --git a/plugins/cache_promote/cache_promote.cc b/plugins/cache_promote/cache_promote.cc
index d05127a..23e88c9 100644
--- a/plugins/cache_promote/cache_promote.cc
+++ b/plugins/cache_promote/cache_promote.cc
@@ -56,7 +56,7 @@ static const struct option longopt[] = {
class PromotionPolicy
{
public:
- PromotionPolicy() : _sample(0.0)
+ PromotionPolicy()
{
// This doesn't have to be perfect, since this is just chance sampling.
// coverity[dont_call]
@@ -106,7 +106,7 @@ public:
virtual void usage() const = 0;
private:
- float _sample;
+ float _sample = 0.0;
};
//////////////////////////////////////////////////////////////////////////////////////////////
@@ -195,7 +195,7 @@ static LRUEntry NULL_LRU_ENTRY; // Used to create an "empty" new LRUEntry
class LRUPolicy : public PromotionPolicy
{
public:
- LRUPolicy() : PromotionPolicy(), _buckets(1000), _hits(10), _lock(TSMutexCreate()), _list_size(0), _freelist_size(0) {}
+ LRUPolicy() : PromotionPolicy(), _lock(TSMutexCreate()) {}
~LRUPolicy() override
{
TSDebug(PLUGIN_NAME, "deleting LRUPolicy object");
@@ -333,14 +333,14 @@ public:
}
private:
- unsigned _buckets;
- unsigned _hits;
+ unsigned _buckets = 1000;
+ unsigned _hits = 10;
// For the LRU. Note that we keep track of the List sizes, because some versions fo STL have broken
// implementations of size(), making them obsessively slow on calling ::size().
TSMutex _lock;
LRUMap _map;
LRUList _list, _freelist;
- size_t _list_size, _freelist_size;
+ size_t _list_size = 0, _freelist_size = 0;
};
//////////////////////////////////////////////////////////////////////////////////////////////
@@ -349,7 +349,7 @@ private:
class PromotionConfig
{
public:
- PromotionConfig() : _policy(nullptr) {}
+ PromotionConfig() {}
~PromotionConfig() { delete _policy; }
PromotionPolicy *
getPolicy() const
@@ -402,7 +402,7 @@ public:
}
private:
- PromotionPolicy *_policy;
+ PromotionPolicy *_policy = nullptr;
};
//////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/cachekey/configs.h b/plugins/cachekey/configs.h
index 603ff43..89a67af 100644
--- a/plugins/cachekey/configs.h
+++ b/plugins/cachekey/configs.h
@@ -41,7 +41,7 @@ enum CacheKeyUriType {
class ConfigElements
{
public:
- ConfigElements() : _sort(false), _remove(false), _skip(false) {}
+ ConfigElements() {}
virtual ~ConfigElements();
void setExclude(const char *arg);
void setInclude(const char *arg);
@@ -82,9 +82,9 @@ protected:
MultiPattern _includePatterns;
MultiPattern _excludePatterns;
- bool _sort;
- bool _remove;
- bool _skip;
+ bool _sort = false;
+ bool _remove = false;
+ bool _skip = false;
std::map<String, MultiPattern *> _captures;
};
diff --git a/plugins/cachekey/pattern.cc b/plugins/cachekey/pattern.cc
index 27eb94e..3672b69 100644
--- a/plugins/cachekey/pattern.cc
+++ b/plugins/cachekey/pattern.cc
@@ -38,7 +38,7 @@ replaceString(String &str, const String &from, const String &to)
}
}
-Pattern::Pattern() : _re(nullptr), _extra(nullptr), _pattern(""), _replacement(""), _replace(false), _tokenCount(0) {}
+Pattern::Pattern() : _pattern(""), _replacement("") {}
/**
* @brief Initializes PCRE pattern by providing the subject and replacement strings.
diff --git a/plugins/cachekey/pattern.h b/plugins/cachekey/pattern.h
index 47cd35c..749d243 100644
--- a/plugins/cachekey/pattern.h
+++ b/plugins/cachekey/pattern.h
@@ -57,16 +57,16 @@ private:
bool compile();
void pcreFree();
- pcre *_re; /**< @brief PCRE compiled info structure, computed during initialization */
- pcre_extra *_extra; /**< @brief PCRE study data block, computed during initialization */
+ pcre *_re = nullptr; /**< @brief PCRE compiled info structure, computed during initialization */
+ pcre_extra *_extra = nullptr; /**< @brief PCRE study data block, computed during initialization */
String _pattern; /**< @brief PCRE pattern string, containing PCRE patterns and capturing groups. */
String _replacement; /**< @brief PCRE replacement string, containing $0..$9 to be replaced with content of the capturing groups */
- bool _replace; /**< @brief true if a replacement is needed, false if not, this is to distinguish between an empty replacement
- string and no replacement needed case */
+ bool _replace = false; /**< @brief true if a replacement is needed, false if not, this is to distinguish between an empty
+ replacement string and no replacement needed case */
- int _tokenCount; /**< @brief number of replacements $0..$9 found in the replacement string if not empty */
+ int _tokenCount = 0; /**< @brief number of replacements $0..$9 found in the replacement string if not empty */
int _tokens[TOKENCOUNT]; /**< @brief replacement index 0..9, since they can be used in the replacement string in any order */
int _tokenOffset[TOKENCOUNT]; /**< @brief replacement offset inside the replacement string */
};
diff --git a/plugins/conf_remap/conf_remap.cc b/plugins/conf_remap/conf_remap.cc
index 4411f89..736b362 100644
--- a/plugins/conf_remap/conf_remap.cc
+++ b/plugins/conf_remap/conf_remap.cc
@@ -41,12 +41,12 @@ struct RemapConfigs {
int _data_len; // Used when data is a string
};
- RemapConfigs() : _current(0) { memset(_items, 0, sizeof(_items)); };
+ RemapConfigs() { memset(_items, 0, sizeof(_items)); };
bool parse_file(const char *filename);
bool parse_inline(const char *arg);
Item _items[MAX_OVERRIDABLE_CONFIGS];
- int _current;
+ int _current = 0;
};
// Helper functionfor the parser
diff --git a/plugins/escalate/escalate.cc b/plugins/escalate/escalate.cc
index f6e8862..a6b1a0e 100644
--- a/plugins/escalate/escalate.cc
+++ b/plugins/escalate/escalate.cc
@@ -51,7 +51,7 @@ struct EscalationState {
typedef std::map<unsigned, RetryInfo> StatusMapType;
- EscalationState() : use_pristine(false)
+ EscalationState()
{
cont = TSContCreate(EscalateResponse, nullptr);
TSContDataSet(cont, this);
@@ -60,7 +60,7 @@ struct EscalationState {
~EscalationState() { TSContDestroy(cont); }
TSCont cont;
StatusMapType status_map;
- bool use_pristine;
+ bool use_pristine = false;
};
// Little helper function, to update the Host portion of a URL, and stringify the result.
diff --git a/plugins/esi/combo_handler.cc b/plugins/esi/combo_handler.cc
index 4a5c336..d0c7159 100644
--- a/plugins/esi/combo_handler.cc
+++ b/plugins/esi/combo_handler.cc
@@ -83,12 +83,12 @@ static string COMBO_HANDLER_PATH{DEFAULT_COMBO_HANDLER_PATH};
using StringList = list<string>;
struct ClientRequest {
- TSHttpStatus status;
- const sockaddr *client_addr;
+ TSHttpStatus status = TS_HTTP_STATUS_OK;
+ const sockaddr *client_addr = nullptr;
StringList file_urls;
- bool gzip_accepted;
+ bool gzip_accepted = false;
string defaultBucket; // default Bucket will be set to HOST header
- ClientRequest() : status(TS_HTTP_STATUS_OK), client_addr(nullptr), gzip_accepted(false), defaultBucket("l"){};
+ ClientRequest() : defaultBucket("l"){};
};
struct InterceptData {
@@ -96,11 +96,11 @@ struct InterceptData {
TSCont contp;
struct IoHandle {
- TSVIO vio;
- TSIOBuffer buffer;
- TSIOBufferReader reader;
+ TSVIO vio = nullptr;
+ TSIOBuffer buffer = nullptr;
+ TSIOBufferReader reader = nullptr;
- IoHandle() : vio(nullptr), buffer(nullptr), reader(nullptr){};
+ IoHandle(){};
~IoHandle()
{
diff --git a/plugins/esi/fetcher/HttpDataFetcherImpl.h b/plugins/esi/fetcher/HttpDataFetcherImpl.h
index d8a7fb7..1702813 100644
--- a/plugins/esi/fetcher/HttpDataFetcherImpl.h
+++ b/plugins/esi/fetcher/HttpDataFetcherImpl.h
@@ -110,17 +110,15 @@ private:
struct RequestData {
std::string response;
std::string raw_response;
- const char *body;
- int body_len;
- TSHttpStatus resp_status;
+ const char *body = nullptr;
+ int body_len = 0;
+ TSHttpStatus resp_status = TS_HTTP_STATUS_NONE;
CallbackObjectList callback_objects;
- bool complete;
- TSMBuffer bufp;
- TSMLoc hdr_loc;
+ bool complete = false;
+ TSMBuffer bufp = nullptr;
+ TSMLoc hdr_loc = nullptr;
- RequestData() : body(nullptr), body_len(0), resp_status(TS_HTTP_STATUS_NONE), complete(false), bufp(nullptr), hdr_loc(nullptr)
- {
- }
+ RequestData() {}
};
typedef __gnu_cxx::hash_map<std::string, RequestData, EsiLib::StringHasher> UrlToContentMap;
diff --git a/plugins/esi/serverIntercept.cc b/plugins/esi/serverIntercept.cc
index a7c1c26..0fff06f 100644
--- a/plugins/esi/serverIntercept.cc
+++ b/plugins/esi/serverIntercept.cc
@@ -43,10 +43,10 @@ struct SContData {
TSCont contp;
struct IoHandle {
- TSVIO vio;
- TSIOBuffer buffer;
- TSIOBufferReader reader;
- IoHandle() : vio(nullptr), buffer(nullptr), reader(nullptr){};
+ TSVIO vio = nullptr;
+ TSIOBuffer buffer = nullptr;
+ TSIOBufferReader reader = nullptr;
+ IoHandle(){};
~IoHandle()
{
if (reader) {
diff --git a/plugins/esi/test/TestHttpDataFetcher.h b/plugins/esi/test/TestHttpDataFetcher.h
index 9eecd09..cd2ee59 100644
--- a/plugins/esi/test/TestHttpDataFetcher.h
+++ b/plugins/esi/test/TestHttpDataFetcher.h
@@ -30,7 +30,7 @@
class TestHttpDataFetcher : public HttpDataFetcher
{
public:
- TestHttpDataFetcher() : _n_pending_requests(0), _return_data(true) {}
+ TestHttpDataFetcher() {}
bool
addFetchRequest(const std::string &url, FetchedDataProcessor *callback_obj = nullptr)
{
@@ -84,7 +84,7 @@ public:
};
private:
- int _n_pending_requests;
+ int _n_pending_requests = 0;
std::string _data;
- bool _return_data;
+ bool _return_data = true;
};
diff --git a/plugins/experimental/access_control/pattern.cc b/plugins/experimental/access_control/pattern.cc
index 2c04b6a..396e222 100644
--- a/plugins/experimental/access_control/pattern.cc
+++ b/plugins/experimental/access_control/pattern.cc
@@ -38,7 +38,7 @@ replaceString(String &str, const String &from, const String &to)
}
}
-Pattern::Pattern() : _re(nullptr), _extra(nullptr), _pattern(""), _replacement(""), _replace(false), _tokenCount(0) {}
+Pattern::Pattern() : _pattern(""), _replacement("") {}
/**
* @brief Initializes PCRE pattern by providing the subject and replacement strings.
diff --git a/plugins/experimental/access_control/pattern.h b/plugins/experimental/access_control/pattern.h
index 6f05487..46df0ba 100644
--- a/plugins/experimental/access_control/pattern.h
+++ b/plugins/experimental/access_control/pattern.h
@@ -56,16 +56,16 @@ private:
bool compile();
void pcreFree();
- pcre *_re; /**< @brief PCRE compiled info structure, computed during initialization */
- pcre_extra *_extra; /**< @brief PCRE study data block, computed during initialization */
+ pcre *_re = nullptr; /**< @brief PCRE compiled info structure, computed during initialization */
+ pcre_extra *_extra = nullptr; /**< @brief PCRE study data block, computed during initialization */
String _pattern; /**< @brief PCRE pattern string, containing PCRE patterns and capturing groups. */
String _replacement; /**< @brief PCRE replacement string, containing $0..$9 to be replaced with content of the capturing groups */
- bool _replace; /**< @brief true if a replacement is needed, false if not, this is to distinguish between an empty replacement
- string and no replacement needed case */
+ bool _replace = false; /**< @brief true if a replacement is needed, false if not, this is to distinguish between an empty
+ replacement string and no replacement needed case */
- int _tokenCount; /**< @brief number of replacements $0..$9 found in the replacement string if not empty */
+ int _tokenCount = 0; /**< @brief number of replacements $0..$9 found in the replacement string if not empty */
int _tokens[TOKENCOUNT]; /**< @brief replacement index 0..9, since they can be used in the replacement string in any order */
int _tokenOffset[TOKENCOUNT]; /**< @brief replacement offset inside the replacement string */
};
diff --git a/plugins/experimental/balancer/roundrobin.cc b/plugins/experimental/balancer/roundrobin.cc
index 16f0ffd..6090ab9 100644
--- a/plugins/experimental/balancer/roundrobin.cc
+++ b/plugins/experimental/balancer/roundrobin.cc
@@ -31,7 +31,7 @@
namespace
{
struct RoundRobinBalancer : public BalancerInstance {
- RoundRobinBalancer() : targets(), next(0) {}
+ RoundRobinBalancer() : targets() {}
void
push_target(const BalancerTarget &target) override
{
@@ -45,7 +45,7 @@ struct RoundRobinBalancer : public BalancerInstance {
}
std::vector<BalancerTarget> targets;
- unsigned next;
+ unsigned next = 0;
};
} // namespace
diff --git a/plugins/experimental/cookie_remap/cookie_remap.cc b/plugins/experimental/cookie_remap/cookie_remap.cc
index d488944..f6ece83 100644
--- a/plugins/experimental/cookie_remap/cookie_remap.cc
+++ b/plugins/experimental/cookie_remap/cookie_remap.cc
@@ -194,15 +194,11 @@ public:
subop()
: cookie(""),
operation(""),
- op_type(UNKNOWN),
- target(UNKNOWN_TARGET),
+
str_match(""),
- regex(nullptr),
- regex_extra(nullptr),
- regex_ccount(0),
- bucket(""),
- how_many(0),
- out_of(0)
+
+ bucket("")
+
{
TSDebug(MY_NAME, "subop constructor called");
}
@@ -392,19 +388,19 @@ public:
private:
std::string cookie;
std::string operation;
- enum operation_type op_type;
- enum target_type target;
+ enum operation_type op_type = UNKNOWN;
+ enum target_type target = UNKNOWN_TARGET;
std::string str_match;
- pcre *regex;
- pcre_extra *regex_extra;
+ pcre *regex = nullptr;
+ pcre_extra *regex_extra = nullptr;
std::string regex_string;
- int regex_ccount;
+ int regex_ccount = 0;
std::string bucket;
- unsigned int how_many;
- unsigned int out_of;
+ unsigned int how_many = 0;
+ unsigned int out_of = 0;
};
typedef std::vector<const subop *> SubOpQueue;
diff --git a/plugins/experimental/geoip_acl/acl.h b/plugins/experimental/geoip_acl/acl.h
index f66b9c2..b8e6b8c 100644
--- a/plugins/experimental/geoip_acl/acl.h
+++ b/plugins/experimental/geoip_acl/acl.h
@@ -48,7 +48,7 @@ static const int NUM_ISO_CODES = 253;
class Acl
{
public:
- Acl() : _allow(true), _added_tokens(0) {}
+ Acl() {}
virtual ~Acl() {}
// These have to be implemented for each ACL type
virtual void read_regex(const char *fn, int &tokens) = 0;
@@ -81,8 +81,8 @@ public:
protected:
std::string _html;
- bool _allow;
- int _added_tokens;
+ bool _allow = true;
+ int _added_tokens = 0;
// Class members
static GeoDBHandle _geoip;
@@ -136,7 +136,7 @@ private:
class CountryAcl : public Acl
{
public:
- CountryAcl() : _regexes(nullptr) { memset(_iso_country_codes, 0, sizeof(_iso_country_codes)); }
+ CountryAcl() { memset(_iso_country_codes, 0, sizeof(_iso_country_codes)); }
void read_regex(const char *fn, int &tokens) override;
int process_args(int argc, char *argv[]) override;
bool eval(TSRemapRequestInfo *rri, TSHttpTxn txnp) const override;
@@ -144,5 +144,5 @@ public:
private:
bool _iso_country_codes[NUM_ISO_CODES];
- RegexAcl *_regexes;
+ RegexAcl *_regexes = nullptr;
};
diff --git a/plugins/experimental/hipes/hipes.cc b/plugins/experimental/hipes/hipes.cc
index dfcff4e..c90148a 100644
--- a/plugins/experimental/hipes/hipes.cc
+++ b/plugins/experimental/hipes/hipes.cc
@@ -129,30 +129,24 @@ struct HIPESService {
: url_param("url"),
path(""),
svc_server(""),
- svc_port(80),
- ssl(false),
+
hipes_server(HIPES_SERVER_NAME),
- hipes_port(80),
- default_redirect_flag(1),
- x_hipes_header("X-HIPES-Redirect"),
- active_timeout(-1),
- no_activity_timeout(-1),
- connect_timeout(-1),
- dns_timeout(-1){};
+
+ x_hipes_header("X-HIPES-Redirect"){};
std::string url_param;
std::string path;
std::string svc_server;
- int svc_port;
- bool ssl;
+ int svc_port = 80;
+ bool ssl = false;
std::string hipes_server;
- int hipes_port;
- unsigned int default_redirect_flag;
+ int hipes_port = 80;
+ unsigned int default_redirect_flag = 1;
std::string x_hipes_header;
- int active_timeout;
- int no_activity_timeout;
- int connect_timeout;
- int dns_timeout;
+ int active_timeout = -1;
+ int no_activity_timeout = -1;
+ int connect_timeout = -1;
+ int dns_timeout = -1;
};
///////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/experimental/inliner/chunk-decoder.h b/plugins/experimental/inliner/chunk-decoder.h
index 26318b9..0dbf873 100644
--- a/plugins/experimental/inliner/chunk-decoder.h
+++ b/plugins/experimental/inliner/chunk-decoder.h
@@ -66,11 +66,11 @@ class ChunkDecoder
};
};
- State::STATES state_;
- int64_t size_;
+ State::STATES state_ = State::kSize;
+ int64_t size_ = 0;
public:
- ChunkDecoder() : state_(State::kSize), size_(0) {}
+ ChunkDecoder() {}
void parseSizeCharacter(const char);
int parseSize(const char *, const int64_t);
int decode(const TSIOBufferReader &);
diff --git a/plugins/experimental/inliner/fetcher.h b/plugins/experimental/inliner/fetcher.h
index a1cb370..93405f2 100644
--- a/plugins/experimental/inliner/fetcher.h
+++ b/plugins/experimental/inliner/fetcher.h
@@ -63,7 +63,7 @@
namespace ats
{
struct HttpParser {
- bool parsed_;
+ bool parsed_ = false;
TSHttpParser parser_;
TSMBuffer buffer_;
TSMLoc location_;
@@ -77,7 +77,7 @@ struct HttpParser {
destroyParser();
}
- HttpParser() : parsed_(false), parser_(TSHttpParserCreate()), buffer_(TSMBufferCreate()), location_(TSHttpHdrCreate(buffer_))
+ HttpParser() : parser_(TSHttpParserCreate()), buffer_(TSMBufferCreate()), location_(TSHttpHdrCreate(buffer_))
{
TSHttpHdrTypeSet(buffer_, location_, TS_HTTP_TYPE_RESPONSE);
}
diff --git a/plugins/experimental/inliner/html-parser.h b/plugins/experimental/inliner/html-parser.h
index 38f4b84..c7be971 100644
--- a/plugins/experimental/inliner/html-parser.h
+++ b/plugins/experimental/inliner/html-parser.h
@@ -101,10 +101,10 @@ namespace inliner
};
struct AttributeParser {
- Attribute::ATTRIBUTES state_;
+ Attribute::ATTRIBUTES state_ = Attribute::kPreName;
Attributes attributes;
- AttributeParser() : state_(Attribute::kPreName) {}
+ AttributeParser() {}
void
reset()
{
@@ -129,11 +129,11 @@ namespace inliner
};
struct HtmlParser {
- State::STATES state_;
- Tag::TAGS tag_;
+ State::STATES state_ = State::kUndefined;
+ Tag::TAGS tag_ = Tag::kUndefined;
AttributeParser attributeParser_;
- HtmlParser() : state_(State::kUndefined), tag_(Tag::kUndefined) {}
+ HtmlParser() {}
virtual ~HtmlParser() {}
bool parseTag(const char);
size_t parse(const char *, size_t, size_t o = 0);
diff --git a/plugins/experimental/inliner/ts.h b/plugins/experimental/inliner/ts.h
index 69cf2aa..9ab8bdd 100644
--- a/plugins/experimental/inliner/ts.h
+++ b/plugins/experimental/inliner/ts.h
@@ -47,7 +47,7 @@ namespace io
struct IO {
TSIOBuffer buffer;
TSIOBufferReader reader;
- TSVIO vio;
+ TSVIO vio = nullptr;
~IO()
{
@@ -58,8 +58,8 @@ namespace io
TSIOBufferDestroy(buffer);
}
- IO() : buffer(TSIOBufferCreate()), reader(TSIOBufferReaderAlloc(buffer)), vio(nullptr) {}
- IO(const TSIOBuffer &b) : buffer(b), reader(TSIOBufferReaderAlloc(buffer)), vio(nullptr) { assert(buffer != nullptr); }
+ IO() : buffer(TSIOBufferCreate()), reader(TSIOBufferReaderAlloc(buffer)) {}
+ IO(const TSIOBuffer &b) : buffer(b), reader(TSIOBufferReaderAlloc(buffer)) { assert(buffer != nullptr); }
static IO *read(TSVConn, TSCont, const int64_t);
static IO *
@@ -114,7 +114,7 @@ namespace io
typedef std::weak_ptr<WriteOperation> WriteOperationWeakPointer;
struct Lock {
- const TSMutex mutex_;
+ const TSMutex mutex_ = nullptr;
~Lock()
{
@@ -131,7 +131,7 @@ namespace io
}
// noncopyable
- Lock() : mutex_(nullptr) {}
+ Lock() {}
Lock(const Lock &) = delete;
Lock(Lock &&l) : mutex_(l.mutex_) { const_cast<TSMutex &>(l.mutex_) = nullptr; }
diff --git a/plugins/experimental/magick/magick.cc b/plugins/experimental/magick/magick.cc
index abcadf8..550c818 100644
--- a/plugins/experimental/magick/magick.cc
+++ b/plugins/experimental/magick/magick.cc
@@ -267,7 +267,7 @@ struct Image {
struct Wand {
MagickWand *wand;
- void *blob;
+ void *blob = nullptr;
~Wand()
{
@@ -278,7 +278,7 @@ struct Wand {
}
}
- Wand() : wand(NewMagickWand()), blob(nullptr) { assert(nullptr != wand); }
+ Wand() : wand(NewMagickWand()) { assert(nullptr != wand); }
void
clear() const
@@ -512,7 +512,7 @@ struct ImageTransform : TransformationPlugin {
struct GlobalHookPlugin : GlobalPlugin {
magick::Core core_;
- magick::EVPKey *key_;
+ magick::EVPKey *key_ = nullptr;
ThreadPool threadPool_;
~GlobalHookPlugin() override
@@ -523,7 +523,7 @@ struct GlobalHookPlugin : GlobalPlugin {
}
}
- GlobalHookPlugin(const char *const f = nullptr) : key_(nullptr), threadPool_(2)
+ GlobalHookPlugin(const char *const f = nullptr) : threadPool_(2)
{
if (nullptr != f) {
assert(0 < strlen(f));
diff --git a/plugins/experimental/memcache/tsmemcache.h b/plugins/experimental/memcache/tsmemcache.h
index c43fc1f..fc6c811 100644
--- a/plugins/experimental/memcache/tsmemcache.h
+++ b/plugins/experimental/memcache/tsmemcache.h
@@ -83,15 +83,15 @@ struct MCAccept : public Continuation {
#ifndef HAVE_TLS
ProxyAllocator *theMCThreadAllocator;
#endif
- int accept_port;
+ int accept_port = 0;
int main_event(int event, void *netvc);
MCAccept()
:
#ifndef HAVE_TLS
- theMCThreadAllocator(NULL),
+ theMCThreadAllocator(NULL)
#endif
- accept_port(0)
+
{
SET_HANDLER(&MCAccept::main_event);
}
diff --git a/plugins/experimental/mp4/mp4_common.h b/plugins/experimental/mp4/mp4_common.h
index 126e444..780d238 100644
--- a/plugins/experimental/mp4/mp4_common.h
+++ b/plugins/experimental/mp4/mp4_common.h
@@ -32,7 +32,7 @@
class IOHandle
{
public:
- IOHandle() : vio(nullptr), buffer(nullptr), reader(nullptr){};
+ IOHandle(){};
~IOHandle()
{
@@ -48,9 +48,9 @@ public:
}
public:
- TSVIO vio;
- TSIOBuffer buffer;
- TSIOBufferReader reader;
+ TSVIO vio = nullptr;
+ TSIOBuffer buffer = nullptr;
+ TSIOBufferReader reader = nullptr;
};
class Mp4TransformContext
diff --git a/plugins/experimental/mp4/mp4_meta.h b/plugins/experimental/mp4/mp4_meta.h
index 1e8d1b1..8ee8f33 100644
--- a/plugins/experimental/mp4/mp4_meta.h
+++ b/plugins/experimental/mp4/mp4_meta.h
@@ -310,7 +310,7 @@ typedef struct {
class BufferHandle
{
public:
- BufferHandle() : buffer(nullptr), reader(nullptr){};
+ BufferHandle(){};
~BufferHandle()
{
@@ -326,64 +326,41 @@ public:
}
public:
- TSIOBuffer buffer;
- TSIOBufferReader reader;
+ TSIOBuffer buffer = nullptr;
+ TSIOBufferReader reader = nullptr;
};
class Mp4Trak
{
public:
- Mp4Trak()
- : timescale(0),
- duration(0),
- time_to_sample_entries(0),
- sample_to_chunk_entries(0),
- sync_samples_entries(0),
- composition_offset_entries(0),
- sample_sizes_entries(0),
- chunks(0),
- start_sample(0),
- start_chunk(0),
- chunk_samples(0),
- chunk_samples_size(0),
- start_offset(0),
- tkhd_size(0),
- mdhd_size(0),
- hdlr_size(0),
- vmhd_size(0),
- smhd_size(0),
- dinf_size(0),
- size(0)
- {
- memset(&stsc_chunk_entry, 0, sizeof(mp4_stsc_entry));
- }
+ Mp4Trak() { memset(&stsc_chunk_entry, 0, sizeof(mp4_stsc_entry)); }
~Mp4Trak() {}
public:
- uint32_t timescale;
- int64_t duration;
-
- uint32_t time_to_sample_entries; // stsc
- uint32_t sample_to_chunk_entries; // stsc
- uint32_t sync_samples_entries; // stss
- uint32_t composition_offset_entries; // ctts
- uint32_t sample_sizes_entries; // stsz
- uint32_t chunks; // stco, co64
-
- uint32_t start_sample;
- uint32_t start_chunk;
- uint32_t chunk_samples;
- uint64_t chunk_samples_size;
- off_t start_offset;
-
- size_t tkhd_size;
- size_t mdhd_size;
- size_t hdlr_size;
- size_t vmhd_size;
- size_t smhd_size;
- size_t dinf_size;
- size_t size;
+ uint32_t timescale = 0;
+ int64_t duration = 0;
+
+ uint32_t time_to_sample_entries = 0; // stsc
+ uint32_t sample_to_chunk_entries = 0; // stsc
+ uint32_t sync_samples_entries = 0; // stss
+ uint32_t composition_offset_entries = 0; // ctts
+ uint32_t sample_sizes_entries = 0; // stsz
+ uint32_t chunks = 0; // stco, co64
+
+ uint32_t start_sample = 0;
+ uint32_t start_chunk = 0;
+ uint32_t chunk_samples = 0;
+ uint64_t chunk_samples_size = 0;
+ off_t start_offset = 0;
+
+ size_t tkhd_size = 0;
+ size_t mdhd_size = 0;
+ size_t hdlr_size = 0;
+ size_t vmhd_size = 0;
+ size_t smhd_size = 0;
+ size_t dinf_size = 0;
+ size_t size = 0;
BufferHandle atoms[MP4_LAST_ATOM + 1];
@@ -394,22 +371,7 @@ class Mp4Meta
{
public:
Mp4Meta()
- : start(0),
- cl(0),
- content_length(0),
- meta_atom_size(0),
- meta_avail(0),
- wait_next(0),
- need_size(0),
- rs(0),
- rate(0),
- ftyp_size(0),
- moov_size(0),
- start_pos(0),
- timescale(0),
- trak_num(0),
- passed(0),
- meta_complete(false)
+
{
memset(trak_vec, 0, sizeof(trak_vec));
meta_buffer = TSIOBufferCreate();
@@ -494,17 +456,17 @@ public:
void mp4_update_mdhd_duration(Mp4Trak *trak);
public:
- int64_t start; // requested start time, measured in milliseconds.
- int64_t cl; // the total size of the mp4 file
- int64_t content_length; // the size of the new mp4 file
- int64_t meta_atom_size;
+ int64_t start = 0; // requested start time, measured in milliseconds.
+ int64_t cl = 0; // the total size of the mp4 file
+ int64_t content_length = 0; // the size of the new mp4 file
+ int64_t meta_atom_size = 0;
TSIOBuffer meta_buffer; // meta data to be parsed
TSIOBufferReader meta_reader;
- int64_t meta_avail;
- int64_t wait_next;
- int64_t need_size;
+ int64_t meta_avail = 0;
+ int64_t wait_next = 0;
+ int64_t need_size = 0;
BufferHandle meta_atom;
BufferHandle ftyp_atom;
@@ -516,16 +478,16 @@ public:
Mp4Trak *trak_vec[MP4_MAX_TRAK_NUM];
- double rs;
- double rate;
+ double rs = 0;
+ double rate = 0;
- int64_t ftyp_size;
- int64_t moov_size;
- int64_t start_pos; // start position of the new mp4 file
- uint32_t timescale;
- uint32_t trak_num;
- int64_t passed;
+ int64_t ftyp_size = 0;
+ int64_t moov_size = 0;
+ int64_t start_pos = 0; // start position of the new mp4 file
+ uint32_t timescale = 0;
+ uint32_t trak_num = 0;
+ int64_t passed = 0;
u_char mdat_atom_header[16];
- bool meta_complete;
+ bool meta_complete = false;
};
diff --git a/plugins/experimental/multiplexer/fetcher.h b/plugins/experimental/multiplexer/fetcher.h
index c5abe54..61bc595 100644
--- a/plugins/experimental/multiplexer/fetcher.h
+++ b/plugins/experimental/multiplexer/fetcher.h
@@ -42,7 +42,7 @@
namespace ats
{
struct HttpParser {
- bool parsed_;
+ bool parsed_ = false;
TSHttpParser parser_;
TSMBuffer buffer_;
TSMLoc location_;
@@ -56,7 +56,7 @@ struct HttpParser {
destroyParser();
}
- HttpParser() : parsed_(false), parser_(TSHttpParserCreate()), buffer_(TSMBufferCreate()), location_(TSHttpHdrCreate(buffer_))
+ HttpParser() : parser_(TSHttpParserCreate()), buffer_(TSMBufferCreate()), location_(TSHttpHdrCreate(buffer_))
{
TSHttpHdrTypeSet(buffer_, location_, TS_HTTP_TYPE_RESPONSE);
}
diff --git a/plugins/experimental/multiplexer/ts.h b/plugins/experimental/multiplexer/ts.h
index 327c6b5..5308652 100644
--- a/plugins/experimental/multiplexer/ts.h
+++ b/plugins/experimental/multiplexer/ts.h
@@ -38,7 +38,7 @@ namespace io
struct IO {
TSIOBuffer buffer;
TSIOBufferReader reader;
- TSVIO vio;
+ TSVIO vio = nullptr;
~IO()
{
@@ -52,8 +52,8 @@ namespace io
TSIOBufferDestroy(buffer);
}
- IO() : buffer(TSIOBufferCreate()), reader(TSIOBufferReaderAlloc(buffer)), vio(nullptr) {}
- IO(const TSIOBuffer &b) : buffer(b), reader(TSIOBufferReaderAlloc(buffer)), vio(nullptr) { assert(buffer != nullptr); }
+ IO() : buffer(TSIOBufferCreate()), reader(TSIOBufferReaderAlloc(buffer)) {}
+ IO(const TSIOBuffer &b) : buffer(b), reader(TSIOBufferReaderAlloc(buffer)) { assert(buffer != nullptr); }
static IO *read(TSVConn, TSCont, const int64_t);
static IO *
diff --git a/plugins/experimental/prefetch/configs.h b/plugins/experimental/prefetch/configs.h
index 2552c36..d1d61a8 100644
--- a/plugins/experimental/prefetch/configs.h
+++ b/plugins/experimental/prefetch/configs.h
@@ -39,11 +39,8 @@ public:
_nextHeader("X-AppleCDN-Prefetch-Next"),
_replaceHost(),
_namespace("default"),
- _metricsPrefix("prefetch.stats"),
- _fetchCount(1),
- _fetchMax(0),
- _front(false),
- _exactMatch(false)
+ _metricsPrefix("prefetch.stats")
+
{
}
@@ -194,9 +191,9 @@ private:
std::string _namespace;
std::string _metricsPrefix;
std::string _logName;
- unsigned _fetchCount;
- unsigned _fetchMax;
- bool _front;
- bool _exactMatch;
+ unsigned _fetchCount = 1;
+ unsigned _fetchMax = 0;
+ bool _front = false;
+ bool _exactMatch = false;
MultiPattern _nextPaths;
};
diff --git a/plugins/experimental/prefetch/fetch.cc b/plugins/experimental/prefetch/fetch.cc
index 49445c3..b34d062 100644
--- a/plugins/experimental/prefetch/fetch.cc
+++ b/plugins/experimental/prefetch/fetch.cc
@@ -114,7 +114,7 @@ createStat(const String &prefix, const String &space, const char *module, const
return true;
}
-BgFetchState::BgFetchState() : _policy(nullptr), _unique(nullptr), _concurrentFetches(0), _concurrentFetchesMax(0), _log(nullptr)
+BgFetchState::BgFetchState()
{
_policyLock = TSMutexCreate();
if (nullptr == _policyLock) {
diff --git a/plugins/experimental/prefetch/fetch.h b/plugins/experimental/prefetch/fetch.h
index 4d73a7b..206771b 100644
--- a/plugins/experimental/prefetch/fetch.h
+++ b/plugins/experimental/prefetch/fetch.h
@@ -89,14 +89,14 @@ private:
void operator=(BgFetchState const &); /* never implement */
/* Fetch policy related */
- FetchPolicy *_policy; /* fetch policy */
- TSMutex _policyLock; /* protects the policy object only */
+ FetchPolicy *_policy = nullptr; /* fetch policy */
+ TSMutex _policyLock; /* protects the policy object only */
/* Mechanisms to avoid concurrent fetches and applying limits */
- FetchPolicy *_unique; /* make sure we never download same object multiple times at the same time */
- TSMutex _lock; /* protects the deduplication object only */
- size_t _concurrentFetches;
- size_t _concurrentFetchesMax;
+ FetchPolicy *_unique = nullptr; /* make sure we never download same object multiple times at the same time */
+ TSMutex _lock; /* protects the deduplication object only */
+ size_t _concurrentFetches = 0;
+ size_t _concurrentFetchesMax = 0;
PrefetchMetricInfo _metrics[FETCHES_MAX_METRICS] = {
{FETCH_ACTIVE, TS_RECORDDATATYPE_INT, -1}, {FETCH_COMPLETED, TS_RECORDDATATYPE_COUNTER, -1},
{FETCH_ERRORS, TS_RECORDDATATYPE_COUNTER, -1}, {FETCH_TIMEOOUTS, TS_RECORDDATATYPE_COUNTER, -1},
@@ -108,7 +108,7 @@ private:
{FETCH_POLICY_MAXSIZE, TS_RECORDDATATYPE_INT, -1}};
/* plugin specific fetch logging */
- TSTextLogObject _log;
+ TSTextLogObject _log = nullptr;
};
/**
diff --git a/plugins/experimental/prefetch/fetch_policy_lru.h b/plugins/experimental/prefetch/fetch_policy_lru.h
index 3910234..8f14d88 100644
--- a/plugins/experimental/prefetch/fetch_policy_lru.h
+++ b/plugins/experimental/prefetch/fetch_policy_lru.h
@@ -86,7 +86,7 @@ class FetchPolicyLru : public FetchPolicy
{
public:
/* Default size values are also considered minimum. TODO: find out if this works OK. */
- FetchPolicyLru() : _maxSize(10), _size(0){};
+ FetchPolicyLru(){};
~FetchPolicyLru() override{};
/* Fetch policy interface methods */
@@ -100,6 +100,6 @@ public:
protected:
LruMap _map;
LruList _list;
- LruList::size_type _maxSize;
- LruList::size_type _size;
+ LruList::size_type _maxSize = 10;
+ LruList::size_type _size = 0;
};
diff --git a/plugins/experimental/prefetch/pattern.cc b/plugins/experimental/prefetch/pattern.cc
index 25541a3..3e408f7 100644
--- a/plugins/experimental/prefetch/pattern.cc
+++ b/plugins/experimental/prefetch/pattern.cc
@@ -38,7 +38,7 @@ replaceString(String &str, const String &from, const String &to)
}
}
-Pattern::Pattern() : _re(nullptr), _extra(nullptr), _pattern(""), _replacement(""), _tokenCount(0) {}
+Pattern::Pattern() : _pattern(""), _replacement("") {}
/**
* @brief Initializes PCRE pattern by providing the subject and replacement strings.
diff --git a/plugins/experimental/prefetch/pattern.h b/plugins/experimental/prefetch/pattern.h
index b9270c8..1045812 100644
--- a/plugins/experimental/prefetch/pattern.h
+++ b/plugins/experimental/prefetch/pattern.h
@@ -56,13 +56,13 @@ private:
bool failed(const String &subject) const;
void pcreFree();
- pcre *_re; /**< @brief PCRE compiled info structure, computed during initialization */
- pcre_extra *_extra; /**< @brief PCRE study data block, computed during initialization */
+ pcre *_re = nullptr; /**< @brief PCRE compiled info structure, computed during initialization */
+ pcre_extra *_extra = nullptr; /**< @brief PCRE study data block, computed during initialization */
String _pattern; /**< @brief PCRE pattern string, containing PCRE patterns and capturing groups. */
String _replacement; /**< @brief PCRE replacement string, containing $0..$9 to be replaced with content of the capturing groups */
- int _tokenCount; /**< @brief number of replacements $0..$9 found in the replacement string if not empty */
+ int _tokenCount = 0; /**< @brief number of replacements $0..$9 found in the replacement string if not empty */
int _tokens[TOKENCOUNT]; /**< @brief replacement index 0..9, since they can be used in the replacement string in any order */
int _tokenOffset[TOKENCOUNT]; /**< @brief replacement offset inside the replacement string */
};
diff --git a/plugins/experimental/prefetch/plugin.cc b/plugins/experimental/prefetch/plugin.cc
index f111220..fede772 100644
--- a/plugins/experimental/prefetch/plugin.cc
+++ b/plugins/experimental/prefetch/plugin.cc
@@ -121,7 +121,7 @@ TSRemapInit(TSRemapInterface *apiInfo, char *errBuf, int erroBufSize)
*/
struct PrefetchInstance {
- PrefetchInstance() : _state(nullptr){};
+ PrefetchInstance(){};
private:
PrefetchInstance(PrefetchInstance const &);
@@ -129,7 +129,7 @@ private:
public:
PrefetchConfig _config;
- BgFetchState *_state;
+ BgFetchState *_state = nullptr;
};
/**
diff --git a/plugins/experimental/slice/ContentRange.h b/plugins/experimental/slice/ContentRange.h
index 0ca0558..87de631 100644
--- a/plugins/experimental/slice/ContentRange.h
+++ b/plugins/experimental/slice/ContentRange.h
@@ -25,11 +25,11 @@
Range is converted from closed range into a half open range for.
*/
struct ContentRange {
- int64_t m_beg;
- int64_t m_end; // half open
- int64_t m_length; // full content length
+ int64_t m_beg = -1;
+ int64_t m_end = -1; // half open
+ int64_t m_length = -1; // full content length
- ContentRange() : m_beg(-1), m_end(-1), m_length(-1) {}
+ ContentRange() {}
explicit ContentRange(int64_t const begin, int64_t const end, int64_t const len) : m_beg(begin), m_end(end), m_length(len) {}
bool
isValid() const
diff --git a/plugins/experimental/slice/Range.h b/plugins/experimental/slice/Range.h
index 373304d..0fb3145 100644
--- a/plugins/experimental/slice/Range.h
+++ b/plugins/experimental/slice/Range.h
@@ -31,10 +31,10 @@ struct Range {
public:
static int64_t constexpr maxval = (std::numeric_limits<int64_t>::max() >> 2);
- int64_t m_beg;
- int64_t m_end; // half open
+ int64_t m_beg = -1;
+ int64_t m_end = -1; // half open
- Range() : m_beg(-1), m_end(-1) {}
+ Range() {}
explicit Range(int64_t const begin, int64_t const end) : m_beg(begin), m_end(end) {}
bool isValid() const;
diff --git a/plugins/experimental/ssl_session_reuse/src/publish.cc b/plugins/experimental/ssl_session_reuse/src/publish.cc
index a74664c..7942606 100644
--- a/plugins/experimental/ssl_session_reuse/src/publish.cc
+++ b/plugins/experimental/ssl_session_reuse/src/publish.cc
@@ -49,14 +49,14 @@ RedisPublisher::start_worker_thread(void *arg)
RedisPublisher::RedisPublisher(const std::string &conf)
: m_redisEndpointsStr(cDefaultRedisEndpoint),
- m_endpointIndex(0),
+
m_numWorkers(cPubNumWorkerThreads),
m_redisConnectTimeout(cDefaultRedisConnectTimeout),
m_redisConnectTries(cDefaultRedisConnectTries),
m_redisPublishTries(cDefaultRedisPublishTries),
m_redisRetryDelay(cDefaultRedisRetryDelay),
- m_maxQueuedMessages(cDefaultMaxQueuedMessages),
- err(false)
+ m_maxQueuedMessages(cDefaultMaxQueuedMessages)
+
{
if (Config::getSingleton().loadConfig(conf)) {
Config::getSingleton().getValue("pubconfig", "PubNumWorkers", m_numWorkers);
diff --git a/plugins/experimental/ssl_session_reuse/src/publisher.h b/plugins/experimental/ssl_session_reuse/src/publisher.h
index 2d1a1a1..82fec01 100644
--- a/plugins/experimental/ssl_session_reuse/src/publisher.h
+++ b/plugins/experimental/ssl_session_reuse/src/publisher.h
@@ -55,7 +55,7 @@ class RedisPublisher
std::vector<RedisEndpoint> m_redisEndpoints;
std::string m_redisEndpointsStr;
- int m_endpointIndex;
+ int m_endpointIndex = 0;
std::mutex m_endpointIndexMutex;
std::vector<simple_pool *> pools;
@@ -68,7 +68,7 @@ class RedisPublisher
unsigned int m_maxQueuedMessages;
unsigned int m_poolRedisConnectTimeout; // milliseconds
- bool err;
+ bool err = false;
void runWorker();
diff --git a/plugins/experimental/ssl_session_reuse/src/ssl_init.cc b/plugins/experimental/ssl_session_reuse/src/ssl_init.cc
index 0d87f5a..56496aa 100644
--- a/plugins/experimental/ssl_session_reuse/src/ssl_init.cc
+++ b/plugins/experimental/ssl_session_reuse/src/ssl_init.cc
@@ -83,7 +83,7 @@ init_ssl_params(const std::string &conf)
return 0;
}
-ssl_session_param::ssl_session_param() : pub(nullptr) {}
+ssl_session_param::ssl_session_param() {}
ssl_session_param::~ssl_session_param()
{
diff --git a/plugins/experimental/ssl_session_reuse/src/ssl_utils.h b/plugins/experimental/ssl_session_reuse/src/ssl_utils.h
index bbfbf0c..262728c 100644
--- a/plugins/experimental/ssl_session_reuse/src/ssl_utils.h
+++ b/plugins/experimental/ssl_session_reuse/src/ssl_utils.h
@@ -40,7 +40,7 @@ struct ssl_session_param {
int stek_master; // bool - Am I the STEK setter/rotator for POD?
ssl_ticket_key_t ticket_keys[2]; // current and past STEK
std::string redis_auth_key_file;
- RedisPublisher *pub;
+ RedisPublisher *pub = nullptr;
RedisSubscriber *sub;
ssl_session_param();
diff --git a/plugins/experimental/sslheaders/sslheaders.cc b/plugins/experimental/sslheaders/sslheaders.cc
index 657a9cd..3fce092 100644
--- a/plugins/experimental/sslheaders/sslheaders.cc
+++ b/plugins/experimental/sslheaders/sslheaders.cc
@@ -329,8 +329,7 @@ TSRemapDoRemap(void *instance, TSHttpTxn txn, TSRemapRequestInfo * /* rri */)
return TSREMAP_NO_REMAP;
}
-SslHdrInstance::SslHdrInstance()
- : expansions(), attach(SSL_HEADERS_ATTACH_SERVER), cont(TSContCreate(SslHdrExpandRequestHook, nullptr))
+SslHdrInstance::SslHdrInstance() : expansions(), cont(TSContCreate(SslHdrExpandRequestHook, nullptr))
{
TSContDataSet(cont, this);
}
diff --git a/plugins/experimental/sslheaders/sslheaders.h b/plugins/experimental/sslheaders/sslheaders.h
index ff72100..7ccb00f 100644
--- a/plugins/experimental/sslheaders/sslheaders.h
+++ b/plugins/experimental/sslheaders/sslheaders.h
@@ -62,10 +62,10 @@ enum ExpansionField {
};
struct SslHdrExpansion {
- SslHdrExpansion() : name(), scope(SSL_HEADERS_SCOPE_NONE), field(SSL_HEADERS_FIELD_NONE) {}
+ SslHdrExpansion() : name() {}
std::string name; // HTTP header name
- ExpansionScope scope;
- ExpansionField field;
+ ExpansionScope scope = SSL_HEADERS_SCOPE_NONE;
+ ExpansionField field = SSL_HEADERS_FIELD_NONE;
// noncopyable but moveable
SslHdrExpansion(const SslHdrExpansion &) = delete;
@@ -81,7 +81,7 @@ struct SslHdrInstance {
~SslHdrInstance();
expansion_list expansions;
- AttachOptions attach;
+ AttachOptions attach = SSL_HEADERS_ATTACH_SERVER;
TSCont cont;
void register_hooks();
diff --git a/plugins/experimental/stream_editor/stream_editor.cc b/plugins/experimental/stream_editor/stream_editor.cc
index ee07967..a19552e 100644
--- a/plugins/experimental/stream_editor/stream_editor.cc
+++ b/plugins/experimental/stream_editor/stream_editor.cc
@@ -551,17 +551,17 @@ using ruleset_t = std::vector<rule_t>;
using rule_p = ruleset_t::const_iterator;
typedef struct contdata_t {
- TSCont cont;
- TSIOBuffer out_buf;
- TSIOBufferReader out_rd;
- TSVIO out_vio;
+ TSCont cont = nullptr;
+ TSIOBuffer out_buf = nullptr;
+ TSIOBufferReader out_rd = nullptr;
+ TSVIO out_vio = nullptr;
ruleset_t rules;
std::string contbuf;
- size_t contbuf_sz;
- int64_t bytes_in;
- int64_t bytes_out;
+ size_t contbuf_sz = 0;
+ int64_t bytes_in = 0;
+ int64_t bytes_out = 0;
/* Use new/delete so destructor does cleanup for us */
- contdata_t() : cont(nullptr), out_buf(nullptr), out_rd(nullptr), out_vio(nullptr), contbuf_sz(0), bytes_in(0), bytes_out(0) {}
+ contdata_t() {}
~contdata_t()
{
if (out_rd) {
diff --git a/plugins/generator/generator.cc b/plugins/generator/generator.cc
index 8eee22f..4dc7f4d 100644
--- a/plugins/generator/generator.cc
+++ b/plugins/generator/generator.cc
@@ -109,11 +109,11 @@ lengthof(const char (&)[N])
// for each TSVConn; one to push data into the TSVConn and one to pull
// data out.
struct IOChannel {
- TSVIO vio;
+ TSVIO vio = nullptr;
TSIOBuffer iobuf;
TSIOBufferReader reader;
- IOChannel() : vio(nullptr), iobuf(TSIOBufferSizedCreate(TS_IOBUFFER_SIZE_INDEX_32K)), reader(TSIOBufferReaderAlloc(iobuf)) {}
+ IOChannel() : iobuf(TSIOBufferSizedCreate(TS_IOBUFFER_SIZE_INDEX_32K)), reader(TSIOBufferReaderAlloc(iobuf)) {}
~IOChannel()
{
if (this->reader) {
@@ -163,10 +163,10 @@ struct GeneratorHttpHeader {
};
struct GeneratorRequest {
- off_t nbytes; // Number of bytes to generate.
- unsigned flags;
- unsigned delay; // Milliseconds to delay before sending a response.
- unsigned maxage; // Max age for cache responses.
+ off_t nbytes = 0; // Number of bytes to generate.
+ unsigned flags = 0;
+ unsigned delay = 0; // Milliseconds to delay before sending a response.
+ unsigned maxage; // Max age for cache responses.
IOChannel readio;
IOChannel writeio;
GeneratorHttpHeader rqheader;
@@ -176,7 +176,7 @@ struct GeneratorRequest {
ISHEAD = 0x0002,
};
- GeneratorRequest() : nbytes(0), flags(0), delay(0), maxage(60 * 60 * 24) {}
+ GeneratorRequest() : maxage(60 * 60 * 24) {}
~GeneratorRequest() {}
};
diff --git a/plugins/regex_remap/regex_remap.cc b/plugins/regex_remap/regex_remap.cc
index 484a0d9..28b5223 100644
--- a/plugins/regex_remap/regex_remap.cc
+++ b/plugins/regex_remap/regex_remap.cc
@@ -75,21 +75,7 @@ enum ExtraSubstitutions {
// length calculations (we need all of them).
//
struct UrlComponents {
- UrlComponents()
- : scheme(nullptr),
- host(nullptr),
- path(nullptr),
- query(nullptr),
- matrix(nullptr),
- port(0),
- scheme_len(0),
- host_len(0),
- path_len(0),
- query_len(0),
- matrix_len(0),
- url_len(0)
- {
- }
+ UrlComponents() {}
void
populate(TSRemapRequestInfo *rri)
@@ -104,20 +90,20 @@ struct UrlComponents {
url_len = scheme_len + host_len + path_len + query_len + matrix_len + 32;
}
- const char *scheme;
- const char *host;
- const char *path;
- const char *query;
- const char *matrix;
- int port;
+ const char *scheme = nullptr;
+ const char *host = nullptr;
+ const char *path = nullptr;
+ const char *query = nullptr;
+ const char *matrix = nullptr;
+ int port = 0;
- int scheme_len;
- int host_len;
- int path_len;
- int query_len;
- int matrix_len;
+ int scheme_len = 0;
+ int host_len = 0;
+ int path_len = 0;
+ int query_len = 0;
+ int matrix_len = 0;
- int url_len; // Full length, of all components
+ int url_len = 0; // Full length, of all components
};
///////////////////////////////////////////////////////////////////////////////
@@ -643,29 +629,17 @@ RemapRegex::substitute(char dest[], const char *src, const int ovector[], const
// Hold one remap instance
struct RemapInstance {
- RemapInstance()
- : first(nullptr),
- last(nullptr),
- profile(false),
- method(false),
- query_string(true),
- matrix_params(false),
- host(false),
- hits(0),
- misses(0),
- filename("unknown")
- {
- }
-
- RemapRegex *first;
- RemapRegex *last;
- bool profile;
- bool method;
- bool query_string;
- bool matrix_params;
- bool host;
- int hits;
- int misses;
+ RemapInstance() : filename("unknown") {}
+
+ RemapRegex *first = nullptr;
+ RemapRegex *last = nullptr;
+ bool profile = false;
+ bool method = false;
+ bool query_string = true;
+ bool matrix_params = false;
+ bool host = false;
+ int hits = 0;
+ int misses = 0;
std::string filename;
};
diff --git a/plugins/s3_auth/aws_auth_v4_wrap.h b/plugins/s3_auth/aws_auth_v4_wrap.h
index a435147..61480a6 100644
--- a/plugins/s3_auth/aws_auth_v4_wrap.h
+++ b/plugins/s3_auth/aws_auth_v4_wrap.h
@@ -28,7 +28,7 @@
class HeaderIterator
{
public:
- HeaderIterator() : _bufp(nullptr), _hdrs(TS_NULL_MLOC), _field(TS_NULL_MLOC) {}
+ HeaderIterator() : _hdrs(TS_NULL_MLOC), _field(TS_NULL_MLOC) {}
HeaderIterator(TSMBuffer bufp, TSMLoc hdrs, TSMLoc field) : _bufp(bufp), _hdrs(hdrs), _field(field) {}
HeaderIterator(const HeaderIterator &it)
{
@@ -81,7 +81,7 @@ public:
{
return TSMimeHdrFieldValueStringGet(_bufp, _hdrs, _field, -1, len);
}
- TSMBuffer _bufp;
+ TSMBuffer _bufp = nullptr;
TSMLoc _hdrs;
TSMLoc _field;
};
diff --git a/proxy/CacheControl.h b/proxy/CacheControl.h
index 1900a95..3c088b6 100644
--- a/proxy/CacheControl.h
+++ b/proxy/CacheControl.h
@@ -72,11 +72,11 @@ public:
int revalidate_after;
int pin_in_cache_for;
int ttl_in_cache;
- bool never_cache;
- bool ignore_client_no_cache;
- bool ignore_server_no_cache;
- bool ignore_client_cc_max_age;
- int cache_responses_to_cookies; ///< Override for caching cookied responses.
+ bool never_cache = false;
+ bool ignore_client_no_cache = false;
+ bool ignore_server_no_cache = false;
+ bool ignore_client_cc_max_age = true;
+ int cache_responses_to_cookies = -1; ///< Override for caching cookied responses.
// Data for internal use only
//
@@ -86,29 +86,17 @@ public:
// be overriden by something that appeared
// earlier in the the config file
//
- int reval_line;
- int never_line;
- int pin_line;
- int ttl_line;
- int ignore_client_line;
- int ignore_server_line;
+ int reval_line = -1;
+ int never_line = -1;
+ int pin_line = -1;
+ int ttl_line = -1;
+ int ignore_client_line = -1;
+ int ignore_server_line = -1;
};
inline CacheControlResult::CacheControlResult()
- : revalidate_after(CC_UNSET_TIME),
- pin_in_cache_for(CC_UNSET_TIME),
- ttl_in_cache(CC_UNSET_TIME),
- never_cache(false),
- ignore_client_no_cache(false),
- ignore_server_no_cache(false),
- ignore_client_cc_max_age(true),
- cache_responses_to_cookies(-1), // do not change value
- reval_line(-1),
- never_line(-1),
- pin_line(-1),
- ttl_line(-1),
- ignore_client_line(-1),
- ignore_server_line(-1)
+ : revalidate_after(CC_UNSET_TIME), pin_in_cache_for(CC_UNSET_TIME), ttl_in_cache(CC_UNSET_TIME)
+
{
}
@@ -116,17 +104,15 @@ class CacheControlRecord : public ControlBase
{
public:
CacheControlRecord();
- CacheControlType directive;
- int time_arg;
- int cache_responses_to_cookies;
+ CacheControlType directive = CC_INVALID;
+ int time_arg = 0;
+ int cache_responses_to_cookies = -1;
Result Init(matcher_line *line_info);
inkcoreapi void UpdateMatch(CacheControlResult *result, RequestData *rdata);
void Print();
};
-inline CacheControlRecord::CacheControlRecord() : ControlBase(), directive(CC_INVALID), time_arg(0), cache_responses_to_cookies(-1)
-{
-}
+inline CacheControlRecord::CacheControlRecord() : ControlBase() {}
//
// API to outside world
diff --git a/proxy/ControlBase.h b/proxy/ControlBase.h
index 844276f..76ffb25 100644
--- a/proxy/ControlBase.h
+++ b/proxy/ControlBase.h
@@ -77,7 +77,7 @@ public:
bool CheckModifiers(HttpRequestData *request_data);
bool CheckForMatch(HttpRequestData *request_data, int last_number);
void Print();
- int line_num;
+ int line_num = 0;
Modifier *findModOfType(Modifier::Type t) const;
protected:
@@ -97,7 +97,7 @@ private:
void clear();
};
-inline ControlBase::ControlBase() : line_num(0) {}
+inline ControlBase::ControlBase() {}
inline bool
ControlBase::CheckForMatch(HttpRequestData *request_data, int last_number)
diff --git a/proxy/ControlMatcher.h b/proxy/ControlMatcher.h
index 3c7c725..50cb291 100644
--- a/proxy/ControlMatcher.h
+++ b/proxy/ControlMatcher.h
@@ -138,31 +138,23 @@ public:
inkcoreapi sockaddr const *get_client_ip() override;
HttpRequestData()
- : hdr(nullptr),
- hostname_str(nullptr),
- api_info(nullptr),
- xact_start(0),
- incoming_port(0),
- tag(nullptr),
- internal_txn(false),
- cache_info_lookup_url(nullptr),
- cache_info_parent_selection_url(nullptr)
+
{
ink_zero(src_ip);
ink_zero(dest_ip);
}
- HTTPHdr *hdr;
- char *hostname_str;
- HttpApiInfo *api_info;
- time_t xact_start;
+ HTTPHdr *hdr = nullptr;
+ char *hostname_str = nullptr;
+ HttpApiInfo *api_info = nullptr;
+ time_t xact_start = 0;
IpEndpoint src_ip;
IpEndpoint dest_ip;
- uint16_t incoming_port;
- char *tag;
- bool internal_txn;
- URL **cache_info_lookup_url;
- URL **cache_info_parent_selection_url;
+ uint16_t incoming_port = 0;
+ char *tag = nullptr;
+ bool internal_txn = false;
+ URL **cache_info_lookup_url = nullptr;
+ URL **cache_info_parent_selection_url = nullptr;
};
// Mixin class for shared info across all templates. This just wraps the
diff --git a/proxy/InkAPIInternal.h b/proxy/InkAPIInternal.h
index ccfd08b..ee516e2 100644
--- a/proxy/InkAPIInternal.h
+++ b/proxy/InkAPIInternal.h
@@ -189,12 +189,12 @@ public:
bool has_hooks_for(ID id) const;
private:
- bool hooks_p; ///< Flag for (not) empty container.
+ bool hooks_p = false; ///< Flag for (not) empty container.
/// The array of hooks lists.
APIHooks m_hooks[N];
};
-template <typename ID, int N> FeatureAPIHooks<ID, N>::FeatureAPIHooks() : hooks_p(false) {}
+template <typename ID, int N> FeatureAPIHooks<ID, N>::FeatureAPIHooks() {}
template <typename ID, int N> FeatureAPIHooks<ID, N>::~FeatureAPIHooks()
{
diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc
index e6b43e5..abecdc8 100644
--- a/proxy/Plugin.cc
+++ b/proxy/Plugin.cc
@@ -51,10 +51,7 @@ using init_func_t = void (*)(int, char **);
DLL<PluginRegInfo> plugin_reg_list;
PluginRegInfo *plugin_reg_current = nullptr;
-PluginRegInfo::PluginRegInfo()
- : plugin_registered(false), plugin_path(nullptr), plugin_name(nullptr), vendor_name(nullptr), support_email(nullptr), dlh(nullptr)
-{
-}
+PluginRegInfo::PluginRegInfo() {}
PluginRegInfo::~PluginRegInfo()
{
diff --git a/proxy/Plugin.h b/proxy/Plugin.h
index 349a148..09c3de6 100644
--- a/proxy/Plugin.h
+++ b/proxy/Plugin.h
@@ -29,14 +29,14 @@ struct PluginRegInfo {
PluginRegInfo();
~PluginRegInfo();
- bool plugin_registered;
- char *plugin_path;
+ bool plugin_registered = false;
+ char *plugin_path = nullptr;
- char *plugin_name;
- char *vendor_name;
- char *support_email;
+ char *plugin_name = nullptr;
+ char *vendor_name = nullptr;
+ char *support_email = nullptr;
- void *dlh;
+ void *dlh = nullptr;
LINK(PluginRegInfo, link);
};
diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc
index 3e488cc..b4a62e5 100644
--- a/proxy/PluginVC.cc
+++ b/proxy/PluginVC.cc
@@ -1281,11 +1281,11 @@ public:
int main_handler(int event, void *data);
private:
- unsigned i;
- unsigned completions_received;
+ unsigned i = 0;
+ unsigned completions_received = 0;
};
-PVCTestDriver::PVCTestDriver() : NetTestDriver(), i(0), completions_received(0) {}
+PVCTestDriver::PVCTestDriver() : NetTestDriver() {}
PVCTestDriver::~PVCTestDriver()
{
diff --git a/proxy/PluginVC.h b/proxy/PluginVC.h
index 1e879ef..d620549 100644
--- a/proxy/PluginVC.h
+++ b/proxy/PluginVC.h
@@ -44,10 +44,10 @@ class PluginVCCore;
struct PluginVCState {
PluginVCState();
VIO vio;
- bool shutdown;
+ bool shutdown = false;
};
-inline PluginVCState::PluginVCState() : vio(), shutdown(false) {}
+inline PluginVCState::PluginVCState() : vio() {}
enum PluginVC_t {
PLUGIN_VC_UNKNOWN,
@@ -247,37 +247,27 @@ private:
void init();
void destroy();
- Continuation *connect_to;
- bool connected;
+ Continuation *connect_to = nullptr;
+ bool connected = false;
- MIOBuffer *p_to_a_buffer;
- IOBufferReader *p_to_a_reader;
+ MIOBuffer *p_to_a_buffer = nullptr;
+ IOBufferReader *p_to_a_reader = nullptr;
- MIOBuffer *a_to_p_buffer;
- IOBufferReader *a_to_p_reader;
+ MIOBuffer *a_to_p_buffer = nullptr;
+ IOBufferReader *a_to_p_reader = nullptr;
IpEndpoint passive_addr_struct;
IpEndpoint active_addr_struct;
- void *passive_data;
- void *active_data;
+ void *passive_data = nullptr;
+ void *active_data = nullptr;
static int32_t nextid;
- unsigned id;
+ unsigned id = 0;
};
-inline PluginVCCore::PluginVCCore()
- : active_vc(this),
- passive_vc(this),
- connect_to(nullptr),
- connected(false),
- p_to_a_buffer(nullptr),
- p_to_a_reader(nullptr),
- a_to_p_buffer(nullptr),
- a_to_p_reader(nullptr),
- passive_data(nullptr),
- active_data(nullptr),
- id(0)
+inline PluginVCCore::PluginVCCore() : active_vc(this), passive_vc(this)
+
{
memset(&active_addr_struct, 0, sizeof active_addr_struct);
memset(&passive_addr_struct, 0, sizeof passive_addr_struct);
diff --git a/proxy/ProxyClientTransaction.cc b/proxy/ProxyClientTransaction.cc
index c00de07..71323a4 100644
--- a/proxy/ProxyClientTransaction.cc
+++ b/proxy/ProxyClientTransaction.cc
@@ -27,15 +27,7 @@
#define HttpTxnDebug(fmt, ...) SsnDebug(this, "http_txn", fmt, __VA_ARGS__)
-ProxyClientTransaction::ProxyClientTransaction()
- : VConnection(nullptr),
- parent(nullptr),
- current_reader(nullptr),
- sm_reader(nullptr),
- host_res_style(HOST_RES_NONE),
- restart_immediate(false)
-{
-}
+ProxyClientTransaction::ProxyClientTransaction() : VConnection(nullptr) {}
void
ProxyClientTransaction::new_transaction()
diff --git a/proxy/ProxyClientTransaction.h b/proxy/ProxyClientTransaction.h
index ce5d009..c4ebfe0 100644
--- a/proxy/ProxyClientTransaction.h
+++ b/proxy/ProxyClientTransaction.h
@@ -266,18 +266,18 @@ public:
virtual void decrement_client_transactions_stat() = 0;
protected:
- ProxyClientSession *parent;
- HttpSM *current_reader;
- IOBufferReader *sm_reader;
+ ProxyClientSession *parent = nullptr;
+ HttpSM *current_reader = nullptr;
+ IOBufferReader *sm_reader = nullptr;
/// DNS resolution preferences.
- HostResStyle host_res_style;
+ HostResStyle host_res_style = HOST_RES_NONE;
/// Local outbound address control.
in_port_t outbound_port{0};
IpAddr outbound_ip4;
IpAddr outbound_ip6;
- bool restart_immediate;
+ bool restart_immediate = false;
private:
};
diff --git a/proxy/StatPages.h b/proxy/StatPages.h
index 3d204f5..cbce9cb 100644
--- a/proxy/StatPages.h
+++ b/proxy/StatPages.h
@@ -64,13 +64,13 @@
typedef Action *(*StatPagesFunc)(Continuation *cont, HTTPHdr *header);
struct StatPageData {
- char *data;
- char *type;
- int length;
+ char *data = nullptr;
+ char *type = nullptr;
+ int length = 0;
- StatPageData() : data(nullptr), type(nullptr), length(0) {}
- StatPageData(char *adata) : data(adata), type(nullptr) { length = strlen(adata); }
- StatPageData(char *adata, int alength) : data(adata), type(nullptr), length(alength) {}
+ StatPageData() {}
+ StatPageData(char *adata) : data(adata) { length = strlen(adata); }
+ StatPageData(char *adata, int alength) : data(adata), length(alength) {}
};
struct StatPagesManager {
diff --git a/proxy/Transform.cc b/proxy/Transform.cc
index d15f18a..3049305 100644
--- a/proxy/Transform.cc
+++ b/proxy/Transform.cc
@@ -524,8 +524,7 @@ TransformVConnection::backlog(uint64_t limit)
/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/
-TransformControl::TransformControl()
- : Continuation(new_ProxyMutex()), m_hooks(), m_tvc(nullptr), m_read_buf(nullptr), m_write_buf(nullptr)
+TransformControl::TransformControl() : Continuation(new_ProxyMutex()), m_hooks()
{
SET_HANDLER(&TransformControl::handle_event);
diff --git a/proxy/Transform.h b/proxy/Transform.h
index 5d2e3ed..2030eb6 100644
--- a/proxy/Transform.h
+++ b/proxy/Transform.h
@@ -30,10 +30,10 @@
#define TRANSFORM_READ_READY (TRANSFORM_EVENTS_START + 0)
typedef struct _RangeRecord {
- _RangeRecord() : _start(-1), _end(-1), _done_byte(-1) {}
- int64_t _start;
- int64_t _end;
- int64_t _done_byte;
+ _RangeRecord() {}
+ int64_t _start = -1;
+ int64_t _end = -1;
+ int64_t _done_byte = -1;
} RangeRecord;
class TransformProcessor
diff --git a/proxy/TransformInternal.h b/proxy/TransformInternal.h
index 1fdbc70..02b862f 100644
--- a/proxy/TransformInternal.h
+++ b/proxy/TransformInternal.h
@@ -87,9 +87,9 @@ public:
public:
APIHooks m_hooks;
- VConnection *m_tvc;
- IOBufferReader *m_read_buf;
- MIOBuffer *m_write_buf;
+ VConnection *m_tvc = nullptr;
+ IOBufferReader *m_read_buf = nullptr;
+ MIOBuffer *m_write_buf = nullptr;
};
class NullTransform : public INKVConnInternal
diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc
index 50726d0..0bbde74 100644
--- a/proxy/hdrs/HTTP.cc
+++ b/proxy/hdrs/HTTP.cc
@@ -1873,19 +1873,8 @@ ClassAllocator<HTTPCacheAlt> httpCacheAltAllocator("httpCacheAltAllocator");
-------------------------------------------------------------------------*/
int constexpr HTTPCacheAlt::N_INTEGRAL_FRAG_OFFSETS;
-HTTPCacheAlt::HTTPCacheAlt()
- : m_magic(CACHE_ALT_MAGIC_ALIVE),
- m_writeable(1),
- m_unmarshal_len(-1),
- m_id(-1),
- m_rid(-1),
- m_request_hdr(),
- m_response_hdr(),
- m_request_sent_time(0),
- m_response_received_time(0),
- m_frag_offset_count(0),
- m_frag_offsets(nullptr),
- m_ext_buffer(nullptr)
+HTTPCacheAlt::HTTPCacheAlt() : m_request_hdr(), m_response_hdr()
+
{
memset(&m_object_key[0], 0, CRYPTO_HASH_SIZE);
m_object_size[0] = 0;
diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h
index a3adb75..94e1a10 100644
--- a/proxy/hdrs/HTTP.h
+++ b/proxy/hdrs/HTTP.h
@@ -1292,18 +1292,18 @@ struct HTTPCacheAlt {
void copy_frag_offsets_from(HTTPCacheAlt *src);
void destroy();
- uint32_t m_magic;
+ uint32_t m_magic = CACHE_ALT_MAGIC_ALIVE;
// Writeable is set to true is we reside
// in a buffer owned by this structure.
// INVARIANT: if own the buffer this HttpCacheAlt
// we also own the buffers for the request &
// response headers
- int32_t m_writeable;
- int32_t m_unmarshal_len;
+ int32_t m_writeable = 1;
+ int32_t m_unmarshal_len = -1;
- int32_t m_id;
- int32_t m_rid;
+ int32_t m_id = -1;
+ int32_t m_rid = -1;
int32_t m_object_key[sizeof(CryptoHash) / sizeof(int32_t)];
int32_t m_object_size[2];
@@ -1311,12 +1311,12 @@ struct HTTPCacheAlt {
HTTPHdr m_request_hdr;
HTTPHdr m_response_hdr;
- time_t m_request_sent_time;
- time_t m_response_received_time;
+ time_t m_request_sent_time = 0;
+ time_t m_response_received_time = 0;
/// # of fragment offsets in this alternate.
/// @note This is one less than the number of fragments.
- int m_frag_offset_count;
+ int m_frag_offset_count = 0;
/// Type of offset for a fragment.
typedef uint64_t FragOffset;
/// Table of fragment offsets.
@@ -1324,7 +1324,7 @@ struct HTTPCacheAlt {
/// first byte past the end of fragment 0 which is also the first
/// byte of fragment 1. For this reason there is no fragment offset
/// for the last fragment.
- FragOffset *m_frag_offsets;
+ FragOffset *m_frag_offsets = nullptr;
/// # of fragment offsets built in to object.
static int constexpr N_INTEGRAL_FRAG_OFFSETS = 4;
/// Integral fragment offset table.
@@ -1337,7 +1337,7 @@ struct HTTPCacheAlt {
// We don't want to use a ref count ptr (Ptr<>)
// since our ownership model requires explicit
// destroys and ref count pointers defeat this
- RefCountObj *m_ext_buffer;
+ RefCountObj *m_ext_buffer = nullptr;
};
class HTTPInfo
@@ -1345,9 +1345,9 @@ class HTTPInfo
public:
typedef HTTPCacheAlt::FragOffset FragOffset; ///< Import type.
- HTTPCacheAlt *m_alt;
+ HTTPCacheAlt *m_alt = nullptr;
- HTTPInfo() : m_alt(nullptr) {}
+ HTTPInfo() {}
~HTTPInfo() { clear(); }
void
clear()
diff --git a/proxy/hdrs/HdrHeap.h b/proxy/hdrs/HdrHeap.h
index 1435f4b..825d19c 100644
--- a/proxy/hdrs/HdrHeap.h
+++ b/proxy/hdrs/HdrHeap.h
@@ -341,10 +341,10 @@ HdrHeap::unmarshal_size() const
//
struct MarshalXlate {
- char const *start;
- char const *end;
- char const *offset;
- MarshalXlate() : start(nullptr), end(nullptr), offset(nullptr) {}
+ char const *start = nullptr;
+ char const *end = nullptr;
+ char const *offset = nullptr;
+ MarshalXlate() {}
};
struct HeapCheck {
@@ -458,7 +458,7 @@ struct HeapCheck {
//
struct HdrHeapSDKHandle {
public:
- HdrHeapSDKHandle() : m_heap(nullptr) {}
+ HdrHeapSDKHandle() {}
~HdrHeapSDKHandle() { clear(); }
// clear() only deallocates chained SDK return values
// The underlying MBuffer is left untouched
@@ -471,7 +471,7 @@ public:
void set(const HdrHeapSDKHandle *from);
const char *make_sdk_string(const char *raw_str, int raw_str_len);
- HdrHeap *m_heap;
+ HdrHeap *m_heap = nullptr;
// In order to prevent gratitous refcounting,
// automatic C++ copies are disabled!
diff --git a/proxy/hdrs/HdrTest.h b/proxy/hdrs/HdrTest.h
index 7f8dc83..f9b29d9 100644
--- a/proxy/hdrs/HdrTest.h
+++ b/proxy/hdrs/HdrTest.h
@@ -39,9 +39,9 @@
class HdrTest
{
public:
- RegressionTest *rtest;
+ RegressionTest *rtest = nullptr;
- HdrTest() : rtest(nullptr){};
+ HdrTest(){};
~HdrTest(){};
int go(RegressionTest *t, int atype);
diff --git a/proxy/hdrs/MIME.h b/proxy/hdrs/MIME.h
index 972af09..de5ea81 100644
--- a/proxy/hdrs/MIME.h
+++ b/proxy/hdrs/MIME.h
@@ -965,9 +965,9 @@ MIMEField::has_dups() const
***********************************************************************/
struct MIMEFieldIter {
- MIMEFieldIter() : m_slot(0), m_block(nullptr) {}
- uint32_t m_slot;
- MIMEFieldBlockImpl *m_block;
+ MIMEFieldIter() {}
+ uint32_t m_slot = 0;
+ MIMEFieldBlockImpl *m_block = nullptr;
};
/*-------------------------------------------------------------------------
diff --git a/proxy/hdrs/URL.h b/proxy/hdrs/URL.h
index a98d24c..0cecc70 100644
--- a/proxy/hdrs/URL.h
+++ b/proxy/hdrs/URL.h
@@ -223,7 +223,7 @@ url_canonicalize_port(int type, int port)
class URL : public HdrHeapSDKHandle
{
public:
- URLImpl *m_url_impl;
+ URLImpl *m_url_impl = nullptr;
URL();
~URL();
@@ -290,7 +290,7 @@ public:
/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/
-inline URL::URL() : m_url_impl(nullptr) {}
+inline URL::URL() {}
/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/
diff --git a/proxy/http/Http1ClientSession.cc b/proxy/http/Http1ClientSession.cc
index 9f1a002..10ac26c 100644
--- a/proxy/http/Http1ClientSession.cc
+++ b/proxy/http/Http1ClientSession.cc
@@ -62,24 +62,7 @@ ink_mutex debug_cs_list_mutex;
ClassAllocator<Http1ClientSession> http1ClientSessionAllocator("http1ClientSessionAllocator");
-Http1ClientSession::Http1ClientSession()
- : client_vc(nullptr),
- magic(HTTP_CS_MAGIC_DEAD),
- transact_count(0),
- tcp_init_cwnd_set(false),
- half_close(false),
- conn_decrease(false),
- read_buffer(nullptr),
- sm_reader(nullptr),
- read_state(HCS_INIT),
- ka_vio(nullptr),
- slave_ka_vio(nullptr),
- bound_ss(nullptr),
- released_transactions(0),
- f_outbound_transparent(false),
- f_transparent_passthrough(false)
-{
-}
+Http1ClientSession::Http1ClientSession() {}
void
Http1ClientSession::destroy()
diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h
index ce83466..74d7a99 100644
--- a/proxy/http/Http1ClientSession.h
+++ b/proxy/http/Http1ClientSession.h
@@ -184,33 +184,33 @@ private:
HCS_CLOSED,
};
- NetVConnection *client_vc;
- int magic;
- int transact_count;
- bool tcp_init_cwnd_set;
- bool half_close;
- bool conn_decrease;
+ NetVConnection *client_vc = nullptr;
+ int magic = HTTP_SS_MAGIC_DEAD;
+ int transact_count = 0;
+ bool tcp_init_cwnd_set = false;
+ bool half_close = false;
+ bool conn_decrease = false;
- MIOBuffer *read_buffer;
- IOBufferReader *sm_reader;
+ MIOBuffer *read_buffer = nullptr;
+ IOBufferReader *sm_reader = nullptr;
- C_Read_State read_state;
+ C_Read_State read_state = HCS_INIT;
- VIO *ka_vio;
- VIO *slave_ka_vio;
+ VIO *ka_vio = nullptr;
+ VIO *slave_ka_vio = nullptr;
- HttpServerSession *bound_ss;
+ HttpServerSession *bound_ss = nullptr;
- int released_transactions;
+ int released_transactions = 0;
public:
// Link<Http1ClientSession> debug_link;
LINK(Http1ClientSession, debug_link);
/// Set outbound connection to transparent.
- bool f_outbound_transparent;
+ bool f_outbound_transparent = false;
/// Transparently pass-through non-HTTP traffic.
- bool f_transparent_passthrough;
+ bool f_transparent_passthrough = false;
Http1ClientTransaction trans;
};
diff --git a/proxy/http/HttpCacheSM.cc b/proxy/http/HttpCacheSM.cc
index 52190bc..8a859f0 100644
--- a/proxy/http/HttpCacheSM.cc
+++ b/proxy/http/HttpCacheSM.cc
@@ -45,7 +45,7 @@
Debug("http_cache", "[%" PRId64 "] [%s, %s]", master_sm->sm_id, #state_name, HttpDebugNames::get_event_name(event)); \
}
-HttpCacheAction::HttpCacheAction() : sm(nullptr) {}
+HttpCacheAction::HttpCacheAction() {}
void
HttpCacheAction::cancel(Continuation *c)
@@ -61,25 +61,9 @@ HttpCacheAction::cancel(Continuation *c)
HttpCacheSM::HttpCacheSM()
: Continuation(nullptr),
- cache_read_vc(nullptr),
- cache_write_vc(nullptr),
- read_locked(false),
- write_locked(false),
- readwhilewrite_inprogress(false),
- master_sm(nullptr),
- pending_action(nullptr),
- captive_action(),
- open_read_cb(false),
- open_write_cb(false),
- open_read_tries(0),
- read_request_hdr(nullptr),
- http_params(nullptr),
- read_pin_in_cache(0),
- retry_write(true),
- open_write_tries(0),
- lookup_url(nullptr),
- lookup_max_recursive(0),
- current_lookup_level(0)
+
+ captive_action()
+
{
}
diff --git a/proxy/http/HttpCacheSM.h b/proxy/http/HttpCacheSM.h
index 435279f..89b8542 100644
--- a/proxy/http/HttpCacheSM.h
+++ b/proxy/http/HttpCacheSM.h
@@ -49,7 +49,7 @@ struct HttpCacheAction : public Action {
{
sm = sm_arg;
};
- HttpCacheSM *sm;
+ HttpCacheSM *sm = nullptr;
};
class HttpCacheSM : public Continuation
@@ -70,16 +70,16 @@ public:
Action *open_write(const HttpCacheKey *key, URL *url, HTTPHdr *request, CacheHTTPInfo *old_info, time_t pin_in_cache, bool retry,
bool allow_multiple);
- CacheVConnection *cache_read_vc;
- CacheVConnection *cache_write_vc;
+ CacheVConnection *cache_read_vc = nullptr;
+ CacheVConnection *cache_write_vc = nullptr;
- bool read_locked;
- bool write_locked;
+ bool read_locked = false;
+ bool write_locked = false;
// Flag to check whether read-while-write is in progress or not
- bool readwhilewrite_inprogress;
+ bool readwhilewrite_inprogress = false;
- HttpSM *master_sm;
- Action *pending_action;
+ HttpSM *master_sm = nullptr;
+ Action *pending_action = nullptr;
// Function to set readwhilewrite_inprogress flag
inline void
@@ -190,24 +190,24 @@ private:
int state_cache_open_write(int event, void *data);
HttpCacheAction captive_action;
- bool open_read_cb;
- bool open_write_cb;
+ bool open_read_cb = false;
+ bool open_write_cb = false;
// Open read parameters
- int open_read_tries;
- HTTPHdr *read_request_hdr;
- OverridableHttpConfigParams *http_params;
- time_t read_pin_in_cache;
+ int open_read_tries = 0;
+ HTTPHdr *read_request_hdr = nullptr;
+ OverridableHttpConfigParams *http_params = nullptr;
+ time_t read_pin_in_cache = 0;
// Open write parameters
- bool retry_write;
- int open_write_tries;
+ bool retry_write = true;
+ int open_write_tries = 0;
// Common parameters
- URL *lookup_url;
+ URL *lookup_url = nullptr;
HttpCacheKey cache_key;
// to keep track of multiple cache lookups
- int lookup_max_recursive;
- int current_lookup_level;
+ int lookup_max_recursive = 0;
+ int current_lookup_level = 0;
};
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index e7aae44..0bb0a35 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -358,11 +358,11 @@ extern RecRawStatBlock *http_rsb;
// (corresponds to a "*" in the config file)
/////////////////////////////////////////////////////////////
struct HttpConfigPortRange {
- int low;
- int high;
- HttpConfigPortRange *next;
+ int low = 0;
+ int high = 0;
+ HttpConfigPortRange *next = nullptr;
- HttpConfigPortRange() : low(0), high(0), next(nullptr) {}
+ HttpConfigPortRange() {}
~HttpConfigPortRange()
{
if (next)
@@ -436,176 +436,53 @@ static std::map<std::string, Action> action_map = {
// and State (txn) structure. It allows for certain configs
// to be overridable per transaction more easily.
struct OverridableHttpConfigParams {
- OverridableHttpConfigParams()
- : maintain_pristine_host_hdr(1),
- chunking_enabled(1),
- negative_caching_enabled(0),
- negative_revalidating_enabled(0),
- cache_when_to_revalidate(0),
- keep_alive_enabled_in(1),
- keep_alive_enabled_out(1),
- keep_alive_post_out(1),
- server_session_sharing_match(TS_SERVER_SESSION_SHARING_MATCH_BOTH),
- auth_server_session_private(1),
- fwd_proxy_auth_to_parent(0),
- uncacheable_requests_bypass_parent(1),
- attach_server_session_to_client(0),
- forward_connect_method(0),
- insert_age_in_response(1),
- anonymize_remove_from(0),
- anonymize_remove_referer(0),
- anonymize_remove_user_agent(0),
- anonymize_remove_cookie(0),
- anonymize_remove_client_ip(0),
- anonymize_insert_client_ip(1),
- proxy_response_server_enabled(1),
- proxy_response_hsts_include_subdomains(0),
- insert_squid_x_forwarded_for(1),
- insert_forwarded(HttpForwarded::OptionBitSet()),
- send_http11_requests(1),
- cache_http(1),
- cache_ignore_client_no_cache(1),
- cache_ignore_client_cc_max_age(0),
- cache_ims_on_client_no_cache(1),
- cache_ignore_server_no_cache(0),
- cache_responses_to_cookies(1),
- cache_ignore_auth(0),
- cache_urls_that_look_dynamic(1),
- cache_required_headers(2),
- cache_range_lookup(1),
- cache_range_write(0),
- allow_multi_range(0),
- cache_enable_default_vary_headers(0),
- ignore_accept_mismatch(0),
- ignore_accept_language_mismatch(0),
- ignore_accept_encoding_mismatch(0),
- ignore_accept_charset_mismatch(0),
- insert_request_via_string(1),
- insert_response_via_string(0),
- doc_in_cache_skip_dns(1),
- flow_control_enabled(0),
- normalize_ae(0),
- srv_enabled(0),
- parent_failures_update_hostdb(0),
- cache_open_write_fail_action(0),
- post_check_content_length_enabled(1),
- request_buffer_enabled(0),
- allow_half_open(1),
- ssl_client_verify_server(0),
- ssl_client_verify_server_policy(nullptr),
- ssl_client_verify_server_properties(nullptr),
- ssl_client_sni_policy(nullptr),
- redirect_use_orig_cache_key(0),
- number_of_redirections(0),
- proxy_response_hsts_max_age(-1),
- negative_caching_lifetime(1800),
- negative_revalidating_lifetime(1800),
- sock_recv_buffer_size_out(0),
- sock_send_buffer_size_out(0),
- sock_option_flag_out(0),
- sock_packet_mark_out(0),
- sock_packet_tos_out(0),
- server_tcp_init_cwnd(0),
- request_hdr_max_size(131072),
- response_hdr_max_size(131072),
- cache_heuristic_min_lifetime(3600),
- cache_heuristic_max_lifetime(86400),
- cache_guaranteed_min_lifetime(0),
- cache_guaranteed_max_lifetime(31536000),
- cache_max_stale_age(604800),
- keep_alive_no_activity_timeout_in(120),
- keep_alive_no_activity_timeout_out(120),
- transaction_no_activity_timeout_in(30),
- transaction_no_activity_timeout_out(30),
- transaction_active_timeout_out(0),
- transaction_active_timeout_in(900),
- websocket_active_timeout(3600),
- websocket_inactive_timeout(600),
- connect_attempts_max_retries(0),
- connect_attempts_max_retries_dead_server(3),
- connect_attempts_rr_retries(3),
- connect_attempts_timeout(30),
- post_connect_attempts_timeout(1800),
- parent_connect_attempts(4),
- parent_retry_time(300),
- parent_fail_threshold(10),
- per_parent_connect_attempts(2),
- parent_connect_timeout(30),
- down_server_timeout(300),
- client_abort_threshold(10),
- max_cache_open_read_retries(-1),
- cache_open_read_retry_time(10),
- cache_generation_number(-1),
- max_cache_open_write_retries(1),
- background_fill_active_timeout(60),
- http_chunking_size(4096),
- flow_high_water_mark(0),
- flow_low_water_mark(0),
- default_buffer_size_index(8),
- default_buffer_water_mark(32768),
- slow_log_threshold(0),
- body_factory_template_base(nullptr),
- body_factory_template_base_len(0),
- proxy_response_server_string(nullptr),
- proxy_response_server_string_len(0),
- global_user_agent_header(nullptr),
- global_user_agent_header_size(0),
- cache_heuristic_lm_factor(0.10),
- background_fill_threshold(0.5),
- ssl_client_cert_filename(nullptr),
- ssl_client_private_key_filename(nullptr),
- ssl_client_ca_cert_filename(nullptr),
- cache_vary_default_text(nullptr),
- cache_vary_default_images(nullptr),
- cache_vary_default_other(nullptr)
- {
- }
+ OverridableHttpConfigParams() : insert_forwarded(HttpForwarded::OptionBitSet()) {}
// A simple rules here:
// * Place all MgmtByte configs before all other configs
- MgmtByte maintain_pristine_host_hdr;
- MgmtByte chunking_enabled;
+ MgmtByte maintain_pristine_host_hdr = 1;
+ MgmtByte chunking_enabled = 1;
////////////////////////////////
// Negative Response Caching //
////////////////////////////////
- MgmtByte negative_caching_enabled;
- MgmtByte negative_revalidating_enabled;
+ MgmtByte negative_caching_enabled = 0;
+ MgmtByte negative_revalidating_enabled = 0;
- MgmtByte cache_when_to_revalidate;
+ MgmtByte cache_when_to_revalidate = 0;
- MgmtByte keep_alive_enabled_in;
- MgmtByte keep_alive_enabled_out;
- MgmtByte keep_alive_post_out; // share server sessions for post
+ MgmtByte keep_alive_enabled_in = 1;
+ MgmtByte keep_alive_enabled_out = 1;
+ MgmtByte keep_alive_post_out = 1; // share server sessions for post
- MgmtByte server_session_sharing_match;
+ MgmtByte server_session_sharing_match = TS_SERVER_SESSION_SHARING_MATCH_BOTH;
// MgmtByte share_server_sessions;
- MgmtByte auth_server_session_private;
- MgmtByte fwd_proxy_auth_to_parent;
- MgmtByte uncacheable_requests_bypass_parent;
- MgmtByte attach_server_session_to_client;
+ MgmtByte auth_server_session_private = 1;
+ MgmtByte fwd_proxy_auth_to_parent = 0;
+ MgmtByte uncacheable_requests_bypass_parent = 1;
+ MgmtByte attach_server_session_to_client = 0;
- MgmtByte forward_connect_method;
+ MgmtByte forward_connect_method = 0;
- MgmtByte insert_age_in_response;
+ MgmtByte insert_age_in_response = 1;
///////////////////////////////////////////////////////////////////
// Privacy: fields which are removed from the user agent request //
///////////////////////////////////////////////////////////////////
- MgmtByte anonymize_remove_from;
- MgmtByte anonymize_remove_referer;
- MgmtByte anonymize_remove_user_agent;
- MgmtByte anonymize_remove_cookie;
- MgmtByte anonymize_remove_client_ip;
- MgmtByte anonymize_insert_client_ip;
+ MgmtByte anonymize_remove_from = 0;
+ MgmtByte anonymize_remove_referer = 0;
+ MgmtByte anonymize_remove_user_agent = 0;
+ MgmtByte anonymize_remove_cookie = 0;
+ MgmtByte anonymize_remove_client_ip = 0;
+ MgmtByte anonymize_insert_client_ip = 1;
- MgmtByte proxy_response_server_enabled;
- MgmtByte proxy_response_hsts_include_subdomains;
+ MgmtByte proxy_response_server_enabled = 1;
+ MgmtByte proxy_response_hsts_include_subdomains = 0;
/////////////////////
// X-Forwarded-For //
/////////////////////
- MgmtByte insert_squid_x_forwarded_for;
+ MgmtByte insert_squid_x_forwarded_for = 1;
///////////////
// Forwarded //
@@ -615,197 +492,197 @@ struct OverridableHttpConfigParams {
//////////////////////
// Version Hell //
//////////////////////
- MgmtByte send_http11_requests;
+ MgmtByte send_http11_requests = 1;
///////////////////
// cache control //
///////////////////
- MgmtByte cache_http;
- MgmtByte cache_ignore_client_no_cache;
- MgmtByte cache_ignore_client_cc_max_age;
- MgmtByte cache_ims_on_client_no_cache;
- MgmtByte cache_ignore_server_no_cache;
- MgmtByte cache_responses_to_cookies;
- MgmtByte cache_ignore_auth;
- MgmtByte cache_urls_that_look_dynamic;
- MgmtByte cache_required_headers;
- MgmtByte cache_range_lookup;
- MgmtByte cache_range_write;
- MgmtByte allow_multi_range;
-
- MgmtByte cache_enable_default_vary_headers;
-
- MgmtByte ignore_accept_mismatch;
- MgmtByte ignore_accept_language_mismatch;
- MgmtByte ignore_accept_encoding_mismatch;
- MgmtByte ignore_accept_charset_mismatch;
-
- MgmtByte insert_request_via_string;
- MgmtByte insert_response_via_string;
+ MgmtByte cache_http = 1;
+ MgmtByte cache_ignore_client_no_cache = 1;
+ MgmtByte cache_ignore_client_cc_max_age = 0;
+ MgmtByte cache_ims_on_client_no_cache = 1;
+ MgmtByte cache_ignore_server_no_cache = 0;
+ MgmtByte cache_responses_to_cookies = 1;
+ MgmtByte cache_ignore_auth = 0;
+ MgmtByte cache_urls_that_look_dynamic = 1;
+ MgmtByte cache_required_headers = 2;
+ MgmtByte cache_range_lookup = 1;
+ MgmtByte cache_range_write = 0;
+ MgmtByte allow_multi_range = 0;
+
+ MgmtByte cache_enable_default_vary_headers = 0;
+
+ MgmtByte ignore_accept_mismatch = 0;
+ MgmtByte ignore_accept_language_mismatch = 0;
+ MgmtByte ignore_accept_encoding_mismatch = 0;
+ MgmtByte ignore_accept_charset_mismatch = 0;
+
+ MgmtByte insert_request_via_string = 1;
+ MgmtByte insert_response_via_string = 0;
//////////////////////
// DOC IN CACHE NO DNS//
//////////////////////
- MgmtByte doc_in_cache_skip_dns;
- MgmtByte flow_control_enabled;
+ MgmtByte doc_in_cache_skip_dns = 1;
+ MgmtByte flow_control_enabled = 0;
////////////////////////////////
// Optimize gzip alternates //
////////////////////////////////
- MgmtByte normalize_ae;
+ MgmtByte normalize_ae = 0;
//////////////////////////
// hostdb/dns variables //
//////////////////////////
- MgmtByte srv_enabled;
- MgmtByte parent_failures_update_hostdb;
+ MgmtByte srv_enabled = 0;
+ MgmtByte parent_failures_update_hostdb = 0;
- MgmtByte cache_open_write_fail_action;
+ MgmtByte cache_open_write_fail_action = 0;
////////////////////////
// Check Post request //
////////////////////////
- MgmtByte post_check_content_length_enabled;
+ MgmtByte post_check_content_length_enabled = 1;
////////////////////////////////////////////////
// Buffer post body before connecting servers //
////////////////////////////////////////////////
- MgmtByte request_buffer_enabled;
+ MgmtByte request_buffer_enabled = 0;
/////////////////////////////////////////////////
// Keep connection open after client sends FIN //
/////////////////////////////////////////////////
- MgmtByte allow_half_open;
+ MgmtByte allow_half_open = 1;
/////////////////////////////
// server verification mode//
/////////////////////////////
- MgmtByte ssl_client_verify_server;
- char *ssl_client_verify_server_policy;
- char *ssl_client_verify_server_properties;
- char *ssl_client_sni_policy;
+ MgmtByte ssl_client_verify_server = 0;
+ char *ssl_client_verify_server_policy = nullptr;
+ char *ssl_client_verify_server_properties = nullptr;
+ char *ssl_client_sni_policy = nullptr;
//////////////////
// Redirection //
//////////////////
- MgmtByte redirect_use_orig_cache_key;
- MgmtInt number_of_redirections;
+ MgmtByte redirect_use_orig_cache_key = 0;
+ MgmtInt number_of_redirections = 0;
- MgmtInt proxy_response_hsts_max_age;
+ MgmtInt proxy_response_hsts_max_age = -1;
////////////////////////////////
// Negative cache lifetimes //
////////////////////////////////
- MgmtInt negative_caching_lifetime;
- MgmtInt negative_revalidating_lifetime;
+ MgmtInt negative_caching_lifetime = 1800;
+ MgmtInt negative_revalidating_lifetime = 1800;
///////////////////////////////////////
// origin server connection settings //
///////////////////////////////////////
- MgmtInt sock_recv_buffer_size_out;
- MgmtInt sock_send_buffer_size_out;
- MgmtInt sock_option_flag_out;
- MgmtInt sock_packet_mark_out;
- MgmtInt sock_packet_tos_out;
+ MgmtInt sock_recv_buffer_size_out = 0;
+ MgmtInt sock_send_buffer_size_out = 0;
+ MgmtInt sock_option_flag_out = 0;
+ MgmtInt sock_packet_mark_out = 0;
+ MgmtInt sock_packet_tos_out = 0;
///////////////////////////////
// Initial congestion window //
///////////////////////////////
- MgmtInt server_tcp_init_cwnd;
+ MgmtInt server_tcp_init_cwnd = 0;
///////////////
// Hdr Limit //
///////////////
- MgmtInt request_hdr_max_size;
- MgmtInt response_hdr_max_size;
+ MgmtInt request_hdr_max_size = 131072;
+ MgmtInt response_hdr_max_size = 131072;
/////////////////////
// cache variables //
/////////////////////
- MgmtInt cache_heuristic_min_lifetime;
- MgmtInt cache_heuristic_max_lifetime;
- MgmtInt cache_guaranteed_min_lifetime;
- MgmtInt cache_guaranteed_max_lifetime;
- MgmtInt cache_max_stale_age;
+ MgmtInt cache_heuristic_min_lifetime = 3600;
+ MgmtInt cache_heuristic_max_lifetime = 86400;
+ MgmtInt cache_guaranteed_min_lifetime = 0;
+ MgmtInt cache_guaranteed_max_lifetime = 31536000;
+ MgmtInt cache_max_stale_age = 604800;
///////////////////////////////////////////////////
// connection variables. timeouts are in seconds //
///////////////////////////////////////////////////
- MgmtInt keep_alive_no_activity_timeout_in;
- MgmtInt keep_alive_no_activity_timeout_out;
- MgmtInt transaction_no_activity_timeout_in;
- MgmtInt transaction_no_activity_timeout_out;
- MgmtInt transaction_active_timeout_out;
- MgmtInt transaction_active_timeout_in;
- MgmtInt websocket_active_timeout;
- MgmtInt websocket_inactive_timeout;
+ MgmtInt keep_alive_no_activity_timeout_in = 120;
+ MgmtInt keep_alive_no_activity_timeout_out = 120;
+ MgmtInt transaction_no_activity_timeout_in = 30;
+ MgmtInt transaction_no_activity_timeout_out = 30;
+ MgmtInt transaction_active_timeout_out = 0;
+ MgmtInt transaction_active_timeout_in = 900;
+ MgmtInt websocket_active_timeout = 3600;
+ MgmtInt websocket_inactive_timeout = 600;
////////////////////////////////////
// origin server connect attempts //
////////////////////////////////////
- MgmtInt connect_attempts_max_retries;
- MgmtInt connect_attempts_max_retries_dead_server;
- MgmtInt connect_attempts_rr_retries;
- MgmtInt connect_attempts_timeout;
- MgmtInt post_connect_attempts_timeout;
+ MgmtInt connect_attempts_max_retries = 0;
+ MgmtInt connect_attempts_max_retries_dead_server = 3;
+ MgmtInt connect_attempts_rr_retries = 3;
+ MgmtInt connect_attempts_timeout = 30;
+ MgmtInt post_connect_attempts_timeout = 1800;
////////////////////////////////////
// parent proxy connect attempts //
///////////////////////////////////
- MgmtInt parent_connect_attempts;
- MgmtInt parent_retry_time;
- MgmtInt parent_fail_threshold;
- MgmtInt per_parent_connect_attempts;
- MgmtInt parent_connect_timeout;
+ MgmtInt parent_connect_attempts = 4;
+ MgmtInt parent_retry_time = 300;
+ MgmtInt parent_fail_threshold = 10;
+ MgmtInt per_parent_connect_attempts = 2;
+ MgmtInt parent_connect_timeout = 30;
- MgmtInt down_server_timeout;
- MgmtInt client_abort_threshold;
+ MgmtInt down_server_timeout = 300;
+ MgmtInt client_abort_threshold = 10;
// open read failure retries.
- MgmtInt max_cache_open_read_retries;
- MgmtInt cache_open_read_retry_time; // time is in mseconds
- MgmtInt cache_generation_number;
+ MgmtInt max_cache_open_read_retries = -1;
+ MgmtInt cache_open_read_retry_time = 10; // time is in mseconds
+ MgmtInt cache_generation_number = -1;
// open write failure retries.
- MgmtInt max_cache_open_write_retries;
+ MgmtInt max_cache_open_write_retries = 1;
- MgmtInt background_fill_active_timeout;
+ MgmtInt background_fill_active_timeout = 60;
- MgmtInt http_chunking_size; // Maximum chunk size for chunked output.
- MgmtInt flow_high_water_mark; ///< Flow control high water mark.
- MgmtInt flow_low_water_mark; ///< Flow control low water mark.
+ MgmtInt http_chunking_size = 4096; // Maximum chunk size for chunked output.
+ MgmtInt flow_high_water_mark = 0; ///< Flow control high water mark.
+ MgmtInt flow_low_water_mark = 0; ///< Flow control low water mark.
- MgmtInt default_buffer_size_index;
- MgmtInt default_buffer_water_mark;
- MgmtInt slow_log_threshold;
+ MgmtInt default_buffer_size_index = 8;
+ MgmtInt default_buffer_water_mark = 32768;
+ MgmtInt slow_log_threshold = 0;
OutboundConnTrack::TxnConfig outbound_conntrack;
///////////////////////////////////////////////////////////////////
// Server header //
///////////////////////////////////////////////////////////////////
- char *body_factory_template_base;
- size_t body_factory_template_base_len;
- char *proxy_response_server_string; // This does not get free'd by us!
- size_t proxy_response_server_string_len; // Updated when server_string is set.
+ char *body_factory_template_base = nullptr;
+ size_t body_factory_template_base_len = 0;
+ char *proxy_response_server_string = nullptr; // This does not get free'd by us!
+ size_t proxy_response_server_string_len = 0; // Updated when server_string is set.
///////////////////////////////////////////////////////////////////
// Global User Agent header //
///////////////////////////////////////////////////////////////////
- char *global_user_agent_header; // This does not get free'd by us!
- size_t global_user_agent_header_size; // Updated when user_agent is set.
+ char *global_user_agent_header = nullptr; // This does not get free'd by us!
+ size_t global_user_agent_header_size = 0; // Updated when user_agent is set.
- MgmtFloat cache_heuristic_lm_factor;
- MgmtFloat background_fill_threshold;
+ MgmtFloat cache_heuristic_lm_factor = 0.10;
+ MgmtFloat background_fill_threshold = 0.5;
// Various strings, good place for them here ...
- char *ssl_client_cert_filename;
- char *ssl_client_private_key_filename;
- char *ssl_client_ca_cert_filename;
+ char *ssl_client_cert_filename = nullptr;
+ char *ssl_client_private_key_filename = nullptr;
+ char *ssl_client_ca_cert_filename = nullptr;
- char *cache_vary_default_text;
- char *cache_vary_default_images;
- char *cache_vary_default_other;
+ char *cache_vary_default_text = nullptr;
+ char *cache_vary_default_images = nullptr;
+ char *cache_vary_default_other = nullptr;
};
/////////////////////////////////////////////////////////////
diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc
index 0953097..7863833 100644
--- a/proxy/http/HttpProxyServerMain.cc
+++ b/proxy/http/HttpProxyServerMain.cc
@@ -119,12 +119,12 @@ ssl_unregister_protocol(const char *protocol, Continuation *contp)
*/
struct HttpProxyAcceptor {
/// Accept continuation.
- Continuation *_accept;
+ Continuation *_accept = nullptr;
/// Options for @c NetProcessor.
NetProcessor::AcceptOptions _net_opt;
/// Default constructor.
- HttpProxyAcceptor() : _accept(nullptr) {}
+ HttpProxyAcceptor() {}
};
/** Global acceptors.
diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h
index 8ceb79e..76a0d13 100644
--- a/proxy/http/HttpSM.h
+++ b/proxy/http/HttpSM.h
@@ -126,10 +126,10 @@ HttpVCTable::is_table_clear() const
}
struct HttpTransformInfo {
- HttpVCTableEntry *entry;
- VConnection *vc;
+ HttpVCTableEntry *entry = nullptr;
+ VConnection *vc = nullptr;
- HttpTransformInfo() : entry(nullptr), vc(nullptr) {}
+ HttpTransformInfo() {}
};
enum {
diff --git a/proxy/http/HttpSessionAccept.h b/proxy/http/HttpSessionAccept.h
index 0f9978b..362dd8b 100644
--- a/proxy/http/HttpSessionAccept.h
+++ b/proxy/http/HttpSessionAccept.h
@@ -58,7 +58,7 @@ public:
HttpSessionAcceptOptions();
// Connection type (HttpProxyPort::TransportType)
- int transport_type;
+ int transport_type = 0;
/// Set the transport type.
self &setTransportType(int);
/// Local address to bind for outbound connections.
@@ -70,15 +70,15 @@ public:
/// Set the outbound IP address to @a ip.
self &setOutboundIp(IpEndpoint *ip);
/// Local port for outbound connection.
- uint16_t outbound_port;
+ uint16_t outbound_port = 0;
/// Set outbound port.
self &setOutboundPort(uint16_t);
/// Outbound transparent.
- bool f_outbound_transparent;
+ bool f_outbound_transparent = false;
/// Set outbound transparency.
self &setOutboundTransparent(bool);
/// Transparent pass-through.
- bool f_transparent_passthrough;
+ bool f_transparent_passthrough = false;
/// Set transparent passthrough.
self &setTransparentPassthrough(bool);
/// Host address resolution preference order.
@@ -92,7 +92,7 @@ public:
};
inline HttpSessionAcceptOptions::HttpSessionAcceptOptions()
- : transport_type(0), outbound_port(0), f_outbound_transparent(false), f_transparent_passthrough(false)
+
{
memcpy(host_res_preference, host_res_default_preference_order, sizeof(host_res_preference));
}
diff --git a/proxy/http/HttpSessionManager.h b/proxy/http/HttpSessionManager.h
index f83196a..4112e3b 100644
--- a/proxy/http/HttpSessionManager.h
+++ b/proxy/http/HttpSessionManager.h
@@ -101,7 +101,7 @@ public:
class HttpSessionManager
{
public:
- HttpSessionManager() : m_g_pool(nullptr) {}
+ HttpSessionManager() {}
~HttpSessionManager() {}
HSMresult_t acquire_session(Continuation *cont, sockaddr const *addr, const char *hostname, ProxyClientTransaction *ua_txn,
HttpSM *sm);
@@ -113,7 +113,7 @@ public:
private:
/// Global pool, used if not per thread pools.
/// @internal We delay creating this because the session manager is created during global statics init.
- ServerSessionPool *m_g_pool;
+ ServerSessionPool *m_g_pool = nullptr;
};
extern HttpSessionManager httpSessionManager;
diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc
index 51901b8..8e37e72 100644
--- a/proxy/http/HttpTunnel.cc
+++ b/proxy/http/HttpTunnel.cc
@@ -44,26 +44,7 @@ static const char *const CHUNK_HEADER_FMT = "%" PRIx64 "\r\n";
// a block in the input stream.
static int const CHUNK_IOBUFFER_SIZE_INDEX = MIN_IOBUFFER_SIZE;
-ChunkedHandler::ChunkedHandler()
- : action(ACTION_UNSET),
- chunked_reader(nullptr),
- dechunked_buffer(nullptr),
- dechunked_size(0),
- dechunked_reader(nullptr),
- chunked_buffer(nullptr),
- chunked_size(0),
- truncation(false),
- skip_bytes(0),
- state(CHUNK_READ_CHUNK),
- cur_chunk_size(0),
- bytes_left(0),
- last_server_event(VC_EVENT_NONE),
- running_sum(0),
- num_digits(0),
- max_chunk_size(DEFAULT_MAX_CHUNK_SIZE),
- max_chunk_header_len(0)
-{
-}
+ChunkedHandler::ChunkedHandler() : max_chunk_size(DEFAULT_MAX_CHUNK_SIZE) {}
void
ChunkedHandler::init(IOBufferReader *buffer_in, HttpTunnelProducer *p)
@@ -393,32 +374,7 @@ ChunkedHandler::generate_chunked_content()
return false;
}
-HttpTunnelProducer::HttpTunnelProducer()
- : consumer_list(),
- self_consumer(nullptr),
- vc(nullptr),
- vc_handler(nullptr),
- read_vio(nullptr),
- read_buffer(nullptr),
- buffer_start(nullptr),
- vc_type(HT_HTTP_SERVER),
- chunking_action(TCA_PASSTHRU_DECHUNKED_CONTENT),
- do_chunking(false),
- do_dechunking(false),
- do_chunked_passthru(false),
- init_bytes_done(0),
- nbytes(0),
- ntodo(0),
- bytes_read(0),
- handler_state(0),
- last_event(0),
- num_consumers(0),
- alive(false),
- read_success(false),
- flow_control_source(nullptr),
- name(nullptr)
-{
-}
+HttpTunnelProducer::HttpTunnelProducer() : consumer_list() {}
uint64_t
HttpTunnelProducer::backlog(uint64_t limit)
@@ -484,23 +440,7 @@ HttpTunnelProducer::set_throttle_src(HttpTunnelProducer *srcp)
}
}
-HttpTunnelConsumer::HttpTunnelConsumer()
- : link(),
- producer(nullptr),
- self_producer(nullptr),
- vc_type(HT_HTTP_CLIENT),
- vc(nullptr),
- buffer_reader(nullptr),
- vc_handler(nullptr),
- write_vio(nullptr),
- skip_bytes(0),
- bytes_written(0),
- handler_state(0),
- alive(false),
- write_success(false),
- name(nullptr)
-{
-}
+HttpTunnelConsumer::HttpTunnelConsumer() : link() {}
HttpTunnel::HttpTunnel() : Continuation(nullptr) {}
diff --git a/proxy/http/HttpTunnel.h b/proxy/http/HttpTunnel.h
index e47160d..9a91f50 100644
--- a/proxy/http/HttpTunnel.h
+++ b/proxy/http/HttpTunnel.h
@@ -94,27 +94,27 @@ struct ChunkedHandler {
enum Action { ACTION_DOCHUNK = 0, ACTION_DECHUNK, ACTION_PASSTHRU, ACTION_UNSET };
- Action action;
+ Action action = ACTION_UNSET;
- IOBufferReader *chunked_reader;
- MIOBuffer *dechunked_buffer;
- int64_t dechunked_size;
+ IOBufferReader *chunked_reader = nullptr;
+ MIOBuffer *dechunked_buffer = nullptr;
+ int64_t dechunked_size = 0;
- IOBufferReader *dechunked_reader;
- MIOBuffer *chunked_buffer;
- int64_t chunked_size;
+ IOBufferReader *dechunked_reader = nullptr;
+ MIOBuffer *chunked_buffer = nullptr;
+ int64_t chunked_size = 0;
- bool truncation;
- int64_t skip_bytes;
+ bool truncation = false;
+ int64_t skip_bytes = 0;
- ChunkedState state;
- int64_t cur_chunk_size;
- int64_t bytes_left;
- int last_server_event;
+ ChunkedState state = CHUNK_READ_CHUNK;
+ int64_t cur_chunk_size = 0;
+ int64_t bytes_left = 0;
+ int last_server_event = VC_EVENT_NONE;
// Parsing Info
- int running_sum;
- int num_digits;
+ int running_sum = 0;
+ int num_digits = 0;
/// @name Output data.
//@{
@@ -125,7 +125,7 @@ struct ChunkedHandler {
/// It holds the header for a maximal sized chunk which will cover
/// almost all output chunks.
char max_chunk_header[16];
- int max_chunk_header_len;
+ int max_chunk_header_len = 0;
//@}
ChunkedHandler();
@@ -152,22 +152,22 @@ struct HttpTunnelConsumer {
HttpTunnelConsumer();
LINK(HttpTunnelConsumer, link);
- HttpTunnelProducer *producer;
- HttpTunnelProducer *self_producer;
+ HttpTunnelProducer *producer = nullptr;
+ HttpTunnelProducer *self_producer = nullptr;
- HttpTunnelType_t vc_type;
- VConnection *vc;
- IOBufferReader *buffer_reader;
- HttpConsumerHandler vc_handler;
- VIO *write_vio;
+ HttpTunnelType_t vc_type = HT_HTTP_CLIENT;
+ VConnection *vc = nullptr;
+ IOBufferReader *buffer_reader = nullptr;
+ HttpConsumerHandler vc_handler = nullptr;
+ VIO *write_vio = nullptr;
- int64_t skip_bytes; // bytes to skip at beginning of stream
- int64_t bytes_written; // total bytes written to the vc
- int handler_state; // state used the handlers
+ int64_t skip_bytes = 0; // bytes to skip at beginning of stream
+ int64_t bytes_written = 0; // total bytes written to the vc
+ int handler_state = 0; // state used the handlers
- bool alive;
- bool write_success;
- const char *name;
+ bool alive = false;
+ bool write_success = false;
+ const char *name = nullptr;
/** Check if this consumer is downstream from @a vc.
@return @c true if any producer in the tunnel eventually feeds
@@ -184,37 +184,37 @@ struct HttpTunnelProducer {
HttpTunnelProducer();
DLL<HttpTunnelConsumer> consumer_list;
- HttpTunnelConsumer *self_consumer;
- VConnection *vc;
- HttpProducerHandler vc_handler;
- VIO *read_vio;
- MIOBuffer *read_buffer;
- IOBufferReader *buffer_start;
- HttpTunnelType_t vc_type;
+ HttpTunnelConsumer *self_consumer = nullptr;
+ VConnection *vc = nullptr;
+ HttpProducerHandler vc_handler = nullptr;
+ VIO *read_vio = nullptr;
+ MIOBuffer *read_buffer = nullptr;
+ IOBufferReader *buffer_start = nullptr;
+ HttpTunnelType_t vc_type = HT_HTTP_SERVER;
ChunkedHandler chunked_handler;
- TunnelChunkingAction_t chunking_action;
+ TunnelChunkingAction_t chunking_action = TCA_PASSTHRU_DECHUNKED_CONTENT;
- bool do_chunking;
- bool do_dechunking;
- bool do_chunked_passthru;
+ bool do_chunking = false;
+ bool do_dechunking = false;
+ bool do_chunked_passthru = false;
- int64_t init_bytes_done; // bytes passed in buffer
- int64_t nbytes; // total bytes (client's perspective)
- int64_t ntodo; // what this vc needs to do
- int64_t bytes_read; // total bytes read from the vc
- int handler_state; // state used the handlers
- int last_event; ///< Tracking for flow control restarts.
+ int64_t init_bytes_done = 0; // bytes passed in buffer
+ int64_t nbytes = 0; // total bytes (client's perspective)
+ int64_t ntodo = 0; // what this vc needs to do
+ int64_t bytes_read = 0; // total bytes read from the vc
+ int handler_state = 0; // state used the handlers
+ int last_event = 0; ///< Tracking for flow control restarts.
- int num_consumers;
+ int num_consumers = 0;
- bool alive;
- bool read_success;
+ bool alive = false;
+ bool read_success = false;
/// Flag and pointer for active flow control throttling.
/// If this is set, it points at the source producer that is under flow control.
/// If @c NULL then data flow is not being throttled.
- HttpTunnelProducer *flow_control_source;
- const char *name;
+ HttpTunnelProducer *flow_control_source = nullptr;
+ const char *name = nullptr;
/** Get the largest number of bytes any consumer has not consumed.
Use @a limit if you only need to check if the backlog is at least @a limit.
@@ -261,9 +261,9 @@ class HttpTunnel : public Continuation
// Default value for high and low water marks.
static uint64_t const DEFAULT_WATER_MARK = 1 << 16;
- uint64_t high_water; ///< Buffered data limit - throttle if more than this.
- uint64_t low_water; ///< Unthrottle if less than this buffered.
- bool enabled_p; ///< Flow control state (@c false means disabled).
+ uint64_t high_water; ///< Buffered data limit - throttle if more than this.
+ uint64_t low_water; ///< Unthrottle if less than this buffered.
+ bool enabled_p = false; ///< Flow control state (@c false means disabled).
/// Default constructor.
FlowControl();
@@ -575,4 +575,4 @@ HttpTunnelProducer::unthrottle()
}
}
-inline HttpTunnel::FlowControl::FlowControl() : high_water(DEFAULT_WATER_MARK), low_water(DEFAULT_WATER_MARK), enabled_p(false) {}
+inline HttpTunnel::FlowControl::FlowControl() : high_water(DEFAULT_WATER_MARK), low_water(DEFAULT_WATER_MARK) {}
diff --git a/proxy/http/HttpUpdateSM.cc b/proxy/http/HttpUpdateSM.cc
index efe7acb..fa89ac5 100644
--- a/proxy/http/HttpUpdateSM.cc
+++ b/proxy/http/HttpUpdateSM.cc
@@ -42,7 +42,7 @@ ClassAllocator<HttpUpdateSM> httpUpdateSMAllocator("httpUpdateSMAllocator");
Debug("http", "[%" PRId64 "] [%s, %s]", sm_id, #state_name, HttpDebugNames::get_event_name(event)); \
}
-HttpUpdateSM::HttpUpdateSM() : cb_occured(false), cb_cont(nullptr), cb_action(), cb_event(HTTP_SCH_UPDATE_EVENT_ERROR) {}
+HttpUpdateSM::HttpUpdateSM() : cb_action(), cb_event(HTTP_SCH_UPDATE_EVENT_ERROR) {}
void
HttpUpdateSM::destroy()
diff --git a/proxy/http/HttpUpdateSM.h b/proxy/http/HttpUpdateSM.h
index 6c29822..a552589 100644
--- a/proxy/http/HttpUpdateSM.h
+++ b/proxy/http/HttpUpdateSM.h
@@ -55,8 +55,8 @@ public:
Action *start_scheduled_update(Continuation *cont, HTTPHdr *req);
// private:
- bool cb_occured;
- Continuation *cb_cont;
+ bool cb_occured = false;
+ Continuation *cb_cont = nullptr;
Action cb_action;
int cb_event;
diff --git a/proxy/http/remap/AclFiltering.cc b/proxy/http/remap/AclFiltering.cc
index 16bfe59..6467369 100644
--- a/proxy/http/remap/AclFiltering.cc
+++ b/proxy/http/remap/AclFiltering.cc
@@ -51,8 +51,7 @@ acl_filter_rule::reset()
internal = 0;
}
-acl_filter_rule::acl_filter_rule()
- : next(nullptr), filter_name(nullptr), allow_flag(1), src_ip_valid(0), active_queue_flag(0), internal(0), argc(0)
+acl_filter_rule::acl_filter_rule() : allow_flag(1), src_ip_valid(0), active_queue_flag(0), internal(0)
{
standard_method_lookup.resize(HTTP_WKSIDX_METHODS_CNT);
ink_zero(argv);
diff --git a/proxy/http/remap/AclFiltering.h b/proxy/http/remap/AclFiltering.h
index b1ce7f8..ceba59a 100644
--- a/proxy/http/remap/AclFiltering.h
+++ b/proxy/http/remap/AclFiltering.h
@@ -67,16 +67,16 @@ private:
void reset();
public:
- acl_filter_rule *next;
- char *filter_name; // optional filter name
- unsigned int allow_flag : 1, // action allow deny
- src_ip_valid : 1, // src_ip range valid
+ acl_filter_rule *next = nullptr;
+ char *filter_name = nullptr; // optional filter name
+ unsigned int allow_flag : 1, // action allow deny
+ src_ip_valid : 1, // src_ip range valid
in_ip_valid : 1,
active_queue_flag : 1, // filter is in active state (used by .useflt directive)
internal : 1; // filter internal HTTP requests
// we need arguments as string array for directive processing
- int argc; // argument counter (only for filter defs)
+ int argc = 0; // argument counter (only for filter defs)
char *argv[ACL_FILTER_MAX_ARGV]; // argument strings (only for filter defs)
// methods
diff --git a/proxy/http/remap/RemapConfig.cc b/proxy/http/remap/RemapConfig.cc
index 36440e3..6b5a5e9 100644
--- a/proxy/http/remap/RemapConfig.cc
+++ b/proxy/http/remap/RemapConfig.cc
@@ -79,7 +79,7 @@ clear_xstr_array(char *v[], size_t vsize)
}
BUILD_TABLE_INFO::BUILD_TABLE_INFO()
- : remap_optflg(0), paramc(0), argc(0), ip_allow_check_enabled_p(true), accept_check_p(true), rules_list(nullptr), rewrite(nullptr)
+
{
memset(this->paramv, 0, sizeof(this->paramv));
memset(this->argv, 0, sizeof(this->argv));
diff --git a/proxy/http/remap/RemapConfig.h b/proxy/http/remap/RemapConfig.h
index e046640..8cac3d8 100644
--- a/proxy/http/remap/RemapConfig.h
+++ b/proxy/http/remap/RemapConfig.h
@@ -46,16 +46,16 @@ struct BUILD_TABLE_INFO {
BUILD_TABLE_INFO();
~BUILD_TABLE_INFO();
- unsigned long remap_optflg;
- int paramc;
- int argc;
+ unsigned long remap_optflg = 0;
+ int paramc = 0;
+ int argc = 0;
char *paramv[BUILD_TABLE_MAX_ARGS];
char *argv[BUILD_TABLE_MAX_ARGS];
- bool ip_allow_check_enabled_p;
- bool accept_check_p;
- acl_filter_rule *rules_list; // all rules defined in config files as .define_filter foobar @src_ip=.....
- UrlRewrite *rewrite; // Pointer to the UrlRewrite object we are parsing for.
+ bool ip_allow_check_enabled_p = true;
+ bool accept_check_p = true;
+ acl_filter_rule *rules_list = nullptr; // all rules defined in config files as .define_filter foobar @src_ip=.....
+ UrlRewrite *rewrite = nullptr; // Pointer to the UrlRewrite object we are parsing for.
// Clear the argument vector.
void reset();
diff --git a/proxy/http/remap/RemapProcessor.h b/proxy/http/remap/RemapProcessor.h
index f3665b8..d5e5ace 100644
--- a/proxy/http/remap/RemapProcessor.h
+++ b/proxy/http/remap/RemapProcessor.h
@@ -38,7 +38,7 @@
class RemapProcessor : public Processor
{
public:
- RemapProcessor() : ET_REMAP(0), _use_separate_remap_thread(false) {}
+ RemapProcessor() {}
~RemapProcessor() override {}
bool setup_for_remap(HttpTransact::State *s, UrlRewrite *table);
bool finish_remap(HttpTransact::State *s, UrlRewrite *table);
@@ -58,8 +58,8 @@ public:
}
private:
- EventType ET_REMAP;
- bool _use_separate_remap_thread;
+ EventType ET_REMAP = 0;
+ bool _use_separate_remap_thread = false;
};
/**
diff --git a/proxy/http/remap/UrlMapping.h b/proxy/http/remap/UrlMapping.h
index 96d2109..1b55e52 100644
--- a/proxy/http/remap/UrlMapping.h
+++ b/proxy/http/remap/UrlMapping.h
@@ -55,7 +55,7 @@ public:
class redirect_tag_str
{
public:
- redirect_tag_str() : next(nullptr), chunk_str(nullptr), type(0) {}
+ redirect_tag_str() {}
~redirect_tag_str()
{
type = 0;
@@ -65,9 +65,9 @@ public:
}
}
- redirect_tag_str *next;
- char *chunk_str;
- char type; /* s - string, r - referer, t - url_to, f - url_from, o - origin url */
+ redirect_tag_str *next = nullptr;
+ char *chunk_str = nullptr;
+ char type = 0; /* s - string, r - referer, t - url_to, f - url_from, o - origin url */
static redirect_tag_str *parse_format_redirect_url(char *url);
};
@@ -134,8 +134,8 @@ private:
class UrlMappingContainer
{
public:
- UrlMappingContainer() : _mapping(nullptr), _toURLPtr(nullptr), _heap(nullptr) {}
- explicit UrlMappingContainer(HdrHeap *heap) : _mapping(nullptr), _toURLPtr(nullptr), _heap(heap) {}
+ UrlMappingContainer() {}
+ explicit UrlMappingContainer(HdrHeap *heap) : _heap(heap) {}
~UrlMappingContainer() { deleteToURL(); }
URL *
getToURL() const
@@ -200,8 +200,8 @@ public:
UrlMappingContainer &operator=(const UrlMappingContainer &rhs) = delete;
private:
- url_mapping *_mapping;
- URL *_toURLPtr;
+ url_mapping *_mapping = nullptr;
+ URL *_toURLPtr = nullptr;
URL _toURL;
- HdrHeap *_heap;
+ HdrHeap *_heap = nullptr;
};
diff --git a/proxy/http2/HPACK.h b/proxy/http2/HPACK.h
index 9d0f9f5..9f93d4e 100644
--- a/proxy/http2/HPACK.h
+++ b/proxy/http2/HPACK.h
@@ -55,10 +55,10 @@ enum class HpackMatch {
// Result of looking for a header field in IndexingTable
struct HpackLookupResult {
- HpackLookupResult() : index(0), index_type(HpackIndex::NONE), match_type(HpackMatch::NONE) {}
- int index;
- HpackIndex index_type;
- HpackMatch match_type;
+ HpackLookupResult() {}
+ int index = 0;
+ HpackIndex index_type = HpackIndex::NONE;
+ HpackMatch match_type = HpackMatch::NONE;
};
class MIMEFieldWrapper
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index 9289b40..e705d74 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -259,28 +259,25 @@ struct Http2SettingsParameter {
// [RFC 7540] 6.3 PRIORITY Format
struct Http2Priority {
- Http2Priority()
- : exclusive_flag(false), weight(HTTP2_PRIORITY_DEFAULT_WEIGHT), stream_dependency(HTTP2_PRIORITY_DEFAULT_STREAM_DEPENDENCY)
- {
- }
+ Http2Priority() : weight(HTTP2_PRIORITY_DEFAULT_WEIGHT), stream_dependency(HTTP2_PRIORITY_DEFAULT_STREAM_DEPENDENCY) {}
- bool exclusive_flag;
+ bool exclusive_flag = false;
uint8_t weight;
uint32_t stream_dependency;
};
// [RFC 7540] 6.2 HEADERS Format
struct Http2HeadersParameter {
- Http2HeadersParameter() : pad_length(0) {}
- uint8_t pad_length;
+ Http2HeadersParameter() {}
+ uint8_t pad_length = 0;
Http2Priority priority;
};
// [RFC 7540] 6.8 GOAWAY Format
struct Http2Goaway {
- Http2Goaway() : last_streamid(0), error_code(Http2ErrorCode::HTTP2_ERROR_NO_ERROR) {}
- Http2StreamId last_streamid;
- Http2ErrorCode error_code;
+ Http2Goaway() {}
+ Http2StreamId last_streamid = 0;
+ Http2ErrorCode error_code = Http2ErrorCode::HTTP2_ERROR_NO_ERROR;
// NOTE: we don't (de)serialize the variable length debug data at this layer
// because there's
@@ -296,9 +293,9 @@ struct Http2RstStream {
// [RFC 7540] 6.6 PUSH_PROMISE Format
struct Http2PushPromise {
- Http2PushPromise() : pad_length(0), promised_streamid(0) {}
- uint8_t pad_length;
- Http2StreamId promised_streamid;
+ Http2PushPromise() {}
+ uint8_t pad_length = 0;
+ Http2StreamId promised_streamid = 0;
};
static inline bool
diff --git a/proxy/http2/Http2ClientSession.h b/proxy/http2/Http2ClientSession.h
index 5f22c7b..23b0f53 100644
--- a/proxy/http2/Http2ClientSession.h
+++ b/proxy/http2/Http2ClientSession.h
@@ -53,7 +53,7 @@ size_t const HTTP2_HEADER_BUFFER_SIZE_INDEX = CLIENT_CONNECTION_FIRST_READ_BUFFE
// To support Upgrade: h2c
struct Http2UpgradeContext {
- Http2UpgradeContext() : req_header(nullptr) {}
+ Http2UpgradeContext() {}
~Http2UpgradeContext()
{
if (req_header) {
@@ -63,7 +63,7 @@ struct Http2UpgradeContext {
}
// Modified request header
- HTTPHdr *req_header;
+ HTTPHdr *req_header = nullptr;
// Decoded HTTP2-Settings Header Field
Http2ConnectionSettings client_settings;
diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc
index 4437266..e952605 100644
--- a/proxy/logging/LogConfig.cc
+++ b/proxy/logging/LogConfig.cc
@@ -284,18 +284,8 @@ LogConfig::read_configuration_variables()
-------------------------------------------------------------------------*/
// TODO: Is UINT_MAX here really correct?
-LogConfig::LogConfig()
- : initialized(false),
- reconfiguration_needed(false),
- logging_space_exhausted(false),
- m_space_used(0),
- m_partition_space_left((int64_t)UINT_MAX),
- m_log_collation_accept(nullptr),
- m_disk_full(false),
- m_disk_low(false),
- m_partition_full(false),
- m_partition_low(false),
- m_log_directory_inaccessible(false)
+LogConfig::LogConfig() : m_partition_space_left((int64_t)UINT_MAX)
+
{
// Setup the default values for all LogConfig public variables so that
// a LogConfig object is valid upon return from the constructor even
diff --git a/proxy/logging/LogConfig.h b/proxy/logging/LogConfig.h
index fc41390..fdf3def 100644
--- a/proxy/logging/LogConfig.h
+++ b/proxy/logging/LogConfig.h
@@ -232,10 +232,10 @@ public:
}
public:
- bool initialized;
- bool reconfiguration_needed;
- bool logging_space_exhausted;
- int64_t m_space_used;
+ bool initialized = false;
+ bool reconfiguration_needed = false;
+ bool logging_space_exhausted = false;
+ int64_t m_space_used = 0;
int64_t m_partition_space_left;
bool roll_log_files_now; // signal that files must be rolled
@@ -289,13 +289,13 @@ private:
//
bool use_orphan_log_space_value;
- LogCollationAccept *m_log_collation_accept;
+ LogCollationAccept *m_log_collation_accept = nullptr;
- bool m_disk_full;
- bool m_disk_low;
- bool m_partition_full;
- bool m_partition_low;
- bool m_log_directory_inaccessible;
+ bool m_disk_full = false;
+ bool m_disk_low = false;
+ bool m_partition_full = false;
+ bool m_partition_low = false;
+ bool m_log_directory_inaccessible = false;
// noncopyable
// -- member functions not allowed --
diff --git a/proxy/logging/LogField.cc b/proxy/logging/LogField.cc
index 0b1ce14..563638d 100644
--- a/proxy/logging/LogField.cc
+++ b/proxy/logging/LogField.cc
@@ -701,7 +701,7 @@ LogField::fieldlist_contains_aggregates(const char *fieldlist)
heap with "new" and that each element is on at most ONE list. To enforce
this, items are copied by default, using the copy ctor.
-------------------------------------------------------------------------*/
-LogFieldList::LogFieldList() : m_marshal_len(0) {}
+LogFieldList::LogFieldList() {}
LogFieldList::~LogFieldList()
{
diff --git a/proxy/logging/LogField.h b/proxy/logging/LogField.h
index 6ca2a64..94823e4 100644
--- a/proxy/logging/LogField.h
+++ b/proxy/logging/LogField.h
@@ -264,7 +264,7 @@ public:
LogFieldList &operator=(const LogFieldList &rhs) = delete;
private:
- unsigned m_marshal_len;
+ unsigned m_marshal_len = 0;
Queue<LogField> m_field_list;
std::string _badSymbols;
};
diff --git a/proxy/logging/LogFieldAliasMap.h b/proxy/logging/LogFieldAliasMap.h
index 9f69cc3..673cdf7 100644
--- a/proxy/logging/LogFieldAliasMap.h
+++ b/proxy/logging/LogFieldAliasMap.h
@@ -103,11 +103,11 @@ table->init(3, 1, "one", 2, "two", 7, "seven")
*****************************************************************************/
struct LogFieldAliasTableEntry {
- bool valid; // entry in table is valid
- char *name; // the string equivalent
- size_t length; // the length of the string
+ bool valid = false; // entry in table is valid
+ char *name = nullptr; // the string equivalent
+ size_t length = 0; // the length of the string
- LogFieldAliasTableEntry() : valid(false), name(nullptr), length(0) {}
+ LogFieldAliasTableEntry() {}
~LogFieldAliasTableEntry()
{
if (name) {
@@ -119,13 +119,13 @@ struct LogFieldAliasTableEntry {
class LogFieldAliasTable : public LogFieldAliasMap
{
private:
- IntType m_min; // minimum numeric value
- IntType m_max; // maximum numeric value
- IntType m_entries; // number of entries in table
- LogFieldAliasTableEntry *m_table; // array of table entries
+ IntType m_min = 0; // minimum numeric value
+ IntType m_max = 0; // maximum numeric value
+ IntType m_entries = 0; // number of entries in table
+ LogFieldAliasTableEntry *m_table = nullptr; // array of table entries
public:
- LogFieldAliasTable() : m_min(0), m_max(0), m_entries(0), m_table(nullptr) {}
+ LogFieldAliasTable() {}
~LogFieldAliasTable() override { delete[] m_table; }
void init(size_t numPairs, ...);
diff --git a/proxy/logging/LogFilter.cc b/proxy/logging/LogFilter.cc
index e863194..900268f 100644
--- a/proxy/logging/LogFilter.cc
+++ b/proxy/logging/LogFilter.cc
@@ -927,7 +927,7 @@ filters_are_equal(LogFilter *filt1, LogFilter *filt2)
add() function is overloaded for each sub-type of LogFilter.
-------------------------------------------------------------------------*/
-LogFilterList::LogFilterList() : m_does_conjunction(true) {}
+LogFilterList::LogFilterList() {}
/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/
diff --git a/proxy/logging/LogFilter.h b/proxy/logging/LogFilter.h
index 7d9d6a1..94d5ff7 100644
--- a/proxy/logging/LogFilter.h
+++ b/proxy/logging/LogFilter.h
@@ -301,7 +301,7 @@ public:
private:
Queue<LogFilter> m_filter_list;
- bool m_does_conjunction;
+ bool m_does_conjunction = true;
// If m_does_conjunction = true
// toss_this_entry returns true
// if ANY filter tosses entry away.
diff --git a/proxy/logging/LogObject.h b/proxy/logging/LogObject.h
index 9c59b84..761530c 100644
--- a/proxy/logging/LogObject.h
+++ b/proxy/logging/LogObject.h
@@ -66,10 +66,10 @@ class LogBufferManager
{
private:
ASLL(LogBuffer, write_link) write_list;
- int _num_flush_buffers;
+ int _num_flush_buffers = 0;
public:
- LogBufferManager() : _num_flush_buffers(0) {}
+ LogBufferManager() {}
inline void
add_to_flush_queue(LogBuffer *buffer)
{
diff --git a/proxy/logging/LogSock.cc b/proxy/logging/LogSock.cc
index 4a37d0c..7746b96 100644
--- a/proxy/logging/LogSock.cc
+++ b/proxy/logging/LogSock.cc
@@ -38,7 +38,7 @@ static const int LS_PROTOCOL = 0;
first entry of the table (index 0) to be the port on which new
connections are accepted.
*/
-LogSock::LogSock(int max_connects) : ct((ConnectTable *)nullptr), m_accept_connections(false), m_max_connections(max_connects + 1)
+LogSock::LogSock(int max_connects) : ct((ConnectTable *)nullptr), m_max_connections(max_connects + 1)
{
ink_assert(m_max_connections > 0);
diff --git a/proxy/logging/LogSock.h b/proxy/logging/LogSock.h
index eda5d1a..d1ad1e9 100644
--- a/proxy/logging/LogSock.h
+++ b/proxy/logging/LogSock.h
@@ -123,6 +123,6 @@ private:
ConnectTable *ct; // list of all connections; index 0 is
// the accept port.
- bool m_accept_connections; // do we accept new connections?
- int m_max_connections; // max size of all tables
+ bool m_accept_connections = false; // do we accept new connections?
+ int m_max_connections; // max size of all tables
};
diff --git a/src/traffic_logstats/logstats.cc b/src/traffic_logstats/logstats.cc
index 52a5390..2cb7223 100644
--- a/src/traffic_logstats/logstats.cc
+++ b/src/traffic_logstats/logstats.cc
@@ -599,39 +599,25 @@ struct CommandLineArgs {
char log_file[1024];
char origin_file[1024];
char origin_list[MAX_ORIG_STRING];
- int max_origins;
+ int max_origins = 0;
char state_tag[1024];
- int64_t min_hits;
- int max_age;
+ int64_t min_hits = 0;
+ int max_age = 0;
int line_len;
- int incremental; // Do an incremental run
- int tail; // Tail the log file
- int summary; // Summary only
- int json; // JSON output
- int cgi; // CGI output (typically with json)
- int urls; // Produce JSON output of URL stats, arg is LRU size
- int show_urls; // Max URLs to show
- int as_object; // Show the URL stats as a single JSON object (not array)
- int concise; // Eliminate metrics that can be inferred by other values
- int report_per_user; // A flag to aggregate and report stats per user instead of per host if 'true' (default 'false')
- int no_format_check; // A flag to skip the log format check if any of the fields is not a standard squid log format field.
-
- CommandLineArgs()
- : max_origins(0),
- min_hits(0),
- max_age(0),
- line_len(DEFAULT_LINE_LEN),
- incremental(0),
- tail(0),
- summary(0),
- json(0),
- cgi(0),
- urls(0),
- show_urls(0),
- as_object(0),
- concise(0),
- report_per_user(0),
- no_format_check(0)
+ int incremental = 0; // Do an incremental run
+ int tail = 0; // Tail the log file
+ int summary = 0; // Summary only
+ int json = 0; // JSON output
+ int cgi = 0; // CGI output (typically with json)
+ int urls = 0; // Produce JSON output of URL stats, arg is LRU size
+ int show_urls = 0; // Max URLs to show
+ int as_object = 0; // Show the URL stats as a single JSON object (not array)
+ int concise = 0; // Eliminate metrics that can be inferred by other values
+ int report_per_user = 0; // A flag to aggregate and report stats per user instead of per host if 'true' (default 'false')
+ int no_format_check = 0; // A flag to skip the log format check if any of the fields is not a standard squid log format field.
+
+ CommandLineArgs() : line_len(DEFAULT_LINE_LEN)
+
{
log_file[0] = '\0';
origin_file[0] = '\0';
@@ -731,10 +717,10 @@ enum ExitLevel {
};
struct ExitStatus {
- ExitLevel level;
+ ExitLevel level = EXIT_OK;
char notice[1024];
- ExitStatus() : level(EXIT_OK) { memset(notice, 0, sizeof(notice)); }
+ ExitStatus() { memset(notice, 0, sizeof(notice)); }
void
set(ExitLevel l, const char *n = nullptr)
{
diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc
index c35f00c..0927450 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -399,7 +399,7 @@ public:
class MemoryLimit : public Continuation
{
public:
- MemoryLimit() : Continuation(new_ProxyMutex()), _memory_limit(0)
+ MemoryLimit() : Continuation(new_ProxyMutex())
{
memset(&_usage, 0, sizeof(_usage));
SET_HANDLER(&MemoryLimit::periodic);
@@ -449,7 +449,7 @@ public:
}
private:
- int64_t _memory_limit;
+ int64_t _memory_limit = 0;
struct rusage _usage;
};
@@ -1173,18 +1173,18 @@ struct ShowStats : public Continuation {
#ifdef ENABLE_TIME_TRACE
FILE *fp;
#endif
- int cycle;
- int64_t last_cc;
- int64_t last_rb;
- int64_t last_w;
- int64_t last_r;
- int64_t last_wb;
- int64_t last_nrb;
- int64_t last_nw;
- int64_t last_nr;
- int64_t last_nwb;
- int64_t last_p;
- int64_t last_o;
+ int cycle = 0;
+ int64_t last_cc = 0;
+ int64_t last_rb = 0;
+ int64_t last_w = 0;
+ int64_t last_r = 0;
+ int64_t last_wb = 0;
+ int64_t last_nrb = 0;
+ int64_t last_nw = 0;
+ int64_t last_nr = 0;
+ int64_t last_nwb = 0;
+ int64_t last_p = 0;
+ int64_t last_o = 0;
int
mainEvent(int event, Event *e)
{
@@ -1284,20 +1284,8 @@ struct ShowStats : public Continuation {
#endif
return EVENT_CONT;
}
- ShowStats()
- : Continuation(nullptr),
- cycle(0),
- last_cc(0),
- last_rb(0),
- last_w(0),
- last_r(0),
- last_wb(0),
- last_nrb(0),
- last_nw(0),
- last_nr(0),
- last_nwb(0),
- last_p(0),
- last_o(0)
+ ShowStats() : Continuation(nullptr)
+
{
SET_HANDLER(&ShowStats::mainEvent);
#ifdef ENABLE_TIME_TRACE
@@ -1352,9 +1340,9 @@ init_http_header()
#if TS_HAS_TESTS
struct RegressionCont : public Continuation {
- int initialized;
- int waits;
- int started;
+ int initialized = 0;
+ int waits = 0;
+ int started = 0;
int
mainEvent(int event, Event *e)
@@ -1383,10 +1371,7 @@ struct RegressionCont : public Continuation {
return EVENT_CONT;
}
- RegressionCont() : Continuation(new_ProxyMutex()), initialized(0), waits(0), started(0)
- {
- SET_HANDLER(&RegressionCont::mainEvent);
- }
+ RegressionCont() : Continuation(new_ProxyMutex()) { SET_HANDLER(&RegressionCont::mainEvent); }
};
static void
diff --git a/src/tscore/BaseLogFile.cc b/src/tscore/BaseLogFile.cc
index 6496815..921a160 100644
--- a/src/tscore/BaseLogFile.cc
+++ b/src/tscore/BaseLogFile.cc
@@ -46,15 +46,13 @@ BaseLogFile::BaseLogFile(const char *name, uint64_t sig) : m_name(ats_strdup(nam
* This copy constructor creates a BaseLogFile based on a given copy.
*/
BaseLogFile::BaseLogFile(const BaseLogFile ©)
- : m_fp(nullptr),
- m_start_time(copy.m_start_time),
- m_end_time(0L),
- m_bytes_written(0),
+ : m_start_time(copy.m_start_time),
+
m_name(ats_strdup(copy.m_name)),
m_hostname(ats_strdup(copy.m_hostname)),
- m_is_regfile(false),
+
m_is_init(copy.m_is_init),
- m_meta_info(nullptr),
+
m_signature(copy.m_signature),
m_has_signature(copy.m_has_signature)
{
diff --git a/src/tscore/HashMD5.cc b/src/tscore/HashMD5.cc
index 7f1dedc..f8b4ff5 100644
--- a/src/tscore/HashMD5.cc
+++ b/src/tscore/HashMD5.cc
@@ -23,7 +23,7 @@
#include "tscore/ink_config.h"
#include "tscore/HashMD5.h"
-ATSHashMD5::ATSHashMD5() : md_len(0), finalized(false)
+ATSHashMD5::ATSHashMD5()
{
ctx = EVP_MD_CTX_new();
int ret = EVP_DigestInit_ex(ctx, EVP_md5(), nullptr);
diff --git a/src/tscore/ink_cap.cc b/src/tscore/ink_cap.cc
index f33b732..7fd3289 100644
--- a/src/tscore/ink_cap.cc
+++ b/src/tscore/ink_cap.cc
@@ -486,8 +486,7 @@ ElevateAccess::releasePrivilege()
#endif
ElevateAccess::ElevateAccess(unsigned lvl)
- : elevated(false),
- saved_uid(geteuid()),
+ : saved_uid(geteuid()),
level(lvl)
#if TS_USE_POSIX_CAP
,
diff --git a/src/tscore/ink_resource.cc b/src/tscore/ink_resource.cc
index 08ba118..c557ad2 100644
--- a/src/tscore/ink_resource.cc
+++ b/src/tscore/ink_resource.cc
@@ -39,7 +39,7 @@ ink_mutex ResourceTracker::resourceLock = PTHREAD_MUTEX_INITIALIZER;
class Resource
{
public:
- Resource() : _incrementCount(0), _decrementCount(0), _value(0), _symbol(nullptr) { _name[0] = '\0'; }
+ Resource() { _name[0] = '\0'; }
void increment(const int64_t size);
int64_t
getValue() const
@@ -86,10 +86,10 @@ public:
}
private:
- int64_t _incrementCount;
- int64_t _decrementCount;
- int64_t _value;
- const void *_symbol;
+ int64_t _incrementCount = 0;
+ int64_t _decrementCount = 0;
+ int64_t _value = 0;
+ const void *_symbol = nullptr;
char _name[128];
};
diff --git a/src/tscpp/api/Headers.cc b/src/tscpp/api/Headers.cc
index 1745883..204d7a5 100644
--- a/src/tscpp/api/Headers.cc
+++ b/src/tscpp/api/Headers.cc
@@ -101,11 +101,11 @@ HeaderFieldName::operator!=(const std::string &field_name)
* @private
*/
struct HeaderFieldValueIteratorState : noncopyable {
- TSMBuffer hdr_buf_;
- TSMLoc hdr_loc_;
- TSMLoc field_loc_;
- int index_;
- HeaderFieldValueIteratorState() : hdr_buf_(nullptr), hdr_loc_(nullptr), field_loc_(nullptr), index_(0) {}
+ TSMBuffer hdr_buf_ = nullptr;
+ TSMLoc hdr_loc_ = nullptr;
+ TSMLoc field_loc_ = nullptr;
+ int index_ = 0;
+ HeaderFieldValueIteratorState() {}
void
reset(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc, int index)
{
diff --git a/src/tscpp/api/InterceptPlugin.cc b/src/tscpp/api/InterceptPlugin.cc
index 8ccc5a2..db0bd00 100644
--- a/src/tscpp/api/InterceptPlugin.cc
+++ b/src/tscpp/api/InterceptPlugin.cc
@@ -45,10 +45,10 @@ struct InterceptPlugin::State {
TSVConn net_vc_ = nullptr;
struct IoHandle {
- TSVIO vio_;
- TSIOBuffer buffer_;
- TSIOBufferReader reader_;
- IoHandle() : vio_(nullptr), buffer_(nullptr), reader_(nullptr){};
+ TSVIO vio_ = nullptr;
+ TSIOBuffer buffer_ = nullptr;
+ TSIOBufferReader reader_ = nullptr;
+ IoHandle(){};
~IoHandle()
{
if (reader_) {
diff --git a/src/tscpp/api/Logger.cc b/src/tscpp/api/Logger.cc
index da94f31..7d44a0e 100644
--- a/src/tscpp/api/Logger.cc
+++ b/src/tscpp/api/Logger.cc
@@ -42,22 +42,17 @@ using atscppapi::Logger;
*/
struct atscppapi::LoggerState : noncopyable {
std::string filename_;
- bool add_timestamp_;
- bool rename_file_;
- Logger::LogLevel level_;
- bool rolling_enabled_;
- int rolling_interval_seconds_;
- TSTextLogObject text_log_obj_;
- bool initialized_;
+ bool add_timestamp_ = false;
+ bool rename_file_ = false;
+ Logger::LogLevel level_ = Logger::LOG_LEVEL_NO_LOG;
+ bool rolling_enabled_ = false;
+ int rolling_interval_seconds_ = -1;
+ TSTextLogObject text_log_obj_ = nullptr;
+ bool initialized_ = false;
LoggerState()
- : add_timestamp_(false),
- rename_file_(false),
- level_(Logger::LOG_LEVEL_NO_LOG),
- rolling_enabled_(false),
- rolling_interval_seconds_(-1),
- text_log_obj_(nullptr),
- initialized_(false){};
+
+ {};
~LoggerState(){};
};
diff --git a/src/tscpp/api/Request.cc b/src/tscpp/api/Request.cc
index eec8244..74c45c7 100644
--- a/src/tscpp/api/Request.cc
+++ b/src/tscpp/api/Request.cc
@@ -32,24 +32,16 @@ using std::string;
* @private
*/
struct atscppapi::RequestState : noncopyable {
- TSMBuffer hdr_buf_;
- TSMLoc hdr_loc_;
- TSMLoc url_loc_;
+ TSMBuffer hdr_buf_ = nullptr;
+ TSMLoc hdr_loc_ = nullptr;
+ TSMLoc url_loc_ = nullptr;
Url url_;
Headers headers_;
/* method and version are stored here for the case of an unbound request */
- HttpMethod method_;
- HttpVersion version_;
- bool destroy_buf_;
- RequestState()
- : hdr_buf_(nullptr),
- hdr_loc_(nullptr),
- url_loc_(nullptr),
- method_(HTTP_METHOD_UNKNOWN),
- version_(HTTP_VERSION_UNKNOWN),
- destroy_buf_(false)
- {
- }
+ HttpMethod method_ = HTTP_METHOD_UNKNOWN;
+ HttpVersion version_ = HTTP_VERSION_UNKNOWN;
+ bool destroy_buf_ = false;
+ RequestState() {}
};
Request::Request()
diff --git a/src/tscpp/api/Response.cc b/src/tscpp/api/Response.cc
index bc2f001..7624e88 100644
--- a/src/tscpp/api/Response.cc
+++ b/src/tscpp/api/Response.cc
@@ -32,10 +32,10 @@ namespace atscppapi
* @private
*/
struct ResponseState : noncopyable {
- TSMBuffer hdr_buf_;
- TSMLoc hdr_loc_;
+ TSMBuffer hdr_buf_ = nullptr;
+ TSMLoc hdr_loc_ = nullptr;
Headers headers_;
- ResponseState() : hdr_buf_(nullptr), hdr_loc_(nullptr) {}
+ ResponseState() {}
};
} // namespace atscppapi
diff --git a/src/tscpp/api/Stat.cc b/src/tscpp/api/Stat.cc
index b1422fa..0a28230 100644
--- a/src/tscpp/api/Stat.cc
+++ b/src/tscpp/api/Stat.cc
@@ -28,7 +28,7 @@
using namespace atscppapi;
using std::string;
-Stat::Stat() : stat_id_(TS_ERROR)
+Stat::Stat()
{
// ATS Guarantees that stat ids will always be > 0. So we can use stat_id_ > 0 to
// verify that this stat has been properly initialized.