aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-abi.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2021-11-08 14:58:46 +0000
committerAndrew Burgess <aburgess@redhat.com>2021-11-16 17:45:45 +0000
commit8579fd136a614985bd27f20539c7bb7c5a51287d (patch)
treefb84850409a44e13e832cbadc9025d40c1d33d9f /gdb/cp-abi.c
parent2bb7589ddf61e163f2e414e7033fad56ea17e784 (diff)
downloadgdb-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/cp-abi.c')
-rw-r--r--gdb/cp-abi.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index f831b2b..f14bf45 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -265,7 +265,6 @@ register_cp_abi (struct cp_abi_ops *abi)
void
set_cp_abi_as_auto_default (const char *short_name)
{
- char *new_longname, *new_doc;
struct cp_abi_ops *abi = find_cp_abi (short_name);
if (abi == NULL)
@@ -279,12 +278,10 @@ set_cp_abi_as_auto_default (const char *short_name)
auto_cp_abi = *abi;
auto_cp_abi.shortname = "auto";
- new_longname = xstrprintf ("currently \"%s\"", abi->shortname);
- auto_cp_abi.longname = new_longname;
-
- new_doc = xstrprintf ("Automatically selected; currently \"%s\"",
- abi->shortname);
- auto_cp_abi.doc = new_doc;
+ auto_cp_abi.longname = xstrprintf ("currently \"%s\"",
+ abi->shortname).release ();
+ auto_cp_abi.doc = xstrprintf ("Automatically selected; currently \"%s\"",
+ abi->shortname).release ();
/* Since we copy the current ABI into current_cp_abi instead of
using a pointer, if auto is currently the default, we need to