mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 00:59:15 +08:00
gdb/gdbsupport: make xstrprintf and xstrvprintf return a unique_ptr
The motivation is to reduce the number of places where unmanaged pointers are returned from allocation type routines. All of the callers are updated. There should be no user visible changes after this commit.
This commit is contained in:
@ -943,7 +943,6 @@ edit_command (const char *arg, int from_tty)
|
||||
struct symtab_and_line sal;
|
||||
struct symbol *sym;
|
||||
const char *editor;
|
||||
char *p;
|
||||
const char *fn;
|
||||
|
||||
/* Pull in the current default source line if necessary. */
|
||||
@ -1032,9 +1031,9 @@ edit_command (const char *arg, int from_tty)
|
||||
|
||||
/* Quote the file name, in case it has whitespace or other special
|
||||
characters. */
|
||||
p = xstrprintf ("%s +%d \"%s\"", editor, sal.line, fn);
|
||||
shell_escape (p, from_tty);
|
||||
xfree (p);
|
||||
gdb::unique_xmalloc_ptr<char> p
|
||||
= xstrprintf ("%s +%d \"%s\"", editor, sal.line, fn);
|
||||
shell_escape (p.get (), from_tty);
|
||||
}
|
||||
|
||||
/* The options for the "pipe" command. */
|
||||
@ -2730,7 +2729,7 @@ Usage: source [-s] [-v] FILE\n\
|
||||
-v: each command in FILE is echoed as it is executed.\n\
|
||||
\n\
|
||||
Note that the file \"%s\" is read automatically in this way\n\
|
||||
when GDB is started."), GDBINIT);
|
||||
when GDB is started."), GDBINIT).release ();
|
||||
c = add_cmd ("source", class_support, source_command,
|
||||
source_help_text, &cmdlist);
|
||||
set_cmd_completer (c, filename_completer);
|
||||
|
Reference in New Issue
Block a user