aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-08-11 11:39:43 +0100
committerAndrew Burgess <aburgess@redhat.com>2023-08-23 09:50:31 +0100
commite200b179ce7d2b03e903a2da1e8d1a6739cdca1c (patch)
treed2d7b7d423dc8442923e5b9e74b15b146ccb158a /gdb
parent0b72cde372f4ac58d3027e94ac48672a5698d80a (diff)
downloadgdb-e200b179ce7d2b03e903a2da1e8d1a6739cdca1c.zip
gdb-e200b179ce7d2b03e903a2da1e8d1a6739cdca1c.tar.gz
gdb-e200b179ce7d2b03e903a2da1e8d1a6739cdca1c.tar.bz2
gdb: have mi_out_new return std::unique_ptr
Have the mi_out_new function return a std::unique_ptr instead of a raw pointer. Update the two uses of mi_out_new. There should be no user visible changes after this commit. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/mi/mi-interp.c2
-rw-r--r--gdb/mi/mi-main.c2
-rw-r--r--gdb/mi/mi-out.c8
-rw-r--r--gdb/mi/mi-out.h2
4 files changed, 7 insertions, 7 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 0e51c88..a7fcf17 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -95,7 +95,7 @@ mi_interp::init (bool top_level)
mi->log = mi->err;
mi->targ = new mi_console_file (mi->raw_stdout, "@", '"');
mi->event_channel = new mi_console_file (mi->raw_stdout, "=", 0);
- mi->mi_uiout = mi_out_new (name ());
+ mi->mi_uiout = mi_out_new (name ()).release ();
gdb_assert (mi->mi_uiout != nullptr);
mi->cli_uiout = new cli_ui_out (mi->out);
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index b76940e..5a00457 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -2206,7 +2206,7 @@ mi_load_progress (const char *section_name,
which means uiout may not be correct. Fix it for the duration
of this function. */
- std::unique_ptr<ui_out> uiout (mi_out_new (current_interpreter ()->name ()));
+ auto uiout = mi_out_new (current_interpreter ()->name ());
if (uiout == nullptr)
return;
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 29a416a..bbd2128 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -336,17 +336,17 @@ mi_ui_out::~mi_ui_out ()
/* See mi/mi-out.h. */
-mi_ui_out *
+std::unique_ptr<mi_ui_out>
mi_out_new (const char *mi_version)
{
if (streq (mi_version, INTERP_MI4) || streq (mi_version, INTERP_MI))
- return new mi_ui_out (4);
+ return gdb::make_unique<mi_ui_out> (4);
if (streq (mi_version, INTERP_MI3))
- return new mi_ui_out (3);
+ return gdb::make_unique<mi_ui_out> (3);
if (streq (mi_version, INTERP_MI2))
- return new mi_ui_out (2);
+ return gdb::make_unique<mi_ui_out> (2);
return nullptr;
}
diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h
index 10c9f8a..0dd7479 100644
--- a/gdb/mi/mi-out.h
+++ b/gdb/mi/mi-out.h
@@ -143,7 +143,7 @@ private:
to one of the INTERP_MI* constants (see interps.h).
Return nullptr if an invalid version is provided. */
-mi_ui_out *mi_out_new (const char *mi_version);
+std::unique_ptr<mi_ui_out> mi_out_new (const char *mi_version);
void mi_out_put (ui_out *uiout, struct ui_file *stream);
void mi_out_rewind (ui_out *uiout);