Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been assigned something valid by comparing to nullptr.
This commit is contained in:
parent
53317bbe14
commit
f8ab79e68a
258 changed files with 2398 additions and 2421 deletions
|
|
@ -265,7 +265,7 @@ class GDScriptInstance : public ScriptInstance {
|
|||
friend struct GDScriptUtilityFunctionsDefinitions;
|
||||
|
||||
ObjectID owner_id;
|
||||
Object *owner;
|
||||
Object *owner = nullptr;
|
||||
Ref<GDScript> script;
|
||||
#ifdef DEBUG_ENABLED
|
||||
Map<StringName, int> member_indices_cache; //used only for hot script reloading
|
||||
|
|
@ -311,17 +311,17 @@ class GDScriptLanguage : public ScriptLanguage {
|
|||
|
||||
static GDScriptLanguage *singleton;
|
||||
|
||||
Variant *_global_array;
|
||||
Variant *_global_array = nullptr;
|
||||
Vector<Variant> global_array;
|
||||
Map<StringName, int> globals;
|
||||
Map<StringName, Variant> named_globals;
|
||||
|
||||
struct CallLevel {
|
||||
Variant *stack;
|
||||
GDScriptFunction *function;
|
||||
GDScriptInstance *instance;
|
||||
int *ip;
|
||||
int *line;
|
||||
Variant *stack = nullptr;
|
||||
GDScriptFunction *function = nullptr;
|
||||
GDScriptInstance *instance = nullptr;
|
||||
int *ip = nullptr;
|
||||
int *line = nullptr;
|
||||
};
|
||||
|
||||
int _debug_parse_err_line;
|
||||
|
|
@ -329,7 +329,7 @@ class GDScriptLanguage : public ScriptLanguage {
|
|||
String _debug_error;
|
||||
int _debug_call_stack_pos;
|
||||
int _debug_max_call_stack;
|
||||
CallLevel *_call_stack;
|
||||
CallLevel *_call_stack = nullptr;
|
||||
|
||||
void _add_global(const StringName &p_name, const Variant &p_value);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue