From f6cc34a91c173634b6afcc1a48601a601fbace37 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 28 Jun 2019 22:57:37 -0600 Subject: [PATCH] Remove tui_source_window::content_in_use Now that source window clearing has been simplified, we don't need a special flag to say whether the source window is in use -- we can simply check whether the contents are set. This patch implements this idea, removing the content_in_use field. gdb/ChangeLog 2019-07-17 Tom Tromey * tui/tui-winsource.c (tui_clear_source_content) (tui_show_source_content): Update. * tui/tui-source.c (tui_source_window::showing_source_p): Check whether content is empty. * tui/tui-data.h (struct tui_source_window_base) : Remove. --- gdb/ChangeLog | 9 +++++++++ gdb/tui/tui-data.h | 2 -- gdb/tui/tui-source.c | 2 +- gdb/tui/tui-winsource.c | 2 -- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4b5a8760da9..5ae3e3502f0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2019-07-17 Tom Tromey + + * tui/tui-winsource.c (tui_clear_source_content) + (tui_show_source_content): Update. + * tui/tui-source.c (tui_source_window::showing_source_p): Check + whether content is empty. + * tui/tui-data.h (struct tui_source_window_base) : + Remove. + 2019-07-17 Tom Tromey * tui/tui-winsource.c (tui_erase_source_content): Clear the diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 125b4ae4c5d..0245031c6cd 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -398,8 +398,6 @@ public: LINE_NO in this source window; false otherwise. */ virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0; - /* Can it be used, or is it already used? */ - bool content_in_use = false; /* Does the locator belong to this window? */ bool m_has_locator = false; /* Execution information window. */ diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index d3cce1c3003..f0bac24bfea 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -227,7 +227,7 @@ tui_show_symtab_source (tui_source_window_base *win_info, bool tui_source_window::showing_source_p (const char *fullname) const { - return (content_in_use + return (!content.empty () && (filename_cmp (tui_locator_win_info_ptr ()->full_name, fullname) == 0)); } diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 2be20492f47..39591db2cc9 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -211,7 +211,6 @@ tui_clear_source_content (struct tui_source_window_base *win_info) { int i; - win_info->content_in_use = false; tui_erase_source_content (win_info); for (i = 0; i < win_info->content.size (); i++) { @@ -297,7 +296,6 @@ tui_show_source_content (struct tui_source_window_base *win_info) tui_check_and_display_highlight_if_needed (win_info); win_info->refresh_window (); - win_info->content_in_use = true; } /* See tui-data.h. */ -- 2.30.2