[09/14] Simplify tui_data_win::erase_data_content

Message ID 20231217-tui-regs-cleanup-v1-9-67bd0ea1e8be@tromey.com
State New
Headers
Series Cleanups for the TUi register window |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Tom Tromey Dec. 17, 2023, 7:50 p.m. UTC
  There's only a single call to tui_data_win::erase_data_content now, so
remove the parameter and make it just render the "empty window" text.
---
 gdb/tui/tui-regs.c | 22 ++++++++++------------
 gdb/tui/tui-regs.h |  2 +-
 2 files changed, 11 insertions(+), 13 deletions(-)
  

Patch

diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 5726dc3fea8..bf752c267ff 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -348,21 +348,19 @@  tui_data_window::first_data_item_displayed ()
 }
 
 void
-tui_data_window::erase_data_content (const char *prompt)
+tui_data_window::erase_data_content ()
 {
   werase (handle.get ());
   check_and_display_highlight_if_needed ();
-  if (prompt != NULL)
-    {
-      int half_width = (width - box_size ()) / 2;
-      int x_pos;
 
-      if (strlen (prompt) >= half_width)
-	x_pos = 1;
-      else
-	x_pos = half_width - strlen (prompt);
-      display_string (height / 2, x_pos, prompt);
-    }
+  const char *prompt = _("[ Register Values Unavailable ]");
+  int half_width = (width - box_size ()) / 2;
+  int x_pos;
+  if (strlen (prompt) >= half_width)
+    x_pos = 1;
+  else
+    x_pos = half_width - strlen (prompt);
+  display_string (height / 2, x_pos, prompt);
 }
 
 /* See tui-regs.h.  */
@@ -371,7 +369,7 @@  void
 tui_data_window::rerender ()
 {
   if (m_regs_content.empty ())
-    erase_data_content (_("[ Register Values Unavailable ]"));
+    erase_data_content ();
   else
     display_registers_from (0);
   tui_wrefresh (handle.get ());
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index b31a5a3e5b8..29518a6f714 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -128,7 +128,7 @@  struct tui_data_window : public tui_win_info
      done when the data window is scrolled.  */
   void delete_data_content_windows ();
 
-  void erase_data_content (const char *prompt);
+  void erase_data_content ();
 
   /* Information about each register in the current register group.  */
   std::vector<tui_register_info> m_regs_content;