public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Remove tui_alloc_win_info
@ 2019-06-25 14:02 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-06-25 14:02 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c3fabb7d69b3735bc6042a2992729944c8ced62c

commit c3fabb7d69b3735bc6042a2992729944c8ced62c
Author: Tom Tromey <tom@tromey.com>
Date:   Thu Jun 20 15:31:00 2019 -0600

    Remove tui_alloc_win_info
    
    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.

Diff:
---
 gdb/ChangeLog        |  6 ++++++
 gdb/tui/tui-data.c   | 22 ----------------------
 gdb/tui/tui-data.h   |  1 -
 gdb/tui/tui-layout.c | 27 +++++++++++++++++++++++----
 4 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 48cfc36..42308e0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 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.
 	* tui/tui-wingeneral.c (tui_unhighlight_win): Check
 	can_highlight.
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 3d1e0e6..5eac1dc 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -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)
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 02bda6a..a82cbb5 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -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 *, 
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 6507b06..6d34392 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-25 14:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 14:02 [binutils-gdb] Remove tui_alloc_win_info Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).