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

@ -43,10 +43,10 @@
class GotoLineDialog : public ConfirmationDialog {
GDCLASS(GotoLineDialog, ConfirmationDialog);
Label *line_label;
LineEdit *line;
Label *line_label = nullptr;
LineEdit *line = nullptr;
CodeEdit *text_editor;
CodeEdit *text_editor = nullptr;
virtual void ok_pressed() override;
@ -62,25 +62,25 @@ class CodeTextEditor;
class FindReplaceBar : public HBoxContainer {
GDCLASS(FindReplaceBar, HBoxContainer);
LineEdit *search_text;
Label *matches_label;
Button *find_prev;
Button *find_next;
CheckBox *case_sensitive;
CheckBox *whole_words;
TextureButton *hide_button;
LineEdit *search_text = nullptr;
Label *matches_label = nullptr;
Button *find_prev = nullptr;
Button *find_next = nullptr;
CheckBox *case_sensitive = nullptr;
CheckBox *whole_words = nullptr;
TextureButton *hide_button = nullptr;
LineEdit *replace_text;
Button *replace;
Button *replace_all;
CheckBox *selection_only;
LineEdit *replace_text = nullptr;
Button *replace = nullptr;
Button *replace_all = nullptr;
CheckBox *selection_only = nullptr;
VBoxContainer *vbc_lineedit;
HBoxContainer *hbc_button_replace;
HBoxContainer *hbc_option_replace;
VBoxContainer *vbc_lineedit = nullptr;
HBoxContainer *hbc_button_replace = nullptr;
HBoxContainer *hbc_option_replace = nullptr;
CodeTextEditor *base_text_editor = nullptr;
CodeEdit *text_editor;
CodeEdit *text_editor = nullptr;
int result_line;
int result_col;
@ -139,25 +139,25 @@ typedef void (*CodeTextEditorCodeCompleteFunc)(void *p_ud, const String &p_code,
class CodeTextEditor : public VBoxContainer {
GDCLASS(CodeTextEditor, VBoxContainer);
CodeEdit *text_editor;
CodeEdit *text_editor = nullptr;
FindReplaceBar *find_replace_bar = nullptr;
HBoxContainer *status_bar;
HBoxContainer *status_bar = nullptr;
Button *toggle_scripts_button;
Button *error_button;
Button *warning_button;
Button *toggle_scripts_button = nullptr;
Button *error_button = nullptr;
Button *warning_button = nullptr;
Label *line_and_col_txt;
Label *line_and_col_txt = nullptr;
Label *info;
Timer *idle;
Timer *code_complete_timer;
Label *info = nullptr;
Timer *idle = nullptr;
Timer *code_complete_timer = nullptr;
Timer *font_resize_timer;
Timer *font_resize_timer = nullptr;
int font_resize_val;
real_t font_size;
Label *error;
Label *error = nullptr;
int error_line;
int error_column;
@ -181,7 +181,7 @@ class CodeTextEditor : public VBoxContainer {
Color completion_string_color;
Color completion_comment_color;
CodeTextEditorCodeCompleteFunc code_complete_func;
void *code_complete_ud;
void *code_complete_ud = nullptr;
void _error_button_pressed();
void _warning_button_pressed();