1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

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:
Rémi Verschelde
2022-04-04 15:06:57 +02:00
parent 53317bbe14
commit f8ab79e68a
258 changed files with 2398 additions and 2421 deletions

View File

@@ -386,7 +386,7 @@ public:
return node;
}
Node *nodes;
Node *nodes = nullptr;
struct OperatorNode : public Node {
DataType return_cache = TYPE_VOID;
@@ -615,20 +615,20 @@ public:
DataType type;
StringName type_str;
DataPrecision precision;
ConstantNode *initializer;
ConstantNode *initializer = nullptr;
int array_size;
};
struct Function {
StringName name;
FunctionNode *function;
FunctionNode *function = nullptr;
Set<StringName> uses_function;
bool callable;
};
struct Struct {
StringName name;
StructNode *shader_struct;
StructNode *shader_struct = nullptr;
};
struct Varying {
@@ -715,7 +715,7 @@ public:
bool is_op;
union {
Operator op;
Node *node;
Node *node = nullptr;
};
};
@@ -973,7 +973,7 @@ private:
Token _make_token(TokenType p_type, const StringName &p_text = StringName());
Token _get_token();
ShaderNode *shader;
ShaderNode *shader = nullptr;
enum IdentifierType {
IDENTIFIER_FUNCTION,
@@ -1021,7 +1021,7 @@ private:
CompletionType completion_type;
int completion_line;
BlockNode *completion_block;
BlockNode *completion_block = nullptr;
DataType completion_base;
bool completion_base_array;
SubClassTag completion_class;