[27/61] Remove unused parameter from two TUI functions

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

Commit Message

Tom Tromey July 4, 2019, 5:02 p.m.
The "display_prompt" parameter of tui_erase_source_content and
tui_clear_source_content was never passed the NO_EMPTY_SOURCE_PROMPT
value, so remove the parameter.  Once this is done, the
EMPTY_SOURCE_PROMPT and NO_EMPTY_SOURCE_PROMPT defines are unused, so
remove those as well.

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

	* tui/tui-winsource.h (tui_erase_source_content)
	(tui_clear_source_content): Remove "display_prompt" parameter.
	* tui/tui-winsource.c (tui_update_source_window_as_is)
	(tui_update_source_windows_with_addr): Update.
	(tui_clear_source_content): Remove "display_prompt" parameter.
	(tui_erase_source_content): Likewise.  Simplify.
	(tui_show_source_content): Update.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update.
	* tui/tui-stack.c (tui_show_frame_info): Update.
	* tui/tui-data.h (EMPTY_SOURCE_PROMPT, NO_EMPTY_SOURCE_PROMPT):
	Remove defines.
---
 gdb/ChangeLog           | 14 ++++++++++
 gdb/tui/tui-data.h      |  2 --
 gdb/tui/tui-stack.c     |  2 +-
 gdb/tui/tui-win.c       | 11 ++++----
 gdb/tui/tui-winsource.c | 61 ++++++++++++++++++++---------------------
 gdb/tui/tui-winsource.h |  4 +--
 6 files changed, 51 insertions(+), 43 deletions(-)

-- 
2.17.2

Patch

diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 0f62fb69900..96f44479b5e 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -109,8 +109,6 @@  enum tui_box
 #define NO_HILITE               FALSE
 #define WITH_LOCATOR            TRUE
 #define NO_LOCATOR              FALSE
-#define EMPTY_SOURCE_PROMPT     TRUE
-#define NO_EMPTY_SOURCE_PROMPT  FALSE
 #define UNDEFINED_ITEM          -1
 #define MIN_WIN_HEIGHT          3
 #define MIN_CMD_WIN_HEIGHT      3
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index b466b5fe7f8..6acc2277c04 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -444,7 +444,7 @@  tui_show_frame_info (struct frame_info *fi)
       tui_show_locator_content ();
       for (struct tui_source_window_base *win_info : tui_source_windows ())
 	{
-	  tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT);
+	  tui_clear_source_content (win_info);
 	  tui_update_exec_info (win_info);
 	}
 
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 7abb8d1e98f..52f0c51f320 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -610,7 +610,7 @@  tui_resize_all (void)
 	  first_win->make_visible_with_new_height ();
 	  TUI_CMD_WIN->make_visible_with_new_height ();
 	  if (src_win->content.empty ())
-	    tui_erase_source_content (src_win, EMPTY_SOURCE_PROMPT);
+	    tui_erase_source_content (src_win);
 	  break;
 	default:
 	  if (cur_layout == SRC_DISASSEM_COMMAND)
@@ -675,7 +675,7 @@  tui_resize_all (void)
 	  second_win->make_visible_with_new_height ();
 	  TUI_CMD_WIN->make_visible_with_new_height ();
 	  if (src_win->content.empty ())
-	    tui_erase_source_content (src_win, EMPTY_SOURCE_PROMPT);
+	    tui_erase_source_content (src_win);
 	  break;
 	}
       /* Now remove all invisible windows, and their content so that
@@ -1113,8 +1113,7 @@  tui_adjust_win_heights (struct tui_win_info *primary_win_info,
 		  tui_source_window_base *src_base
 		    = (tui_source_window_base *) src_win_info;
 		  if (src_base->content.empty ())
-		    tui_erase_source_content (src_base,
-					      EMPTY_SOURCE_PROMPT);
+		    tui_erase_source_content (src_base);
 		}
 	    }
 	  else
@@ -1221,9 +1220,9 @@  tui_adjust_win_heights (struct tui_win_info *primary_win_info,
 	      second_win->make_visible_with_new_height ();
 	      first_win->make_visible_with_new_height ();
 	      if (src1 != nullptr && src1->content.empty ())
-		tui_erase_source_content (src1, EMPTY_SOURCE_PROMPT);
+		tui_erase_source_content (src1);
 	      if (second_win->content.empty ())
-		tui_erase_source_content (second_win, EMPTY_SOURCE_PROMPT);
+		tui_erase_source_content (second_win);
 	    }
 	}
     }
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index a72ba360185..65aa5164122 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -101,7 +101,7 @@  tui_update_source_window_as_is (struct tui_source_window_base *win_info,
 
   if (ret == TUI_FAILURE)
     {
-      tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT);
+      tui_clear_source_content (win_info);
       tui_clear_exec_info_content (win_info);
     }
   else
@@ -162,7 +162,7 @@  tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
     {
       for (struct tui_source_window_base *win_info : tui_source_windows ())
 	{
-	  tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT);
+	  tui_clear_source_content (win_info);
 	  tui_clear_exec_info_content (win_info);
 	}
     }
@@ -205,15 +205,14 @@  tui_update_source_windows_with_line (struct symtab *s, int line)
 }
 
 void
-tui_clear_source_content (struct tui_source_window_base *win_info,
-			  int display_prompt)
+tui_clear_source_content (struct tui_source_window_base *win_info)
 {
   if (win_info != NULL)
     {
       int i;
 
       win_info->content_in_use = false;
-      tui_erase_source_content (win_info, display_prompt);
+      tui_erase_source_content (win_info);
       for (i = 0; i < win_info->content.size (); i++)
 	{
 	  struct tui_source_element *element = &win_info->content[i];
@@ -226,8 +225,7 @@  tui_clear_source_content (struct tui_source_window_base *win_info,
 
 
 void
-tui_erase_source_content (struct tui_source_window_base *win_info,
-			  int display_prompt)
+tui_erase_source_content (struct tui_source_window_base *win_info)
 {
   int x_pos;
   int half_width = (win_info->width - 2) / 2;
@@ -236,30 +234,29 @@  tui_erase_source_content (struct tui_source_window_base *win_info,
     {
       werase (win_info->handle);
       tui_check_and_display_highlight_if_needed (win_info);
-      if (display_prompt == EMPTY_SOURCE_PROMPT)
-	{
-	  const char *no_src_str;
-
-	  if (win_info->type == SRC_WIN)
-	    no_src_str = NO_SRC_STRING;
-	  else
-	    no_src_str = NO_DISASSEM_STRING;
-	  if (strlen (no_src_str) >= half_width)
-	    x_pos = 1;
-	  else
-	    x_pos = half_width - strlen (no_src_str);
-	  mvwaddstr (win_info->handle,
-		     (win_info->height / 2),
-		     x_pos,
-		     (char *) no_src_str);
-
-	  /* elz: Added this function call to set the real contents of
-	     the window to what is on the screen, so that later calls
-	     to refresh, do display the correct stuff, and not the old
-	     image.  */
-
-	  tui_set_source_content_nil (win_info, no_src_str);
-	}
+
+      const char *no_src_str;
+
+      if (win_info->type == SRC_WIN)
+	no_src_str = NO_SRC_STRING;
+      else
+	no_src_str = NO_DISASSEM_STRING;
+      if (strlen (no_src_str) >= half_width)
+	x_pos = 1;
+      else
+	x_pos = half_width - strlen (no_src_str);
+      mvwaddstr (win_info->handle,
+		 (win_info->height / 2),
+		 x_pos,
+		 (char *) no_src_str);
+
+      /* elz: Added this function call to set the real contents of
+	 the window to what is on the screen, so that later calls
+	 to refresh, do display the correct stuff, and not the old
+	 image.  */
+
+      tui_set_source_content_nil (win_info, no_src_str);
+
       win_info->refresh_window ();
     }
 }
@@ -302,7 +299,7 @@  tui_show_source_content (struct tui_source_window_base *win_info)
         tui_show_source_line (win_info, lineno);
     }
   else
-    tui_erase_source_content (win_info, TRUE);
+    tui_erase_source_content (win_info);
 
   tui_check_and_display_highlight_if_needed (win_info);
   win_info->refresh_window ();
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index c1087f4490a..a4907e6cc4e 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -57,8 +57,8 @@  extern void tui_update_source_window_as_is (struct tui_source_window_base *,
 extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR);
 extern void tui_update_source_windows_with_line (struct symtab *, 
 						 int);
-extern void tui_clear_source_content (struct tui_source_window_base *, int);
-extern void tui_erase_source_content (struct tui_source_window_base *, int);
+extern void tui_clear_source_content (struct tui_source_window_base *);
+extern void tui_erase_source_content (struct tui_source_window_base *);
 extern void tui_show_source_content (struct tui_source_window_base *);
 extern void tui_set_exec_info_content (struct tui_source_window_base *);
 extern void tui_show_exec_info_content (struct tui_source_window_base *);