[13/61] Introduce tui_data_window::delete_data_content_windows method

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

Commit Message

Tom Tromey July 4, 2019, 5:02 p.m.
This changes tui_delete_data_content_windows to be a method on
tui_data_window, removing some uses of the TUI_DATA_WIN global.

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

	* tui/tui-windata.h (tui_delete_data_content_windows): Don't
	declare.
	* tui/tui-windata.c
	(tui_data_window::delete_data_content_windows): Rename from
	tui_delete_data_content_windows.
	(tui_data_window::display_all_data)
	(tui_data_window::do_scroll_vertical): Update.
	* tui/tui-data.h (struct tui_data_window)
	<delete_data_content_windows>: New method.
---
 gdb/ChangeLog         | 12 ++++++++++++
 gdb/tui/tui-data.h    |  4 ++++
 gdb/tui/tui-windata.c |  8 ++++----
 gdb/tui/tui-windata.h |  1 -
 4 files changed, 20 insertions(+), 5 deletions(-)

-- 
2.17.2

Comments

Pedro Alves July 17, 2019, 12:36 p.m. | #1
On 7/4/19 6:02 PM, Tom Tromey wrote:
> @@ -60,9 +60,9 @@ tui_data_window::first_data_item_displayed ()

>  /* Function to delete all the item windows in the data window.  This

>     is usually done when the data window is scrolled.  */

>  void

> -tui_delete_data_content_windows (void)

> +tui_data_window::delete_data_content_windows ()


I noticed that the comment was copied to tui-data.h, and the original
left behind, duplicated.  There are other cases in the patch, but 
I saw this in other patches as well, but I did not think to point
at all of them when I first read through the whole series (and then
came back here).

I'd drop "Function to" in the method's intro comments too, FWIW.

Given the moving-code-around parts later in the series, it might
be simpler to leave things as they are in these intermediate
patches, not sure.

Thanks,
Pedro Alves
Tom Tromey July 17, 2019, 6:26 p.m. | #2
Pedro> I noticed that the comment was copied to tui-data.h, and the original
Pedro> left behind, duplicated.  There are other cases in the patch, but 
Pedro> I saw this in other patches as well, but I did not think to point
Pedro> at all of them when I first read through the whole series (and then
Pedro> came back here).

Pedro> I'd drop "Function to" in the method's intro comments too, FWIW.

Pedro> Given the moving-code-around parts later in the series, it might
Pedro> be simpler to leave things as they are in these intermediate
Pedro> patches, not sure.

I went through the patches and updated them according to the above.

Tom

Patch

diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 5cdd7561e62..9a908115231 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -507,6 +507,10 @@  struct tui_data_window : public tui_win_info
      content.  It does not set the content.  */
   void display_all_data ();
 
+  /* Function to delete all the item windows in the data window.  This
+     is usually done when the data window is scrolled.  */
+  void delete_data_content_windows ();
+
 protected:
 
   void do_scroll_vertical (int num_to_scroll) override;
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index dd2daf19332..02cd6d0b727 100644
--- a/gdb/tui/tui-windata.c
+++ b/gdb/tui/tui-windata.c
@@ -60,9 +60,9 @@  tui_data_window::first_data_item_displayed ()
 /* Function to delete all the item windows in the data window.  This
    is usually done when the data window is scrolled.  */
 void
-tui_delete_data_content_windows (void)
+tui_data_window::delete_data_content_windows ()
 {
-  for (auto &&win : TUI_DATA_WIN->regs_content)
+  for (auto &&win : regs_content)
     {
       tui_delete_win (win->handle);
       win->handle = NULL;
@@ -104,7 +104,7 @@  tui_data_window::display_all_data ()
   else
     {
       tui_erase_data_content (NULL);
-      tui_delete_data_content_windows ();
+      delete_data_content_windows ();
       tui_check_and_display_highlight_if_needed (this);
       tui_display_registers_from (0);
     }
@@ -156,7 +156,7 @@  tui_data_window::do_scroll_vertical (int num_to_scroll)
     {
       first_line += num_to_scroll;
       tui_erase_data_content (NULL);
-      tui_delete_data_content_windows ();
+      delete_data_content_windows ();
       tui_display_registers_from_line (first_line);
     }
 }
diff --git a/gdb/tui/tui-windata.h b/gdb/tui/tui-windata.h
index fce4e6defc9..419b22f3658 100644
--- a/gdb/tui/tui-windata.h
+++ b/gdb/tui/tui-windata.h
@@ -25,6 +25,5 @@ 
 #include "tui/tui-data.h"
 
 extern void tui_erase_data_content (const char *);
-extern void tui_delete_data_content_windows (void);
 
 #endif /* TUI_TUI_WINDATA_H */