Don't cast a tui_win_info directly to tui_gen_win_info
authorTom Tromey <tom@tromey.com>
Sun, 16 Jun 2019 20:10:25 +0000 (14:10 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 16 Jun 2019 20:10:25 +0000 (14:10 -0600)
I found a few spots that directly cast a tui_win_info to a
tui_gen_win_info.  However, I think it's a bit better here to take the
address of the "generic" member.  As far as I know, nothing relies on
being able to downcast here, so this gives us the freedom to rearrange
the structure.

gdb/ChangeLog
2019-06-16  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win)
(make_all_visible): Use address of member.

gdb/ChangeLog
gdb/tui/tui-wingeneral.c

index f16d84784184bfcd38a83e16e5e503ccb6881d68..cfc8e3d30de46c5a5b3437c89d4e909ae59807af 100644 (file)
@@ -1,3 +1,8 @@
+2019-06-16  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win)
+       (make_all_visible): Use address of member.
+
 2019-06-16  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-data.c (tui_clear_win_detail, init_win_info)
index b474aa0f1d9e7a824bb1575be05da2a43fe3886c..cacc0b844540316e6e8003cc7ca19532a54d90cd 100644 (file)
@@ -112,7 +112,7 @@ tui_unhighlight_win (struct tui_win_info *win_info)
   if (win_info != NULL 
       && win_info->generic.handle != NULL)
     {
-      box_win ((struct tui_gen_win_info *) win_info, NO_HILITE);
+      box_win (&win_info->generic, NO_HILITE);
       wrefresh (win_info->generic.handle);
       tui_set_win_highlight (win_info, 0);
     }
@@ -126,7 +126,7 @@ tui_highlight_win (struct tui_win_info *win_info)
       && win_info->can_highlight
       && win_info->generic.handle != NULL)
     {
-      box_win ((struct tui_gen_win_info *) win_info, HILITE);
+      box_win (&win_info->generic, HILITE);
       wrefresh (win_info->generic.handle);
       tui_set_win_highlight (win_info, 1);
     }
@@ -227,7 +227,7 @@ make_all_visible (int visible)
          if (tui_win_is_source_type ((tui_win_list[i])->generic.type))
            make_visible ((tui_win_list[i])->detail.source_info.execution_info,
                          visible);
-         make_visible ((struct tui_gen_win_info *) tui_win_list[i], visible);
+         make_visible (&tui_win_list[i]->generic, visible);
        }
     }