]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use std::make_unique with ui_files
authorTom Tromey <tom@tromey.com>
Fri, 16 Jan 2026 16:19:09 +0000 (09:19 -0700)
committerTom Tromey <tom@tromey.com>
Mon, 9 Feb 2026 15:16:00 +0000 (08:16 -0700)
This changes a couple of spots to use std::make_unique rather than
'new'.  This is a bit more idiomatic.  I've only touched code
involving ui_file here, there are plenty more changes like this that
could be made, but I considered those unrelated to this series.

Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/cli/cli-logging.c
gdb/serial.c

index 8d22a62fa02dd1249b0f0e208bb6fd59436e0ad8..836c24445bcd0ab35e52fe460c7c400a2bde0300 100644 (file)
@@ -232,7 +232,7 @@ handle_redirections (int from_tty)
       return;
     }
 
-  stdio_file_up log (new no_terminal_escape_file ());
+  stdio_file_up log = std::make_unique<no_terminal_escape_file> ();
   if (!log->open (logging_filename.c_str (), logging_overwrite ? "w" : "a"))
     perror_with_name (_("set logging"));
 
index c27e37927159679fbb8e28fc7f01d5249745e7e2..f034c1c94ebb95885108587aab479d7df2fe7387 100644 (file)
@@ -238,7 +238,7 @@ serial_open_ops_1 (const struct serial_ops *ops, const char *open_name)
 
   if (!serial_logfile.empty ())
     {
-      stdio_file_up file (new stdio_file ());
+      stdio_file_up file = std::make_unique<stdio_file> ();
 
       if (!file->open (serial_logfile.c_str (), "w"))
        perror_with_name (serial_logfile.c_str ());