Fix clang-tidy modernize-use-default-member-init findings

This commit is contained in:
Tim Wojtulewicz 2025-05-16 10:02:59 -07:00
parent 0227e3a545
commit 3943e64372
4 changed files with 21 additions and 38 deletions

View file

@ -9,6 +9,7 @@ Checks: [-*,
modernize-redundant-void-arg,
modernize-return-braced-init-list,
modernize-use-bool-literals,
modernize-use-default-member-init,
# Enable a very limited number of the cppcoreguidelines checkers.
# See the notes for some of the rest of them below.

View file

@ -243,12 +243,7 @@ uint64_t DataBlockList::Trim(uint64_t seq, uint64_t max_old, DataBlockList* old_
}
Reassembler::Reassembler(uint64_t init_seq, ReassemblerType reassem_type)
: block_list(this),
old_block_list(this),
last_reassem_seq(init_seq),
trim_seq(init_seq),
max_old_blocks(0),
rtype(reassem_type) {}
: block_list(this), old_block_list(this), last_reassem_seq(init_seq), trim_seq(init_seq), rtype(reassem_type) {}
void Reassembler::CheckOverlap(const DataBlockList& list, uint64_t seq, uint64_t len, const u_char* data) {
if ( list.Empty() )

View file

@ -11,7 +11,7 @@ namespace zeek::file_analysis {
class File;
FileReassembler::FileReassembler(File* f, uint64_t starting_offset)
: Reassembler(starting_offset, REASSEM_FILE), the_file(f), flushing(false) {}
: Reassembler(starting_offset, REASSEM_FILE), the_file(f) {}
uint64_t FileReassembler::Flush() {
if ( flushing )

View file

@ -51,16 +51,16 @@ static void input_hash_delete_func(void* val) {
class Manager::Stream {
public:
string name;
bool removed;
bool removed = false;
StreamType stream_type; // to distinguish between event and table streams
EnumVal* type;
ReaderFrontend* reader;
TableVal* config;
EnumVal* type = nullptr;
ReaderFrontend* reader = nullptr;
TableVal* config = nullptr;
EventHandlerPtr error_event;
RecordVal* description;
RecordVal* description = nullptr;
virtual ~Stream();
@ -68,8 +68,7 @@ protected:
Stream(StreamType t);
};
Manager::Stream::Stream(StreamType t)
: name(), removed(), stream_type(t), type(), reader(), config(), error_event(), description() {}
Manager::Stream::Stream(StreamType t) : stream_type(t) {}
Manager::Stream::~Stream() {
Unref(type);
@ -80,18 +79,18 @@ Manager::Stream::~Stream() {
class Manager::TableStream final : public Manager::Stream {
public:
unsigned int num_idx_fields;
unsigned int num_val_fields;
bool want_record;
unsigned int num_idx_fields = 0;
unsigned int num_val_fields = 0;
bool want_record = false;
TableVal* tab;
RecordType* rtype;
RecordType* itype;
TableVal* tab = nullptr;
RecordType* rtype = nullptr;
RecordType* itype = nullptr;
PDict<InputHash>* currDict;
PDict<InputHash>* lastDict;
PDict<InputHash>* currDict = nullptr;
PDict<InputHash>* lastDict = nullptr;
Func* pred;
Func* pred = nullptr;
EventHandlerPtr event;
@ -103,7 +102,7 @@ class Manager::EventStream final : public Manager::Stream {
public:
EventHandlerPtr event;
RecordType* fields;
RecordType* fields = nullptr;
unsigned int num_fields;
bool want_record;
@ -119,21 +118,9 @@ public:
~AnalysisStream() override = default;
};
Manager::TableStream::TableStream()
: Manager::Stream::Stream(TABLE_STREAM),
num_idx_fields(),
num_val_fields(),
want_record(),
tab(),
rtype(),
itype(),
currDict(),
lastDict(),
pred(),
event() {}
Manager::TableStream::TableStream() : Manager::Stream::Stream(TABLE_STREAM) {}
Manager::EventStream::EventStream()
: Manager::Stream::Stream(EVENT_STREAM), event(), fields(), num_fields(), want_record() {}
Manager::EventStream::EventStream() : Manager::Stream::Stream(EVENT_STREAM) {}
Manager::EventStream::~EventStream() {
if ( fields )