Fix clang-tidy modernize-use-default-member-init warnings in headers

This commit is contained in:
Tim Wojtulewicz 2025-06-10 09:32:23 -07:00
parent a05b4abdf7
commit fb55c8856e
49 changed files with 134 additions and 185 deletions

View file

@ -68,7 +68,7 @@ namespace detail {
class DebugLogger {
public:
// Output goes to stderr per default.
DebugLogger() : file(nullptr), all(false), verbose(false) {};
DebugLogger() = default;
~DebugLogger();
void OpenDebugLog(const char* filename = 0);
@ -99,14 +99,14 @@ public:
void ShowStreamsHelp();
private:
FILE* file;
bool all;
bool verbose;
FILE* file = nullptr;
bool all = false;
bool verbose = false;
struct Stream {
const char* prefix;
int indent;
bool enabled;
const char* prefix = nullptr;
int indent = 0;
bool enabled = false;
};
std::set<std::string> enabled_streams;

View file

@ -2782,7 +2782,7 @@ static void report_field_deprecation(const RecordType* rt, const Expr* e, int fi
}
FieldExpr::FieldExpr(ExprPtr arg_op, const char* arg_field_name)
: UnaryExpr(EXPR_FIELD, std::move(arg_op)), field_name(util::copy_string(arg_field_name)), td(nullptr), field(0) {
: UnaryExpr(EXPR_FIELD, std::move(arg_op)), field_name(util::copy_string(arg_field_name)) {
if ( IsError() )
return;
@ -2863,7 +2863,7 @@ void FieldExpr::ExprDescribe(ODesc* d) const {
}
HasFieldExpr::HasFieldExpr(ExprPtr arg_op, const char* arg_field_name)
: UnaryExpr(EXPR_HAS_FIELD, std::move(arg_op)), field_name(arg_field_name), field(0) {
: UnaryExpr(EXPR_HAS_FIELD, std::move(arg_op)), field_name(arg_field_name) {
if ( IsError() )
return;

View file

@ -1146,8 +1146,8 @@ protected:
void ExprDescribe(ODesc* d) const override;
const char* field_name;
const TypeDecl* td;
int field; // -1 = attributes
const TypeDecl* td = nullptr;
int field = -1;
};
// "rec?$fieldname" is true if the value of $fieldname in rec is not nil.
@ -1171,8 +1171,8 @@ protected:
void ExprDescribe(ODesc* d) const override;
const char* field_name;
int field;
const char* field_name = nullptr;
int field = -1;
};
class RecordConstructorExpr final : public Expr {

View file

@ -72,7 +72,7 @@ static zeek::ValPtr mmdb_getvalue(MMDB_entry_data_s* entry_data, int status, int
return nullptr;
}
MMDB::MMDB() : mmdb{}, file_info{}, reported_error{false}, last_check{zeek::run_state::network_time} {}
MMDB::MMDB() : mmdb{}, file_info{}, last_check{zeek::run_state::network_time} {}
MMDB::~MMDB() { Close(); }

View file

@ -64,7 +64,7 @@ private:
std::string filename;
MMDB_s mmdb;
struct stat file_info;
bool reported_error; // to ensure we emit builtin errors during opening only once.
bool reported_error = false; // to ensure we emit builtin errors during opening only once.
double last_check;
};

View file

@ -57,9 +57,9 @@ public:
void UnsetFlags(int flags);
private:
int fds[2];
int flags[2];
int status_flags[2];
int fds[2] = {-1, -1};
int flags[2] = {0};
int status_flags[2] = {0};
};
/**
@ -119,7 +119,7 @@ public:
void Swap() { swapped = ! swapped; }
private:
Pipe pipes[2];
Pipe pipes[2]; // NOLINT(modernize-use-default-member-init)
bool swapped = false;
};

View file

@ -112,13 +112,11 @@ private:
friend class RuleMatcher;
struct PatternSet {
PatternSet() : re() {}
// If we're above the 'RE_level' (see RuleMatcher), this
// expr contains all patterns on this node. If we're on
// 'RE_level', it additionally contains all patterns
// of any of its children.
Specific_RE_Matcher* re;
Specific_RE_Matcher* re = nullptr;
// All the patterns and their rule indices.
string_list patterns;

View file

@ -20,8 +20,6 @@ using namespace std;
namespace zeek::detail {
ScriptCoverageManager::ScriptCoverageManager() : ignoring(0), delim('\t') {}
void ScriptCoverageManager::AddStmt(Stmt* s) {
if ( ignoring != 0 || analysis_options.gen_ZAM )
return;

View file

@ -19,9 +19,6 @@ using ObjPtr = IntrusivePtr<Obj>;
*/
class ScriptCoverageManager {
public:
ScriptCoverageManager();
virtual ~ScriptCoverageManager() = default;
/**
* Imports Zeek script Stmt usage information from file pointed to by
* environment variable ZEEK_PROFILER_FILE.
@ -64,12 +61,12 @@ private:
* Indicates whether new statements will not be considered as part of
* coverage statistics because it was marked with the @no-test tag.
*/
uint32_t ignoring;
uint32_t ignoring = 0;
/**
* The character to use to delimit ScriptCoverageManager output files. Default is '\t'.
*/
char delim;
char delim = '\t';
/**
* This maps Stmt location-desc pairs to the total number of times that

View file

@ -12,10 +12,7 @@
namespace zeek::detail {
const float SerializationFormat::GROWTH_FACTOR = 2.5;
SerializationFormat::SerializationFormat()
: output(), output_size(), output_pos(), input(), input_len(), input_pos(), bytes_written(), bytes_read() {}
constexpr float SerializationFormat::GROWTH_FACTOR = 2.5;
SerializationFormat::~SerializationFormat() { free(output); }

View file

@ -20,7 +20,7 @@ namespace detail {
// Abstract base class.
class SerializationFormat {
public:
SerializationFormat();
SerializationFormat() = default;
virtual ~SerializationFormat();
// Unserialization.
@ -88,16 +88,16 @@ protected:
static const uint32_t INITIAL_SIZE = 65536;
static const float GROWTH_FACTOR;
char* output;
uint32_t output_size;
uint32_t output_pos;
char* output = nullptr;
uint32_t output_size = 0;
uint32_t output_pos = 0;
const char* input;
uint32_t input_len;
uint32_t input_pos;
const char* input = nullptr;
uint32_t input_len = 0;
uint32_t input_pos = 0;
int bytes_written;
int bytes_read;
int bytes_written = 0;
int bytes_read = 0;
};
class BinarySerializationFormat final : public SerializationFormat {

View file

@ -642,7 +642,7 @@ void SwitchStmt::Init() {
}
SwitchStmt::SwitchStmt(ExprPtr index, case_list* arg_cases)
: ExprStmt(STMT_SWITCH, std::move(index)), cases(arg_cases), default_case_idx(-1) {
: ExprStmt(STMT_SWITCH, std::move(index)), cases(arg_cases) {
Init();
bool have_exprs = false;

View file

@ -220,9 +220,9 @@ protected:
// the matching type-based case if it defines one.
std::pair<int, ID*> FindCaseLabelMatch(const Val* v) const;
case_list* cases;
int default_case_idx;
CompositeHash* comp_hash;
case_list* cases = nullptr;
int default_case_idx = -1;
CompositeHash* comp_hash = nullptr;
std::unordered_map<const Val*, int> case_label_value_map;
PDict<int> case_label_hash_map;
std::vector<std::pair<ID*, int>> case_label_type_list;

View file

@ -145,7 +145,7 @@ protected:
*/
class EncapsulationStack {
public:
EncapsulationStack() : conns(nullptr) {}
EncapsulationStack() = default;
EncapsulationStack(const EncapsulationStack& other) {
if ( other.conns )
@ -241,7 +241,7 @@ public:
void Pop();
protected:
std::vector<EncapsulatingConn>* conns;
std::vector<EncapsulatingConn>* conns = nullptr;
};
} // namespace zeek

View file

@ -11,19 +11,7 @@
namespace zeek::analyzer::conn_size {
ConnSize_Analyzer::ConnSize_Analyzer(Connection* c)
: Analyzer("CONNSIZE", c),
orig_bytes(),
resp_bytes(),
orig_pkts(),
resp_pkts(),
orig_bytes_thresh(),
resp_bytes_thresh(),
orig_pkts_thresh(),
resp_pkts_thresh(),
duration_thresh() {
start_time = c->StartTime();
}
ConnSize_Analyzer::ConnSize_Analyzer(Connection* c) : Analyzer("CONNSIZE", c) { start_time = c->StartTime(); }
void ConnSize_Analyzer::Init() {
Analyzer::Init();

View file

@ -32,18 +32,18 @@ protected:
void ThresholdEvent(EventHandlerPtr f, uint64_t threshold, bool is_orig);
uint64_t orig_bytes;
uint64_t resp_bytes;
uint64_t orig_pkts;
uint64_t resp_pkts;
uint64_t orig_bytes = 0;
uint64_t resp_bytes = 0;
uint64_t orig_pkts = 0;
uint64_t resp_pkts = 0;
uint64_t orig_bytes_thresh;
uint64_t resp_bytes_thresh;
uint64_t orig_pkts_thresh;
uint64_t resp_pkts_thresh;
uint64_t orig_bytes_thresh = 0;
uint64_t resp_bytes_thresh = 0;
uint64_t orig_pkts_thresh = 0;
uint64_t resp_pkts_thresh = 0;
double start_time;
double duration_thresh;
double start_time = 0.0;
double duration_thresh = 0.0;
};
// Exposed to make it available to script optimization.

View file

@ -14,8 +14,6 @@
namespace zeek::analyzer::ftp {
FTP_Analyzer::FTP_Analyzer(Connection* conn) : analyzer::tcp::TCP_ApplicationAnalyzer("FTP", conn) {
pending_reply = 0;
nvt_orig = new analyzer::login::NVT_Analyzer(conn, true);
nvt_orig->SetIsNULSensitive(true);
nvt_orig->SetCRLFAsEOL(LF_as_EOL);

View file

@ -22,7 +22,7 @@ public:
protected:
analyzer::login::NVT_Analyzer* nvt_orig;
analyzer::login::NVT_Analyzer* nvt_resp;
uint32_t pending_reply; // code associated with multi-line reply, or 0
uint32_t pending_reply = 0; // code associated with multi-line reply, or 0
std::string auth_requested; // AUTH method requested
bool tls_active = false; // starttls active
};
@ -36,8 +36,7 @@ protected:
*/
class FTP_ADAT_Analyzer final : public analyzer::SupportAnalyzer {
public:
FTP_ADAT_Analyzer(Connection* conn, bool arg_orig)
: SupportAnalyzer("FTP_ADAT", conn, arg_orig), first_token(true) {}
FTP_ADAT_Analyzer(Connection* conn, bool arg_orig) : SupportAnalyzer("FTP_ADAT", conn, arg_orig) {}
void DeliverStream(int len, const u_char* data, bool orig) override;
@ -45,7 +44,7 @@ protected:
// Used by the client-side analyzer to tell if it needs to peek at the
// initial context token and do sanity checking (i.e. does it look like
// a TLS/SSL handshake token).
bool first_token;
bool first_token = true;
};
} // namespace zeek::analyzer::ftp

View file

@ -24,7 +24,7 @@ static RE_Matcher* re_login_timeouts;
static RE_Matcher* init_RE(ListVal* l);
Login_Analyzer::Login_Analyzer(const char* name, Connection* conn)
: analyzer::tcp::TCP_ApplicationAnalyzer(name, conn), user_text() {
: analyzer::tcp::TCP_ApplicationAnalyzer(name, conn) {
state = LOGIN_STATE_AUTHENTICATE;
num_user_lines_seen = lines_scanned = 0;
// Set last_failure_num_user_lines so we will always generate

View file

@ -64,7 +64,7 @@ protected:
// If we have more user text than this unprocessed, we complain about
// excessive typeahead.
#define MAX_USER_TEXT 12
char* user_text[MAX_USER_TEXT];
char* user_text[MAX_USER_TEXT] = {0};
int user_text_first, user_text_last; // indices into user_text
int num_user_text; // number of entries in user_text

View file

@ -316,8 +316,7 @@ void TelnetBinaryOption::InconsistentOption(unsigned int /* type */) {
} // namespace detail
NVT_Analyzer::NVT_Analyzer(Connection* conn, bool orig)
: analyzer::tcp::ContentLine_Analyzer("NVT", conn, orig), options() {}
NVT_Analyzer::NVT_Analyzer(Connection* conn, bool orig) : analyzer::tcp::ContentLine_Analyzer("NVT", conn, orig) {}
NVT_Analyzer::~NVT_Analyzer() {
for ( int i = 0; i < num_options; ++i )

View file

@ -164,7 +164,7 @@ protected:
int encrypting_mode = 0;
char* auth_name = nullptr;
TelnetOption* options[NUM_TELNET_OPTIONS];
TelnetOption* options[NUM_TELNET_OPTIONS] = {nullptr};
int num_options = 0;
};

View file

@ -14,7 +14,7 @@
namespace zeek::analyzer::pia {
PIA::PIA(analyzer::Analyzer* arg_as_analyzer) : state(INIT), as_analyzer(arg_as_analyzer), conn(), current_packet() {}
PIA::PIA(analyzer::Analyzer* arg_as_analyzer) : as_analyzer(arg_as_analyzer), current_packet() {}
PIA::~PIA() { ClearBuffer(&pkt_buffer); }

View file

@ -73,7 +73,8 @@ protected:
void PIA_DeliverPacket(int len, const u_char* data, bool is_orig, uint64_t seq, const IP_Hdr* ip, int caplen,
bool clear_state);
enum State : uint8_t { INIT, BUFFERING, MATCHING_ONLY, SKIPPING } state;
enum State : uint8_t { INIT, BUFFERING, MATCHING_ONLY, SKIPPING };
State state = INIT;
// Buffers one chunk of data. Used both for packet payload (incl.
// sequence numbers for TCP) and chunks of a reassembled stream.
@ -114,8 +115,8 @@ private:
// Joint backend for the two public FirstPacket() methods.
void FirstPacket(bool is_orig, const std::optional<TransportProto>& proto, const IP_Hdr* ip);
analyzer::Analyzer* as_analyzer;
Connection* conn;
analyzer::Analyzer* as_analyzer = nullptr;
Connection* conn = nullptr;
DataBlock current_packet;
};

View file

@ -625,7 +625,7 @@ void Contents_RPC::DeliverStream(int len, const u_char* data, bool orig) {
}
RPC_Analyzer::RPC_Analyzer(const char* name, Connection* conn, detail::RPC_Interpreter* arg_interp)
: analyzer::tcp::TCP_ApplicationAnalyzer(name, conn), interp(arg_interp), orig_rpc(), resp_rpc() {
: analyzer::tcp::TCP_ApplicationAnalyzer(name, conn), interp(arg_interp) {
if ( Conn()->ConnTransport() == TRANSPORT_UDP )
ADD_ANALYZER_TIMER(&RPC_Analyzer::ExpireTimer, run_state::network_time + zeek::detail::rpc_timeout, true,
zeek::detail::TIMER_RPC_EXPIRE);

View file

@ -250,8 +250,8 @@ protected:
detail::RPC_Interpreter* interp;
Contents_RPC* orig_rpc;
Contents_RPC* resp_rpc;
Contents_RPC* orig_rpc = nullptr;
Contents_RPC* resp_rpc = nullptr;
};
} // namespace zeek::analyzer::rpc

View file

@ -195,8 +195,7 @@ RecordVal* TCPStats_Endpoint::BuildStats() {
return stats;
}
TCPStats_Analyzer::TCPStats_Analyzer(Connection* c)
: TCP_ApplicationAnalyzer("TCPSTATS", c), orig_stats(), resp_stats() {}
TCPStats_Analyzer::TCPStats_Analyzer(Connection* c) : TCP_ApplicationAnalyzer("TCPSTATS", c) {}
TCPStats_Analyzer::~TCPStats_Analyzer() {
delete orig_stats;

View file

@ -117,8 +117,8 @@ public:
protected:
void DeliverPacket(int len, const u_char* data, bool is_orig, uint64_t seq, const IP_Hdr* ip, int caplen) override;
TCPStats_Endpoint* orig_stats;
TCPStats_Endpoint* resp_stats;
TCPStats_Endpoint* orig_stats = nullptr;
TCPStats_Endpoint* resp_stats = nullptr;
};
} // namespace zeek::analyzer::tcp

View file

@ -77,19 +77,7 @@ void File::StaticInit() {
}
File::File(const std::string& file_id, const std::string& source_name, Connection* conn, zeek::Tag tag, bool is_orig)
: id(file_id),
val(nullptr),
file_reassembler(nullptr),
stream_offset(0),
reassembly_max_buffer(0),
did_metadata_inference(false),
reassembly_enabled(false),
postpone_timeout(false),
done(false),
seen_bytes(0),
missing_bytes(0),
overflow_bytes(0),
analyzers(this) {
: id(file_id), val(nullptr), analyzers(this) {
StaticInit();
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Creating new File object", file_id.c_str());

View file

@ -316,29 +316,29 @@ protected:
protected:
std::string id; /**< A pretty hash that likely identifies file */
RecordValPtr val; /**< \c fa_file from script layer. */
FileReassembler* file_reassembler; /**< A reassembler for the file if it's needed. */
uint64_t stream_offset; /**< The offset of the file which has been forwarded. */
uint64_t reassembly_max_buffer; /**< Maximum allowed buffer for reassembly. */
bool did_metadata_inference; /**< Whether the metadata inference has already been attempted. */
bool reassembly_enabled; /**< Whether file stream reassembly is needed. */
bool postpone_timeout; /**< Whether postponing timeout is requested. */
bool done; /**< If this object is about to be deleted. */
uint64_t seen_bytes; /**< Number of bytes processed for this file. */
uint64_t missing_bytes; /**< Number of bytes missed for this file. */
uint64_t overflow_bytes; /**< Number of bytes not delivered. */
FileReassembler* file_reassembler = nullptr; /**< A reassembler for the file if it's needed. */
uint64_t stream_offset = 0; /**< The offset of the file which has been forwarded. */
uint64_t reassembly_max_buffer = 0; /**< Maximum allowed buffer for reassembly. */
bool did_metadata_inference = false; /**< Whether the metadata inference has already been attempted. */
bool reassembly_enabled = false; /**< Whether file stream reassembly is needed. */
bool postpone_timeout = false; /**< Whether postponing timeout is requested. */
bool done = false; /**< If this object is about to be deleted. */
uint64_t seen_bytes = 0; /**< Number of bytes processed for this file. */
uint64_t missing_bytes = 0; /**< Number of bytes missed for this file. */
uint64_t overflow_bytes = 0; /**< Number of bytes not delivered. */
detail::AnalyzerSet analyzers; /**< A set of attached file analyzers. */
std::list<Analyzer*> done_analyzers; /**< Analyzers we're done with, remembered here until they
can be safely deleted. */
struct BOF_Buffer {
BOF_Buffer() : full(false), size(0) {}
BOF_Buffer() = default;
~BOF_Buffer() {
for ( auto* chunk : chunks )
delete chunk;
}
bool full;
uint64_t size;
bool full = false;
uint64_t size = 0;
String::CVec chunks;
} bof_buffer; /**< Beginning of file buffer. */

View file

@ -16,12 +16,7 @@ using namespace std;
namespace zeek::file_analysis {
Manager::Manager()
: plugin::ComponentManager<file_analysis::Component>("Files", "Tag", "AllAnalyzers"),
current_file_id(),
magic_state(),
cumulative_files(0),
max_files(0) {}
Manager::Manager() : plugin::ComponentManager<file_analysis::Component>("Files", "Tag", "AllAnalyzers") {}
Manager::~Manager() {
for ( const auto& [_, tag] : mime_types )

View file

@ -431,14 +431,14 @@ private:
std::map<std::string, File*> id_map; /**< Map file ID to file_analysis::File records. */
std::set<std::string> ignored; /**< Ignored files. Will be finally removed on EOF. */
std::string current_file_id; /**< Hash of what get_file_handle event sets. */
zeek::detail::RuleFileMagicState* magic_state; /**< File magic signature match state. */
zeek::detail::RuleFileMagicState* magic_state = nullptr; /**< File magic signature match state. */
MIMEMap mime_types; /**< Mapping of MIME types to analyzers. */
inline static TableVal* disabled = nullptr; /**< Table of disabled analyzers. */
inline static TableType* tag_set_type = nullptr; /**< Type for set[tag]. */
size_t cumulative_files;
size_t max_files;
size_t cumulative_files = 0;
size_t max_files = 0;
zeek::detail::CompositeHash* analyzer_hash = nullptr;
};

View file

@ -16,7 +16,6 @@ Extract::Extract(RecordValPtr args, file_analysis::File* file, std::string arg_f
: file_analysis::Analyzer(file_mgr->GetComponentTag("EXTRACT"), std::move(args), file),
filename(std::move(arg_filename)),
limit(arg_limit),
written(0),
limit_includes_missing(arg_limit_includes_missing) {
char buf[128];
file_stream = fopen(filename.data(), "wb");

View file

@ -69,10 +69,10 @@ protected:
private:
std::string filename;
FILE* file_stream;
uint64_t limit; // the file extraction limit
uint64_t written; // how many bytes we have written so far
bool limit_includes_missing; // do count missing bytes against limit if true
FILE* file_stream = nullptr;
uint64_t limit = 0; // the file extraction limit
uint64_t written = 0; // how many bytes we have written so far
bool limit_includes_missing = false; // do count missing bytes against limit if true
};
} // namespace zeek::file_analysis::detail

View file

@ -16,7 +16,6 @@ Hash::Hash(RecordValPtr args, file_analysis::File* file, HashVal* hv, StringValP
: file_analysis::Analyzer(file_mgr->GetComponentTag(util::to_upper(arg_kind->ToStdString())), std::move(args),
file),
hash(hv),
fed(false),
kind(std::move(arg_kind)) {
hash->Init();
}

View file

@ -60,8 +60,8 @@ protected:
void Finalize();
private:
HashVal* hash;
bool fed;
HashVal* hash = nullptr;
bool fed = false;
StringValPtr kind;
};

View file

@ -15,7 +15,7 @@ namespace zeek::input::reader::detail {
streamsize Binary::chunk_size = 0;
Binary::Binary(ReaderFrontend* frontend) : ReaderBackend(frontend), in(nullptr), mtime(0), ino(0), firstrun(true) {
Binary::Binary(ReaderFrontend* frontend) : ReaderBackend(frontend) {
if ( ! chunk_size ) {
chunk_size = BifConst::InputBinary::chunk_size;

View file

@ -32,10 +32,10 @@ private:
int UpdateModificationTime();
std::string fname;
std::ifstream* in;
time_t mtime;
ino_t ino;
bool firstrun;
std::ifstream* in = nullptr;
time_t mtime = 0;
ino_t ino = 0;
bool firstrun = true;
// options set from the script-level.
static std::streamsize chunk_size;

View file

@ -16,8 +16,7 @@ using zeek::threading::Value;
namespace zeek::input::reader::detail {
SQLite::SQLite(ReaderFrontend* frontend)
: ReaderBackend(frontend), fields(), num_fields(), mode(), started(), query(), db(), st() {
SQLite::SQLite(ReaderFrontend* frontend) : ReaderBackend(frontend) {
set_separator.assign((const char*)BifConst::LogSQLite::set_separator->Bytes(),
BifConst::InputSQLite::set_separator->Len());

View file

@ -28,14 +28,14 @@ private:
threading::Value* EntryToVal(sqlite3_stmt* st, const threading::Field* field, int pos, int subpos);
const threading::Field* const* fields; // raw mapping
unsigned int num_fields;
int mode;
bool started;
const threading::Field* const* fields = nullptr; // raw mapping
unsigned int num_fields = 0;
int mode = 0;
bool started = false;
std::string query;
sqlite3* db;
sqlite3_stmt* st;
threading::formatter::Ascii* io;
sqlite3* db = nullptr;
sqlite3_stmt* st = nullptr;
threading::formatter::Ascii* io = nullptr;
std::string set_separator;
std::string unset_field;

View file

@ -60,7 +60,7 @@ public:
*
* Structure takes ownership of string.
*/
const char* path;
const char* path = nullptr;
/**
* The filter this writer is attached to.
@ -79,17 +79,17 @@ public:
/**
* The rotation interval as configured for this writer.
*/
double rotation_interval;
double rotation_interval = 0.0;
/**
* The parsed value of log_rotate_base_time in seconds.
*/
double rotation_base;
double rotation_base = 0.0;
/**
* The network time when the writer is created.
*/
double network_time;
double network_time = 0.0;
/**
* A map of key/value pairs corresponding to the relevant
@ -97,7 +97,7 @@ public:
*/
config_map config;
WriterInfo() : path(nullptr), rotation_interval(0.0), rotation_base(0.0), network_time(0.0) {}
WriterInfo() = default;
WriterInfo(const WriterInfo& other) {
path = other.path ? util::copy_string(other.path) : nullptr;

View file

@ -16,7 +16,7 @@ using zeek::threading::Value;
namespace zeek::logging::writer::detail {
SQLite::SQLite(WriterFrontend* frontend) : WriterBackend(frontend), fields(), num_fields(), db(), st() {
SQLite::SQLite(WriterFrontend* frontend) : WriterBackend(frontend) {
set_separator.assign((const char*)BifConst::LogSQLite::set_separator->Bytes(),
BifConst::LogSQLite::set_separator->Len());

View file

@ -32,11 +32,11 @@ private:
int AddParams(threading::Value* val, int pos);
std::string GetTableType(int, int);
const threading::Field* const* fields; // raw mapping
unsigned int num_fields;
const threading::Field* const* fields = nullptr; // raw mapping
unsigned int num_fields = 0;
sqlite3* db;
sqlite3_stmt* st;
sqlite3* db = nullptr;
sqlite3_stmt* st = nullptr;
std::string set_separator;
std::string unset_field;

View file

@ -19,7 +19,6 @@ IdentifierInfo::IdentifierInfo(zeek::detail::IDPtr arg_id, ScriptInfo* script, b
initial_val(),
redefs(),
fields(),
last_field_seen(),
declaring_script(script),
from_redef(redef) {
if ( id->GetVal() && (id->IsOption() || id->IsRedefinable()) )

View file

@ -185,8 +185,8 @@ private:
ValPtr initial_val;
redef_list redefs;
record_field_map fields;
RecordField* last_field_seen;
ScriptInfo* declaring_script;
RecordField* last_field_seen = nullptr;
ScriptInfo* declaring_script = nullptr;
bool from_redef = false;
};

View file

@ -51,18 +51,14 @@ static string RemoveLeadingSpace(const string& s) {
}
Manager::Manager(const string& arg_config, const string& command)
: disabled(),
comment_buffer(),
: comment_buffer(),
comment_buffer_map(),
packages(),
scripts(),
identifiers(),
all_info(),
last_identifier_seen(),
incomplete_type(),
enum_mappings(),
config(arg_config),
mtime() {
config(arg_config) {
if ( getenv("ZEEK_DISABLE_ZEEKYGEN") )
disabled = true;

View file

@ -226,7 +226,7 @@ private:
IdentifierInfo* CreateIdentifierInfo(zeek::detail::IDPtr id, ScriptInfo* script, bool from_redef = false);
bool disabled;
bool disabled = false;
comment_buffer_t comment_buffer; // For whatever next identifier comes in.
comment_buffer_map_t comment_buffer_map; // For a particular identifier.
InfoMap<PackageInfo> packages;
@ -234,11 +234,11 @@ private:
InfoMap<IdentifierInfo> identifiers;
InfoMap<SpicyModuleInfo> spicy_modules;
std::vector<Info*> all_info;
IdentifierInfo* last_identifier_seen;
IdentifierInfo* incomplete_type;
IdentifierInfo* last_identifier_seen = nullptr;
IdentifierInfo* incomplete_type = nullptr;
std::map<std::string, std::string> enum_mappings; // enum id -> enum type id
Config config;
time_t mtime;
time_t mtime = 0;
};
template<class T>

View file

@ -189,7 +189,7 @@ static vector<T*> filter_matches(const vector<Info*>& from, Target* t) {
return rval;
}
TargetFile::TargetFile(string arg_name) : name(std::move(arg_name)), f() {
TargetFile::TargetFile(string arg_name) : name(std::move(arg_name)) {
if ( name.find('/') != string::npos ) {
string dir = util::SafeDirname(name).result;

View file

@ -36,7 +36,7 @@ struct TargetFile {
~TargetFile();
std::string name; /**< File name. */
FILE* f; /**< File stream. */
FILE* f = nullptr; /**< File stream. */
};
/**