diff options
author | Tom Tromey <tom@tromey.com> | 2019-12-30 09:07:33 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-12-30 09:07:33 -0700 |
commit | 87d557ae1b944a21c86e3148daadeb4469b8cda9 (patch) | |
tree | 7826816491a02cdcd44992e18a0c279d9355d8c9 | |
parent | a7ac9aa525de25d3bc6e7bfd37615092a4f94055 (diff) | |
download | gdb-87d557ae1b944a21c86e3148daadeb4469b8cda9.zip gdb-87d557ae1b944a21c86e3148daadeb4469b8cda9.tar.gz gdb-87d557ae1b944a21c86e3148daadeb4469b8cda9.tar.bz2 |
Use "bool" in more spots in TUI
This changes a few spots in the TUI to use "bool" rather than "int".
Tested on x86-64 Fedora 28.
gdb/ChangeLog
2019-12-30 Tom Tromey <tom@tromey.com>
* tui/tui-interp.c (tui_start_enabled): Now bool.
(_initialize_tui_interp): Update.
* tui/tui-hooks.c (tui_refreshing_registers): Now bool.
(tui_register_changed)
(tui_refresh_frame_and_register_information): Update.
* tui/tui-win.c (tui_update_variables): Return bool.
* tui/tui-win.h (tui_update_variables): Return bool.
* tui/tui.c (tui_get_command_dimension): Return bool.
* tui/tui.h (tui_get_command_dimension): Return bool.
Change-Id: I55b7f2d62d2ef88da3587dc914ada9f463ad8d2b
-rw-r--r-- | gdb/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/tui/tui-hooks.c | 12 | ||||
-rw-r--r-- | gdb/tui/tui-interp.c | 6 | ||||
-rw-r--r-- | gdb/tui/tui-win.c | 12 | ||||
-rw-r--r-- | gdb/tui/tui-win.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui.c | 8 | ||||
-rw-r--r-- | gdb/tui/tui.h | 4 |
7 files changed, 33 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 54565ef..4ccf45e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2019-12-30 Tom Tromey <tom@tromey.com> + + * tui/tui-interp.c (tui_start_enabled): Now bool. + (_initialize_tui_interp): Update. + * tui/tui-hooks.c (tui_refreshing_registers): Now bool. + (tui_register_changed) + (tui_refresh_frame_and_register_information): Update. + * tui/tui-win.c (tui_update_variables): Return bool. + * tui/tui-win.h (tui_update_variables): Return bool. + * tui/tui.c (tui_get_command_dimension): Return bool. + * tui/tui.h (tui_get_command_dimension): Return bool. + 2019-12-29 Bernd Edlinger <bernd.edlinger@hotmail.de> * buildsym.c (buildsym_compunit::record_line): Do no longer ignore diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index 8576bb8..b92abb9 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -57,7 +57,7 @@ tui_new_objfile_hook (struct objfile* objfile) } /* Prevent recursion of deprecated_register_changed_hook(). */ -static int tui_refreshing_registers = 0; +static bool tui_refreshing_registers = false; /* Observer for the register_changed notification. */ @@ -75,11 +75,11 @@ tui_register_changed (struct frame_info *frame, int regno) up in the other. So we always use the selected frame here, and ignore FRAME. */ fi = get_selected_frame (NULL); - if (tui_refreshing_registers == 0) + if (!tui_refreshing_registers) { - tui_refreshing_registers = 1; + tui_refreshing_registers = true; TUI_DATA_WIN->check_register_values (fi); - tui_refreshing_registers = 0; + tui_refreshing_registers = false; } } @@ -139,9 +139,9 @@ tui_refresh_frame_and_register_information () if (tui_is_window_visible (DATA_WIN) && (frame_info_changed_p || from_stack)) { - tui_refreshing_registers = 1; + tui_refreshing_registers = true; TUI_DATA_WIN->check_register_values (fi); - tui_refreshing_registers = 0; + tui_refreshing_registers = false; } } else if (!from_stack) diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c index bc8fde3..01edbd0 100644 --- a/gdb/tui/tui-interp.c +++ b/gdb/tui/tui-interp.c @@ -35,9 +35,9 @@ #include "inferior.h" #include "main.h" -/* Set to 1 when the TUI mode must be activated when we first start +/* Set to true when the TUI mode must be activated when we first start gdb. */ -static int tui_start_enabled = 0; +static bool tui_start_enabled = false; class tui_interp final : public cli_interp_base { @@ -312,7 +312,7 @@ _initialize_tui_interp (void) interp_factory_register (INTERP_TUI, tui_interp_factory); if (interpreter_p && strcmp (interpreter_p, INTERP_TUI) == 0) - tui_start_enabled = 1; + tui_start_enabled = true; if (interpreter_p && strcmp (interpreter_p, INTERP_CONSOLE) == 0) { diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index ac3690a..959b0cd 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -254,23 +254,23 @@ translate (const char *name, struct tui_translate *table) /* Update the tui internal configuration according to gdb settings. Returns 1 if the configuration has changed and the screen should be redrawn. */ -int -tui_update_variables (void) +bool +tui_update_variables () { - int need_redraw = 0; + bool need_redraw = false; struct tui_translate *entry; entry = translate (tui_border_mode, tui_border_mode_translate); if (tui_border_attrs != entry->value) { tui_border_attrs = entry->value; - need_redraw = 1; + need_redraw = true; } entry = translate (tui_active_border_mode, tui_border_mode_translate); if (tui_active_border_attrs != entry->value) { tui_active_border_attrs = entry->value; - need_redraw = 1; + need_redraw = true; } /* If one corner changes, all characters are changed. @@ -280,7 +280,7 @@ tui_update_variables (void) if (tui_border_lrcorner != (chtype) entry->value) { tui_border_lrcorner = (entry->value < 0) ? ACS_LRCORNER : entry->value; - need_redraw = 1; + need_redraw = true; } entry = translate (tui_border_kind, tui_border_kind_translate_llcorner); tui_border_llcorner = (entry->value < 0) ? ACS_LLCORNER : entry->value; diff --git a/gdb/tui/tui-win.h b/gdb/tui/tui-win.h index 1ffe683..789a3e8 100644 --- a/gdb/tui/tui-win.h +++ b/gdb/tui/tui-win.h @@ -44,7 +44,7 @@ extern chtype tui_border_hline; extern int tui_border_attrs; extern int tui_active_border_attrs; -extern int tui_update_variables (void); +extern bool tui_update_variables (); extern void tui_initialize_win (void); diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 6fdfa45..f73ef7d 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -591,18 +591,16 @@ tui_is_window_visible (enum tui_win_type type) return tui_win_list[type]->is_visible (); } -int +bool tui_get_command_dimension (unsigned int *width, unsigned int *height) { if (!tui_active || (TUI_CMD_WIN == NULL)) - { - return 0; - } + return false; *width = TUI_CMD_WIN->width; *height = TUI_CMD_WIN->height; - return 1; + return true; } void diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h index 14f2939..75574e5 100644 --- a/gdb/tui/tui.h +++ b/gdb/tui/tui.h @@ -49,8 +49,8 @@ extern CORE_ADDR tui_get_low_disassembly_address (struct gdbarch *, CORE_ADDR, CORE_ADDR); extern void tui_show_assembly (struct gdbarch *gdbarch, CORE_ADDR addr); extern bool tui_is_window_visible (enum tui_win_type type); -extern int tui_get_command_dimension (unsigned int *width, - unsigned int *height); +extern bool tui_get_command_dimension (unsigned int *width, + unsigned int *height); /* Initialize readline and configure the keymap for the switching key shortcut. */ |