diff options
author | Andrew Burgess <aburgess@redhat.com> | 2021-11-08 14:58:46 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2021-11-16 17:45:45 +0000 |
commit | 8579fd136a614985bd27f20539c7bb7c5a51287d (patch) | |
tree | fb84850409a44e13e832cbadc9025d40c1d33d9f /gdb/target.c | |
parent | 2bb7589ddf61e163f2e414e7033fad56ea17e784 (diff) | |
download | gdb-8579fd136a614985bd27f20539c7bb7c5a51287d.zip gdb-8579fd136a614985bd27f20539c7bb7c5a51287d.tar.gz gdb-8579fd136a614985bd27f20539c7bb7c5a51287d.tar.bz2 |
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.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/target.c b/gdb/target.c index 6219393..8fe27c7 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -887,15 +887,15 @@ void add_deprecated_target_alias (const target_info &tinfo, const char *alias) { struct cmd_list_element *c; - char *alt; /* If we use add_alias_cmd, here, we do not get the deprecated warning, see PR cli/15104. */ c = add_cmd (alias, no_class, tinfo.doc, &targetlist); c->func = open_target; c->set_context ((void *) &tinfo); - alt = xstrprintf ("target %s", tinfo.shortname); - deprecate_cmd (c, alt); + gdb::unique_xmalloc_ptr<char> alt + = xstrprintf ("target %s", tinfo.shortname); + deprecate_cmd (c, alt.release ()); } /* Stub functions */ |