Simplify tui_gen_win_info::make_visible
authorTom Tromey <tom@tromey.com>
Mon, 1 Jul 2019 05:30:28 +0000 (23:30 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 17 Jul 2019 18:19:16 +0000 (12:19 -0600)
I noticed that tui_gen_win_info::make_visible was much wordier than it
needed to be.  This simplifies it.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_gen_win_info::make_visible):
Simplify.

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

index be9bce1dc5e98ed9dc84c3fdd5d2aad2f2b0ced7..0de9c33e362ea446cccc23c800319f501e2c9f9b 100644 (file)
@@ -1,3 +1,8 @@
+2019-07-17  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-wingeneral.c (tui_gen_win_info::make_visible):
+       Simplify.
+
 2019-07-17  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-layout.c (show_source_disasm_command): Simplify window
index 3dca621b8876ae20b796c74bb33b5f646e851283..4e6637e86876af6c35a68ea3300e833fce69e85c 100644 (file)
@@ -165,20 +165,15 @@ tui_make_window (struct tui_gen_win_info *win_info, enum tui_box box_it)
 void
 tui_gen_win_info::make_visible (bool visible)
 {
+  if (is_visible == visible)
+    return;
+  is_visible = visible;
+
   if (visible)
+    tui_make_window (this, (tui_win_is_auxiliary (type)
+                           ? DONT_BOX_WINDOW : BOX_WINDOW));
+  else
     {
-      if (!is_visible)
-       {
-         tui_make_window (this, (tui_win_is_auxiliary (type)
-                                 ? DONT_BOX_WINDOW : BOX_WINDOW));
-         is_visible = true;
-       }
-    }
-  else if (!visible
-          && is_visible
-          && handle != NULL)
-    {
-      is_visible = false;
       tui_delete_win (handle);
       handle = NULL;
     }