Change tui_check_and_display_highlight_if_needed to be a method
authorTom Tromey <tom@tromey.com>
Fri, 5 Jul 2019 23:14:46 +0000 (17:14 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 13 Aug 2019 20:52:09 +0000 (14:52 -0600)
This changes tui_check_and_display_highlight_if_needed to be a method
on tui_win_info.  This makes it clear that the NULL check in that
function is not needed, so it is removed here.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c (tui_erase_source_content)
(tui_show_source_content, tui_source_window_base::refresh_all):
Update.
* tui/tui-wingeneral.h
(tui_check_and_display_highlight_if_needed): Don't declare.
* tui/tui-wingeneral.c
(tui_win_info::check_and_display_highlight_if_needed): Rename from
check_and_display_highlight_if_needed.
* tui/tui-win.c (tui_rehighlight_all)
(tui_win_info::make_visible_with_new_height): Update.
* tui/tui-regs.c (tui_data_window::display_registers_from_line)
(tui_data_window::erase_data_content)
(tui_data_window::display_all_data): Update.
* tui/tui-data.h (struct tui_win_info)
<check_and_display_highlight_if_needed>: Declare.

gdb/ChangeLog
gdb/tui/tui-data.h
gdb/tui/tui-regs.c
gdb/tui/tui-win.c
gdb/tui/tui-wingeneral.c
gdb/tui/tui-wingeneral.h
gdb/tui/tui-winsource.c

index 48d3fc5..1c2b0d8 100644 (file)
@@ -1,5 +1,23 @@
 2019-08-13  Tom Tromey  <tom@tromey.com>
 
+       * tui/tui-winsource.c (tui_erase_source_content)
+       (tui_show_source_content, tui_source_window_base::refresh_all):
+       Update.
+       * tui/tui-wingeneral.h
+       (tui_check_and_display_highlight_if_needed): Don't declare.
+       * tui/tui-wingeneral.c
+       (tui_win_info::check_and_display_highlight_if_needed): Rename from
+       check_and_display_highlight_if_needed.
+       * tui/tui-win.c (tui_rehighlight_all)
+       (tui_win_info::make_visible_with_new_height): Update.
+       * tui/tui-regs.c (tui_data_window::display_registers_from_line)
+       (tui_data_window::erase_data_content)
+       (tui_data_window::display_all_data): Update.
+       * tui/tui-data.h (struct tui_win_info)
+       <check_and_display_highlight_if_needed>: Declare.
+
+2019-08-13  Tom Tromey  <tom@tromey.com>
+
        * tui/tui-win.c (tui_resize_all): Call
        tui_delete_invisible_windows.
        * tui/tui-layout.c (show_layout): Call
index d3fa036..6683848 100644 (file)
@@ -291,6 +291,8 @@ public:
     return true;
   }
 
+  void check_and_display_highlight_if_needed ();
+
   /* Can this window ever be highlighted?  */
   bool can_highlight = true;
 
index 2765462..aaba94d 100644 (file)
@@ -369,7 +369,7 @@ tui_data_window::display_reg_element_at_line (int start_element_no,
 int
 tui_data_window::display_registers_from_line (int line_no)
 {
-  tui_check_and_display_highlight_if_needed (this);
+  check_and_display_highlight_if_needed ();
   if (!regs_content.empty ())
     {
       int element_no;
@@ -436,7 +436,7 @@ void
 tui_data_window::erase_data_content (const char *prompt)
 {
   werase (handle);
-  tui_check_and_display_highlight_if_needed (this);
+  check_and_display_highlight_if_needed ();
   if (prompt != NULL)
     {
       int half_width = (width - 2) / 2;
@@ -462,7 +462,7 @@ tui_data_window::display_all_data ()
     {
       erase_data_content (NULL);
       delete_data_content_windows ();
-      tui_check_and_display_highlight_if_needed (this);
+      check_and_display_highlight_if_needed ();
       display_registers_from (0);
     }
 }
index be01c15..ff4f2ee 100644 (file)
@@ -515,7 +515,7 @@ void
 tui_rehighlight_all (void)
 {
   for (tui_win_info *win_info : all_tui_windows ())
-    tui_check_and_display_highlight_if_needed (win_info);
+    win_info->check_and_display_highlight_if_needed ();
 }
 
 /* Resize all the windows based on the terminal size.  This function
@@ -1205,7 +1205,7 @@ void
 tui_win_info::make_visible_with_new_height ()
 {
   make_visible (true);
-  tui_check_and_display_highlight_if_needed (this);
+  check_and_display_highlight_if_needed ();
   do_make_visible_with_new_height ();
 }
 
index 79f93ce..8ff5aa5 100644 (file)
@@ -112,15 +112,14 @@ tui_highlight_win (struct tui_win_info *win_info)
 }
 
 void
-tui_check_and_display_highlight_if_needed (struct tui_win_info *win_info)
+tui_win_info::check_and_display_highlight_if_needed ()
 {
-  if (win_info != NULL && win_info->can_highlight)
+  if (can_highlight)
     {
-      if (win_info->is_highlighted)
-       tui_highlight_win (win_info);
+      if (is_highlighted)
+       tui_highlight_win (this);
       else
-       tui_unhighlight_win (win_info);
-
+       tui_unhighlight_win (this);
     }
 }
 
index 051be6d..54d6eb6 100644 (file)
@@ -33,7 +33,6 @@ extern void tui_make_all_invisible (void);
 extern void tui_unhighlight_win (struct tui_win_info *);
 extern void tui_make_window (struct tui_gen_win_info *, enum tui_box);
 extern void tui_highlight_win (struct tui_win_info *);
-extern void tui_check_and_display_highlight_if_needed (struct tui_win_info *);
 extern void tui_refresh_all ();
 extern void tui_delete_win (WINDOW *window);
 
index 3de2692..6a72c6f 100644 (file)
@@ -225,7 +225,7 @@ tui_erase_source_content (struct tui_source_window_base *win_info)
   if (win_info->handle != NULL)
     {
       werase (win_info->handle);
-      tui_check_and_display_highlight_if_needed (win_info);
+      win_info->check_and_display_highlight_if_needed ();
 
       const char *no_src_str;
 
@@ -287,7 +287,7 @@ tui_show_source_content (struct tui_source_window_base *win_info)
   else
     tui_erase_source_content (win_info);
 
-  tui_check_and_display_highlight_if_needed (win_info);
+  win_info->check_and_display_highlight_if_needed ();
   win_info->refresh_window ();
 }
 
@@ -333,7 +333,7 @@ void
 tui_source_window_base::refresh_all ()
 {
   tui_show_source_content (this);
-  tui_check_and_display_highlight_if_needed (this);
+  check_and_display_highlight_if_needed ();
   tui_erase_exec_info_content (this);
   tui_update_exec_info (this);
 }