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-redundant-void-arg,
modernize-return-braced-init-list, modernize-return-braced-init-list,
modernize-use-bool-literals, modernize-use-bool-literals,
modernize-use-default-member-init,
# Enable a very limited number of the cppcoreguidelines checkers. # Enable a very limited number of the cppcoreguidelines checkers.
# See the notes for some of the rest of them below. # 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) Reassembler::Reassembler(uint64_t init_seq, ReassemblerType reassem_type)
: block_list(this), : block_list(this), old_block_list(this), last_reassem_seq(init_seq), trim_seq(init_seq), rtype(reassem_type) {}
old_block_list(this),
last_reassem_seq(init_seq),
trim_seq(init_seq),
max_old_blocks(0),
rtype(reassem_type) {}
void Reassembler::CheckOverlap(const DataBlockList& list, uint64_t seq, uint64_t len, const u_char* data) { void Reassembler::CheckOverlap(const DataBlockList& list, uint64_t seq, uint64_t len, const u_char* data) {
if ( list.Empty() ) if ( list.Empty() )

View file

@ -11,7 +11,7 @@ namespace zeek::file_analysis {
class File; class File;
FileReassembler::FileReassembler(File* f, uint64_t starting_offset) 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() { uint64_t FileReassembler::Flush() {
if ( flushing ) if ( flushing )

View file

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