From 75422b5d2196cbb426ebf8682c6f0bad25cfa970 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 7 Oct 2025 15:05:22 -0700 Subject: [PATCH] Clean up initialization in Func.h --- src/Frame.cc | 8 -------- src/Frame.h | 18 +++++++++--------- src/Func.h | 14 +++++--------- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/Frame.cc b/src/Frame.cc index 11b60a57f5..3fce2d9753 100644 --- a/src/Frame.cc +++ b/src/Frame.cc @@ -21,13 +21,6 @@ Frame::Frame(int arg_size, const ScriptFunc* func, const zeek::Args* fn_args) { function = func; func_args = fn_args; - next_stmt = nullptr; - break_before_next_stmt = false; - break_on_return = false; - - call = nullptr; - delayed = false; - // We could Ref()/Unref() the captures frame, but there's really // no need because by definition this current frame exists to // enable execution of the function, and its captures frame won't @@ -35,7 +28,6 @@ Frame::Frame(int arg_size, const ScriptFunc* func, const zeek::Args* fn_args) { // after this frame does. captures = function ? function->GetCapturesFrame() : nullptr; captures_offset_map = function ? function->GetCapturesOffsetMap() : nullptr; - current_offset = 0; } void Frame::SetElement(int n, ValPtr v) { diff --git a/src/Frame.h b/src/Frame.h index 9b80e01601..cfafad002a 100644 --- a/src/Frame.h +++ b/src/Frame.h @@ -216,9 +216,9 @@ private: /** The number of vals that can be stored in this frame. */ int size; - bool break_before_next_stmt; - bool break_on_return; - bool delayed; + bool break_before_next_stmt = false; + bool break_on_return = false; + bool delayed = false; /** Associates ID's offsets with values. */ std::unique_ptr frame; @@ -228,25 +228,25 @@ private: * This is how we support inlined functions without having to * alter the offsets associated with their local variables. */ - int current_offset; + int current_offset = 0; /** Frame used for lambda/when captures. */ - Frame* captures; + Frame* captures = nullptr; /** Maps IDs to offsets into the "captures" frame. If the ID * isn't present, then it's not a capture. */ - const OffsetMap* captures_offset_map; + const OffsetMap* captures_offset_map = nullptr; /** The function this frame is associated with. */ - const ScriptFunc* function; + const ScriptFunc* function = nullptr; // The following is only needed for the debugger. /** The arguments to the function that this Frame is associated with. */ - const zeek::Args* func_args; + const zeek::Args* func_args = nullptr; /** The next statement to be evaluated in the context of this frame. */ - Stmt* next_stmt; + Stmt* next_stmt = nullptr; trigger::TriggerPtr trigger; const CallExpr* call = nullptr; diff --git a/src/Func.h b/src/Func.h index edfe258680..2437bc0065 100644 --- a/src/Func.h +++ b/src/Func.h @@ -339,20 +339,16 @@ public: void Describe(ODesc* d) const override; protected: - BuiltinFunc() { - func = nullptr; - is_pure = false; - } - - built_in_func func; - bool is_pure; + BuiltinFunc() = default; + built_in_func func = nullptr; + bool is_pure = false; }; extern bool check_built_in_call(BuiltinFunc* f, CallExpr* call); struct CallInfo { - const CallExpr* call; - const Func* func; + const CallExpr* call = nullptr; + const Func* func = nullptr; const zeek::Args& args; };