[31/61] Remove tui_source_window::content_in_use

Message ID 20190704170311.15982-32-tom@tromey.com
State New
Headers show
Series
  • More TUI refactorings
Related show

Commit Message

Tom Tromey July 4, 2019, 5:02 p.m.
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.

2019-07-04  Tom Tromey  <tom@tromey.com>

	* 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) <content_in_use>:
	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(-)

-- 
2.17.2

Patch

diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 42ac859e542..59c6f72e381 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -396,8 +396,6 @@  public:
 
   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.  */