Remove tui_alloc_win_info
authorTom Tromey <tom@tromey.com>
Thu, 20 Jun 2019 21:31:00 +0000 (15:31 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 25 Jun 2019 13:48:44 +0000 (07:48 -0600)
There is only a single caller of tui_alloc_win_info, and we're going
to add more "new" cases to that caller, so remove tui_alloc_win_info
and inline it into init_and_make_win.

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

* tui/tui-data.h (tui_alloc_win_info): Don't declare.
* tui/tui-layout.c (init_and_make_win): Use "new" directly.
* tui/tui-data.c (tui_alloc_win_info): Remove.

gdb/ChangeLog
gdb/tui/tui-data.c
gdb/tui/tui-data.h
gdb/tui/tui-layout.c

index 48cfc36a46972f94e69f9204c2ac75c6258d9ea3..42308e055dfebfa943bb224d43b20a70e0cae58d 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-25  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-data.h (tui_alloc_win_info): Don't declare.
+       * tui/tui-layout.c (init_and_make_win): Use "new" directly.
+       * tui/tui-data.c (tui_alloc_win_info): Remove.
+
 2019-06-25  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-win.c (tui_set_win_focus_to): Don't check window type.
index 3d1e0e6ff0e642ac4872e4de7e620dfbf830bbe2..5eac1dcdc864bf19e5338ff212f0b3bd8131b000 100644 (file)
@@ -419,28 +419,6 @@ tui_source_window_base::tui_source_window_base (enum tui_win_type type)
   start_line_or_addr.u.addr = 0;
 }
 
-struct tui_win_info *
-tui_alloc_win_info (enum tui_win_type type)
-{
-  switch (type)
-    {
-    case SRC_WIN:
-      return new tui_source_window ();
-
-    case DISASSEM_WIN:
-      return new tui_disasm_window ();
-
-    case DATA_WIN:
-      return new tui_data_window ();
-
-    case CMD_WIN:
-      return new tui_cmd_window ();
-    }
-
-  gdb_assert_not_reached (_("Unhandled window type"));
-}
-
-
 /* Allocates the content and elements in a block.  */
 tui_win_content
 tui_alloc_content (int num_elements, enum tui_win_type type)
index 02bda6af45c34e7e416fd2efb37135b567c29400..a82cbb57e4dfbc484a04c31084a17082db19c3d2 100644 (file)
@@ -531,7 +531,6 @@ extern struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
 
 /* Data Manipulation Functions.  */
 extern void tui_initialize_static_data (void);
-extern struct tui_win_info *tui_alloc_win_info (enum tui_win_type);
 extern void tui_init_generic_part (struct tui_gen_win_info *);
 extern tui_win_content tui_alloc_content (int, enum tui_win_type);
 extern int tui_add_content_elements (struct tui_gen_win_info *, 
index 6507b06dd39230c4eefb06c8bb0ee7da36073b61..6d343921d4c4807fb6f2d23cde2b4fde134f4986 100644 (file)
@@ -798,10 +798,29 @@ init_and_make_win (tui_gen_win_info *win_info,
 {
   if (win_info == NULL)
     {
-      if (tui_win_is_auxillary (win_type))
-       win_info = new tui_gen_win_info (win_type);
-      else
-       win_info = tui_alloc_win_info (win_type);
+      switch (win_type)
+       {
+       case SRC_WIN:
+         win_info = new tui_source_window ();
+         break;
+
+       case DISASSEM_WIN:
+         win_info = new tui_disasm_window ();
+         break;
+
+       case DATA_WIN:
+         win_info = new tui_data_window ();
+         break;
+
+       case CMD_WIN:
+         win_info = new tui_cmd_window ();
+         break;
+
+       default:
+         gdb_assert (tui_win_is_auxillary (win_type));
+         win_info = new tui_gen_win_info (win_type);
+         break;
+       }
     }
 
   win_info->reset (win_type, height, width, origin_x, origin_y);