aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli-out.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2016-11-30 21:41:46 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2016-11-30 21:41:46 -0500
commit5486f16481dffa1c1a0d1fd9e38b97e3678078ed (patch)
tree611960588a1a7b491804f07f3fb10a2597ba45b8 /gdb/cli-out.c
parent5084b13657023904cb60737abdf4cefb539a5fc4 (diff)
Use new/delete instead of malloc/free-based functions
The following patches introduce C++ vectors and strings as fields of the various ui_out structures. We therefore need to use new/delete so that their contructor/destructor is called. I find it simpler to change all the allocations in a separate preliminary patch, rather than in each individual patch. gdb/ChangeLog: * cli-out.c (cli_uiout_dtor): Use delete instead of xfree. (cli_out_new): Use new instead of XNEW. * mi/mi-out.c (mi_out_data_dtor): Use delete instead of xfree. (mi_out_new): Use new instead of XNEW. * tui/tui-out.c (tui_out_new): Likewise. * ui-out.c (push_level): Likewise. (pop_level): Use delete instead of xfree. (clear_header_list): Use delete instead of xfree. (append_header_to_list): Use new instead of XNEW. (ui_out_new): Likewise.
Diffstat (limited to 'gdb/cli-out.c')
-rw-r--r--gdb/cli-out.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index e882756569..b98af4a60f 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -47,7 +47,7 @@ cli_uiout_dtor (struct ui_out *ui_out)
cli_out_data *data = (cli_out_data *) ui_out_data (ui_out);
VEC_free (ui_filep, data->streams);
- xfree (data);
+ delete data;
}
/* These are the CLI output functions */
@@ -395,7 +395,7 @@ struct ui_out *
cli_out_new (struct ui_file *stream)
{
int flags = ui_source_list;
- cli_out_data *data = XNEW (cli_out_data);
+ cli_out_data *data = new cli_out_data ();
cli_out_data_ctor (data, stream);
return ui_out_new (&cli_ui_out_impl, data, flags);