[09/61] Remove tui_display_data_from_line

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

Commit Message

Tom Tromey July 4, 2019, 5:02 p.m.
tui_display_data_from_line is just a wrapper for
tui_display_registers_from_line, so remove it.  Also, nothing passed 0
as the "force_display" parameter to tui_display_registers_from_line,
so remove that parameter as well.

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

	* tui/tui-windata.h (tui_display_data_from_line): Don't declare.
	* tui/tui-windata.c (tui_display_data_from_line): Remove.
	(tui_display_data_from, tui_data_window::do_scroll_vertical): Call
	tui_display_registers_from_line.
	* tui/tui-regs.h (tui_display_registers_from_line): Update.
	* tui/tui-regs.c (tui_display_registers_from_line): Remove
	"force_display" parameter.
---
 gdb/ChangeLog         | 10 ++++++++++
 gdb/tui/tui-regs.c    | 30 +++++++++++++-----------------
 gdb/tui/tui-regs.h    |  2 +-
 gdb/tui/tui-windata.c | 20 ++------------------
 gdb/tui/tui-windata.h |  1 -
 5 files changed, 26 insertions(+), 37 deletions(-)

-- 
2.17.2

Patch

diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index d005fe36c23..ae38d343822 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -372,38 +372,34 @@  tui_display_reg_element_at_line (int start_element_no,
    data window.  Answers the line number that the display actually
    started from.  If nothing is displayed (-1) is returned.  */
 int
-tui_display_registers_from_line (int line_no, 
-				 int force_display)
+tui_display_registers_from_line (int line_no)
 {
+  tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
   if (!TUI_DATA_WIN->regs_content.empty ())
     {
-      int line, element_no;
+      int element_no;
 
       if (line_no < 0)
-	line = 0;
-      else if (force_display)
-	{ /* If we must display regs (force_display is true), then
-	     make sure that we don't display off the end of the
+	line_no = 0;
+      else
+	{
+	  /* Make sure that we don't display off the end of the
 	     registers.  */
 	  if (line_no >= TUI_DATA_WIN->last_regs_line_no ())
 	    {
-	      if ((line = TUI_DATA_WIN->line_from_reg_element_no (
+	      if ((line_no = TUI_DATA_WIN->line_from_reg_element_no (
 		 TUI_DATA_WIN->regs_content.size () - 1)) < 0)
-		line = 0;
+		line_no = 0;
 	    }
-	  else
-	    line = line_no;
 	}
-      else
-	line = line_no;
 
-      element_no = TUI_DATA_WIN->first_reg_element_no_inline (line);
+      element_no = TUI_DATA_WIN->first_reg_element_no_inline (line_no);
       if (element_no < TUI_DATA_WIN->regs_content.size ())
-	tui_display_reg_element_at_line (element_no, line);
+	tui_display_reg_element_at_line (element_no, line_no);
       else
-	line = (-1);
+	line_no = (-1);
 
-      return line;
+      return line_no;
     }
 
   return (-1);			/* Nothing was displayed.  */
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index 866af458e10..c1054696493 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -27,7 +27,7 @@ 
 extern void tui_check_register_values (struct frame_info *);
 extern void tui_show_registers (struct reggroup *group);
 extern void tui_display_registers_from (int);
-extern int tui_display_registers_from_line (int, int);
+extern int tui_display_registers_from_line (int);
 extern int tui_first_reg_element_inline (int);
 
 #endif /* TUI_TUI_REGS_H */
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index ac3e6d6e097..4f18d73aec2 100644
--- a/gdb/tui/tui-windata.c
+++ b/gdb/tui/tui-windata.c
@@ -111,22 +111,6 @@  tui_display_all_data (void)
 }
 
 
-/* Function to display the data starting at line, line_no, in the data
-   window.  */
-void
-tui_display_data_from_line (int line_no)
-{
-  int _line_no = line_no;
-
-  if (line_no < 0)
-    _line_no = 0;
-
-  tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
-
-  tui_display_registers_from_line (_line_no, TRUE);
-}
-
-
 /* Display data starting at element element_no.  */
 void
 tui_display_data_from (int element_no, int reuse_windows)
@@ -144,7 +128,7 @@  tui_display_data_from (int element_no, int reuse_windows)
       tui_erase_data_content (NULL);
       if (!reuse_windows)
 	tui_delete_data_content_windows ();
-      tui_display_data_from_line (first_line);
+      tui_display_registers_from_line (first_line);
     }
 }
 
@@ -184,7 +168,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 ();
-      tui_display_data_from_line (first_line);
+      tui_display_registers_from_line (first_line);
     }
 }
 
diff --git a/gdb/tui/tui-windata.h b/gdb/tui/tui-windata.h
index 1aba67520ec..fd8e6257da7 100644
--- a/gdb/tui/tui-windata.h
+++ b/gdb/tui/tui-windata.h
@@ -26,7 +26,6 @@ 
 
 extern void tui_erase_data_content (const char *);
 extern void tui_display_all_data (void);
-extern void tui_display_data_from_line (int);
 extern void tui_delete_data_content_windows (void);
 extern void tui_refresh_data_win (void);
 extern void tui_display_data_from (int, int);