Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -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\/)).*
2 changes: 1 addition & 1 deletion example/cppapi/websocket/WSBuffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion example/cppapi/websocket/WSBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ class WSBuffer

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
};
12 changes: 6 additions & 6 deletions example/intercept/intercept.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {}
};

Expand Down
8 changes: 4 additions & 4 deletions example/passthru/passthru.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions include/tscore/Arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -49,7 +49,7 @@ class Arena
inkcoreapi void reset();

private:
ArenaBlock *m_blocks;
ArenaBlock *m_blocks = nullptr;
};

/*-------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions include/tscore/HashMD5.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
4 changes: 2 additions & 2 deletions include/tscore/IpMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class IpMap
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.
Expand All @@ -146,7 +146,7 @@ class IpMap
virtual sockaddr const *max() const = 0;

protected:
void *_data; ///< Client data.
void *_data = nullptr; ///< Client data.
};

/** Iterator over nodes / intervals.
Expand Down
4 changes: 2 additions & 2 deletions include/tscore/List.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions include/tscore/MT_hashtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
6 changes: 3 additions & 3 deletions include/tscore/PriorityQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
6 changes: 3 additions & 3 deletions include/tscore/Ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -86,7 +86,7 @@ class RefCountObj : public ForceVFPTToTop
}

private:
int m_refcount;
int m_refcount = 0;
};

////////////////////////////////////////////////////////////////////////
Expand Down
14 changes: 7 additions & 7 deletions include/tscore/RbTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 */
Expand Down
13 changes: 6 additions & 7 deletions include/tscore/SimpleTokenizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,13 @@ class SimpleTokenizer
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);
}
Expand Down Expand Up @@ -188,15 +187,15 @@ class SimpleTokenizer
}

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()
Expand Down
12 changes: 6 additions & 6 deletions include/tscore/TsBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) {}
Expand Down
2 changes: 1 addition & 1 deletion include/tscore/ink_cap.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ElevateAccess
void demote();

private:
bool elevated;
bool elevated = false;
uid_t saved_uid;
unsigned level;

Expand Down
4 changes: 2 additions & 2 deletions include/tscore/ink_inet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions include/tscore/ink_lockfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -86,5 +86,5 @@ class Lockfile

private:
char fname[PATH_NAME_MAX];
int fd;
int fd = 0;
};
10 changes: 5 additions & 5 deletions include/tscore/ink_string++.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions include/tscore/ink_uuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -122,7 +122,7 @@ class ATSUuid
} _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
Expand Down
4 changes: 2 additions & 2 deletions include/tscpp/api/Continuation.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Continuation

// Create "empty" continuation, can only be populated by move assignement.
//
Continuation() : _cont(nullptr) {}
Continuation() {}

TSCont
asTSCont() const
Expand Down Expand Up @@ -139,7 +139,7 @@ class Continuation
//
static int _generalEventFunc(TSCont cont, TSEvent event, void *edata);

TSCont _cont;
TSCont _cont = nullptr;
};

} // end namespace atscppapi
4 changes: 3 additions & 1 deletion include/tscpp/api/Stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@

#pragma once

#include "ts/apidefs.h"
#include "tscpp/api/noncopyable.h"

#include <cstdint>
#include <string>

Expand Down Expand Up @@ -97,7 +99,7 @@ class Stat : noncopyable
void set(int64_t value);

private:
int stat_id_; /**< The internal stat ID */
int stat_id_ = TS_ERROR; /**< The internal stat ID */
};

} // namespace atscppapi
Loading