Simplify tui_source_window_base::show_source_content
authorTom Tromey <tom@tromey.com>
Tue, 23 Jul 2019 23:16:56 +0000 (17:16 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 20 Sep 2019 19:49:06 +0000 (13:49 -0600)
tui_source_window_base::show_source_content is not used outside the
class any more, so this makes it private.  Examining the callers shows
that it can't be called without source contents, so it can be
simplified as well.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (struct tui_source_window_base)
<show_source_content>: Now private.
* tui/tui-winsource.c
(tui_source_window_base::show_source_content): Don't handle empty
content case.

gdb/ChangeLog
gdb/tui/tui-winsource.c
gdb/tui/tui-winsource.h

index 7e4fa87c90d513be3e38495e0e33f806be467c15..b634e526229bafb0b60735f6454643f78bd80d6c 100644 (file)
@@ -1,3 +1,11 @@
+2019-09-20  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-winsource.h (struct tui_source_window_base)
+       <show_source_content>: Now private.
+       * tui/tui-winsource.c
+       (tui_source_window_base::show_source_content): Don't handle empty
+       content case.
+
 2019-09-20  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-layout.c (show_source_disasm_command)
index 8b507ed91264fcf7fd8ce567ebc168320bc0cfd9..683856de817f09dc9b2c45a6a04a0b447ae03a8e 100644 (file)
@@ -238,15 +238,10 @@ tui_show_source_line (struct tui_source_window_base *win_info, int lineno)
 void
 tui_source_window_base::show_source_content ()
 {
-  if (!content.empty ())
-    {
-      int lineno;
+  gdb_assert (!content.empty ());
 
-      for (lineno = 1; lineno <= content.size (); lineno++)
-        tui_show_source_line (this, lineno);
-    }
-  else
-    erase_source_content ();
+  for (int lineno = 1; lineno <= content.size (); lineno++)
+    tui_show_source_line (this, lineno);
 
   check_and_display_highlight_if_needed ();
   refresh_window ();
index eca0bde4bb8c13c5c78c74202879fe8f84e0bffc..a66c63597e760f06cce96a6f3f3a9e07552d86d8 100644 (file)
@@ -76,6 +76,9 @@ struct tui_source_element
 
 struct tui_source_window_base : public tui_win_info
 {
+private:
+  void show_source_content ();
+
 protected:
   explicit tui_source_window_base (enum tui_win_type type);
 
@@ -106,8 +109,6 @@ public:
 
   virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0;
 
-  void show_source_content ();
-
   void update_exec_info ();
 
   /* Update the window to display the given location.  Does nothing if
This page took 0.031774 seconds and 4 git commands to generate.