aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli-out.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2016-12-01 16:05:17 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2016-12-01 16:05:17 -0500
commit33b2fac610fff1255a24763277a4bf77f1b59ef1 (patch)
treec08dc9784a1383b8d9fce71e923462aef9b5fdec /gdb/cli-out.c
parent909c0aa5824080c287b390f82726cf5bfb7011e3 (diff)
downloadgdb-33b2fac610fff1255a24763277a4bf77f1b59ef1.zip
gdb-33b2fac610fff1255a24763277a4bf77f1b59ef1.tar.gz
gdb-33b2fac610fff1255a24763277a4bf77f1b59ef1.tar.bz2
Simplify ui-out level code
Now that we use a vector to store the levels, we don't have to keep a separate level field in ui_out to keep track of the current level. We can efficiently derive it from the vector size. That causes a little change in the meaning of the level, as in they are now 1-based instead of 0-based (the initial level has the "id" 1 now), but it shouldn't change anything in the behavior. Additionally, push_level and pop_level don't really need to return the new level, making them return void simplifies the code a bit. Finally, the ui_out_begin/ui_out_end callbacks in the ui_out_impl interface don't need to be passed the level, it's never actually used. New in v2: - Remove or update stale comments. gdb/ChangeLog: * ui-out.h (ui_out_begin_ftype): Remove level parameter. (ui_out_end_ftype): Likewise. * ui-out.c (struct ui_out) <level>: Replace field with a method that dynamically computes the result. (current_level): Get vector's back item instead of using uiout->level. (push_level): Make return type void. (pop_level): Make return type void and update access to ui_out::level. (uo_begin): Remove level parameter. (uo_end): Likewise. (ui_out_table_begin): Update access to uiout::level. (ui_out_begin): Don't read return value from push_level, call uiout->level() instead, update call to uo_begin. (ui_out_end): Don't read return value from pop_level, update call to uo_end. (verify_field): Update access to uiout->level. (ui_out_new): Don't initialize ui_out::level, call push_level to push the initial level instead of doing it by hand. * cli-out.c (cli_begin): Remove level parameter. (cli_end): Likewise. * mi/mi-out.c (mi_begin): Likewise. (mi_end): Likewise.
Diffstat (limited to 'gdb/cli-out.c')
-rw-r--r--gdb/cli-out.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index 4747f40..ac19e38 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -111,7 +111,6 @@ cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
static void
cli_begin (struct ui_out *uiout,
enum ui_out_type type,
- int level,
const char *id)
{
cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
@@ -124,8 +123,7 @@ cli_begin (struct ui_out *uiout,
static void
cli_end (struct ui_out *uiout,
- enum ui_out_type type,
- int level)
+ enum ui_out_type type)
{
cli_out_data *data = (cli_out_data *) ui_out_data (uiout);