Use new and delete for TUI windows
authorTom Tromey <tom@tromey.com>
Sun, 16 Jun 2019 15:41:06 +0000 (09:41 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 25 Jun 2019 13:48:23 +0000 (07:48 -0600)
This changes tui_win_info to use new and delete, rather than XNEW and
xfree.

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

* tui/tui-data.h (struct tui_win_info): Add constructor.
* tui/tui-data.c (tui_alloc_win_info): Use new.
(tui_free_window): Use delete.

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

index 29c568f5d3c3fec4460cd31acb943e9a6d7f70cc..b4395c013847c9f567309227ec66e002f17100bb 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-25  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-data.h (struct tui_win_info): Add constructor.
+       * tui/tui-data.c (tui_alloc_win_info): Use new.
+       (tui_free_window): Use delete.
+
 2019-06-22  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-windata.h (tui_first_data_element_no_in_line): Don't
index b67cb48c2e671b3810808c2280e5dc9466e27471..117bda3c2004fa2298b61c56e953963a92b5420e 100644 (file)
@@ -531,9 +531,8 @@ init_win_info (struct tui_win_info *win_info)
 struct tui_win_info *
 tui_alloc_win_info (enum tui_win_type type)
 {
-  struct tui_win_info *win_info = XNEW (struct tui_win_info);
+  struct tui_win_info *win_info = new struct tui_win_info (type);
 
-  win_info->generic.type = type;
   init_win_info (win_info);
 
   return win_info;
@@ -654,7 +653,7 @@ tui_free_window (struct tui_win_info *win_info)
     }
   if (win_info->generic.title)
     xfree (win_info->generic.title);
-  xfree (win_info);
+  delete win_info;
 }
 
 
index c696feed2804fbc313d50932194a3f1e229bd542..047ee35d9848e03777b9a1ecd7b41c2794952cfc 100644 (file)
@@ -271,6 +271,13 @@ struct tui_command_info
 /* This defines information about each logical window.  */
 struct tui_win_info
 {
+  explicit tui_win_info (enum tui_win_type type)
+  {
+    generic.type = type;
+  }
+
+  DISABLE_COPY_AND_ASSIGN (tui_win_info);
+
   struct tui_gen_win_info generic;     /* General window information.  */
   union
   {