Simplify ui-out level code
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 1 Dec 2016 21:05:17 +0000 (16:05 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Thu, 1 Dec 2016 21:05:17 +0000 (16:05 -0500)
commit33b2fac610fff1255a24763277a4bf77f1b59ef1
treec08dc9784a1383b8d9fce71e923462aef9b5fdec
parent909c0aa5824080c287b390f82726cf5bfb7011e3
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.
gdb/ChangeLog
gdb/cli-out.c
gdb/mi/mi-out.c
gdb/ui-out.c
gdb/ui-out.h
This page took 0.026034 seconds and 4 git commands to generate.