diff mbox

[10/15] Remove tui_clear_source_content

Message ID 20190814162132.31424-11-tom@tromey.com
State New
Headers show

Commit Message

Tom Tromey Aug. 14, 2019, 4:21 p.m. UTC
tui_clear_source_content is not needed.  Instead, the callers can call
erase_source_content, which is also changed to clear the content
vector.

2019-08-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_clear_source_content): Don't declare.
	* tui/tui-winsource.c (tui_update_source_window_as_is): Don't call
	tui_clear_source_content.
	(tui_clear_source_content): Remove.
	(tui_source_window_base::do_erase_source_content): Hoist call to
	content.clear().
	* tui/tui-stack.c (tui_show_frame_info): Don't call
	tui_clear_source_content.
---
 gdb/ChangeLog           | 11 +++++++++++
 gdb/tui/tui-stack.c     |  2 +-
 gdb/tui/tui-winsource.c | 25 +++----------------------
 gdb/tui/tui-winsource.h |  1 -
 4 files changed, 15 insertions(+), 24 deletions(-)
diff mbox

Patch

diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 09ee87f4027..f61aa526004 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -411,7 +411,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);
+	  win_info->erase_source_content ();
 	  win_info->update_exec_info ();
 	}
 
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index d955efcd575..95a2ac27094 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -98,7 +98,7 @@  tui_update_source_window_as_is (struct tui_source_window_base *win_info,
     ret = tui_set_disassem_content (win_info, gdbarch, line_or_addr.u.addr);
 
   if (ret == TUI_FAILURE)
-    tui_clear_source_content (win_info);
+    win_info->erase_source_content ();
   else
     {
       tui_update_breakpoint_info (win_info, nullptr, false);
@@ -153,7 +153,7 @@  tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
   else
     {
       for (struct tui_source_window_base *win_info : tui_source_windows ())
-	tui_clear_source_content (win_info);
+	win_info->erase_source_content ();
     }
 }
 
@@ -191,31 +191,13 @@  tui_update_source_windows_with_line (struct symtab *s, int line)
     }
 }
 
-void
-tui_clear_source_content (struct tui_source_window_base *win_info)
-{
-  if (win_info != NULL)
-    {
-      int i;
-
-      win_info->erase_source_content ();
-      for (i = 0; i < win_info->content.size (); i++)
-	{
-	  struct tui_source_element *element = &win_info->content[i];
-
-	  element->break_mode = 0;
-	  element->is_exec_point = false;
-	}
-    }
-}
-
-
 void
 tui_source_window_base::do_erase_source_content (const char *str)
 {
   int x_pos;
   int half_width = (width - 2) / 2;
 
+  content.clear ();
   if (handle != NULL)
     {
       werase (handle);
@@ -230,7 +212,6 @@  tui_source_window_base::do_erase_source_content (const char *str)
 		 x_pos,
 		 (char *) str);
 
-      content.clear ();
       refresh_window ();
 
       werase (execution_info->handle);
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index 60031d3bdb0..b5528011f5a 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -185,7 +185,6 @@  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 *);
 
 /* Constant definitions. */
 #define SCROLL_THRESHOLD 2	/* Threshold for lazy scroll.  */