forked from Imagelibrary/binutils-gdb
Use member initialization in 'struct ui'
This changes 'struct ui' to use member initialization. This is simpler to understand.
This commit is contained in:
13
gdb/top.c
13
gdb/top.c
@@ -295,26 +295,17 @@ unbuffer_stream (FILE *stream)
|
|||||||
/* See top.h. */
|
/* See top.h. */
|
||||||
|
|
||||||
ui::ui (FILE *instream_, FILE *outstream_, FILE *errstream_)
|
ui::ui (FILE *instream_, FILE *outstream_, FILE *errstream_)
|
||||||
: next (nullptr),
|
: num (++highest_ui_num),
|
||||||
num (++highest_ui_num),
|
|
||||||
call_readline (nullptr),
|
|
||||||
input_handler (nullptr),
|
|
||||||
command_editing (0),
|
|
||||||
interp_info (nullptr),
|
|
||||||
async (0),
|
|
||||||
secondary_prompt_depth (0),
|
|
||||||
stdin_stream (instream_),
|
stdin_stream (instream_),
|
||||||
instream (instream_),
|
instream (instream_),
|
||||||
outstream (outstream_),
|
outstream (outstream_),
|
||||||
errstream (errstream_),
|
errstream (errstream_),
|
||||||
input_fd (fileno (instream)),
|
input_fd (fileno (instream)),
|
||||||
m_input_interactive_p (ISATTY (instream)),
|
m_input_interactive_p (ISATTY (instream)),
|
||||||
prompt_state (PROMPT_NEEDED),
|
|
||||||
m_gdb_stdout (new pager_file (new stdio_file (outstream))),
|
m_gdb_stdout (new pager_file (new stdio_file (outstream))),
|
||||||
m_gdb_stdin (new stdio_file (instream)),
|
m_gdb_stdin (new stdio_file (instream)),
|
||||||
m_gdb_stderr (new stderr_file (errstream)),
|
m_gdb_stderr (new stderr_file (errstream)),
|
||||||
m_gdb_stdlog (m_gdb_stderr),
|
m_gdb_stdlog (m_gdb_stderr)
|
||||||
m_current_uiout (nullptr)
|
|
||||||
{
|
{
|
||||||
buffer_init (&line_buffer);
|
buffer_init (&line_buffer);
|
||||||
|
|
||||||
|
|||||||
18
gdb/top.h
18
gdb/top.h
@@ -61,7 +61,7 @@ struct ui
|
|||||||
DISABLE_COPY_AND_ASSIGN (ui);
|
DISABLE_COPY_AND_ASSIGN (ui);
|
||||||
|
|
||||||
/* Pointer to next in singly-linked list. */
|
/* Pointer to next in singly-linked list. */
|
||||||
struct ui *next;
|
struct ui *next = nullptr;
|
||||||
|
|
||||||
/* Convenient handle (UI number). Unique across all UIs. */
|
/* Convenient handle (UI number). Unique across all UIs. */
|
||||||
int num;
|
int num;
|
||||||
@@ -76,19 +76,19 @@ struct ui
|
|||||||
point of invocation. In the special case in which the character
|
point of invocation. In the special case in which the character
|
||||||
read is newline, the function invokes the INPUT_HANDLER callback
|
read is newline, the function invokes the INPUT_HANDLER callback
|
||||||
(see below). */
|
(see below). */
|
||||||
void (*call_readline) (gdb_client_data);
|
void (*call_readline) (gdb_client_data) = nullptr;
|
||||||
|
|
||||||
/* The function to invoke when a complete line of input is ready for
|
/* The function to invoke when a complete line of input is ready for
|
||||||
processing. */
|
processing. */
|
||||||
void (*input_handler) (gdb::unique_xmalloc_ptr<char> &&);
|
void (*input_handler) (gdb::unique_xmalloc_ptr<char> &&) = nullptr;
|
||||||
|
|
||||||
/* True if this UI is using the readline library for command
|
/* True if this UI is using the readline library for command
|
||||||
editing; false if using GDB's own simple readline emulation, with
|
editing; false if using GDB's own simple readline emulation, with
|
||||||
no editing support. */
|
no editing support. */
|
||||||
int command_editing;
|
int command_editing = 0;
|
||||||
|
|
||||||
/* Each UI has its own independent set of interpreters. */
|
/* Each UI has its own independent set of interpreters. */
|
||||||
struct ui_interp_info *interp_info;
|
struct ui_interp_info *interp_info = nullptr;
|
||||||
|
|
||||||
/* True if the UI is in async mode, false if in sync mode. If in
|
/* True if the UI is in async mode, false if in sync mode. If in
|
||||||
sync mode, a synchronous execution command (e.g, "next") does not
|
sync mode, a synchronous execution command (e.g, "next") does not
|
||||||
@@ -98,11 +98,11 @@ struct ui
|
|||||||
the top event loop. For the main UI, this starts out disabled,
|
the top event loop. For the main UI, this starts out disabled,
|
||||||
until all the explicit command line arguments (e.g., `gdb -ex
|
until all the explicit command line arguments (e.g., `gdb -ex
|
||||||
"start" -ex "next"') are processed. */
|
"start" -ex "next"') are processed. */
|
||||||
int async;
|
int async = 0;
|
||||||
|
|
||||||
/* The number of nested readline secondary prompts that are
|
/* The number of nested readline secondary prompts that are
|
||||||
currently active. */
|
currently active. */
|
||||||
int secondary_prompt_depth;
|
int secondary_prompt_depth = 0;
|
||||||
|
|
||||||
/* The UI's stdin. Set to stdin for the main UI. */
|
/* The UI's stdin. Set to stdin for the main UI. */
|
||||||
FILE *stdin_stream;
|
FILE *stdin_stream;
|
||||||
@@ -128,7 +128,7 @@ struct ui
|
|||||||
bool m_input_interactive_p;
|
bool m_input_interactive_p;
|
||||||
|
|
||||||
/* See enum prompt_state's description. */
|
/* See enum prompt_state's description. */
|
||||||
enum prompt_state prompt_state;
|
enum prompt_state prompt_state = PROMPT_NEEDED;
|
||||||
|
|
||||||
/* The fields below that start with "m_" are "private". They're
|
/* The fields below that start with "m_" are "private". They're
|
||||||
meant to be accessed through wrapper macros that make them look
|
meant to be accessed through wrapper macros that make them look
|
||||||
@@ -146,7 +146,7 @@ struct ui
|
|||||||
struct ui_file *m_gdb_stdlog;
|
struct ui_file *m_gdb_stdlog;
|
||||||
|
|
||||||
/* The current ui_out. */
|
/* The current ui_out. */
|
||||||
struct ui_out *m_current_uiout;
|
struct ui_out *m_current_uiout = nullptr;
|
||||||
|
|
||||||
/* Register the UI's input file descriptor in the event loop. */
|
/* Register the UI's input file descriptor in the event loop. */
|
||||||
void register_file_handler ();
|
void register_file_handler ();
|
||||||
|
|||||||
Reference in New Issue
Block a user