summaryrefslogtreecommitdiff
path: root/gdb/cli/cli-decode.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/cli/cli-decode.c
parent2bb7589ddf61e163f2e414e7033fad56ea17e784 (diff)
downloadbinutils-gdb-8579fd136a614985bd27f20539c7bb7c5a51287d.tar.gz
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/cli/cli-decode.c')
-rw-r--r--gdb/cli/cli-decode.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 667d1558575..030cba44338 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -534,8 +534,8 @@ add_setshow_cmd_full_erased (const char *name,
{
struct cmd_list_element *set;
struct cmd_list_element *show;
- char *full_set_doc;
- char *full_show_doc;
+ gdb::unique_xmalloc_ptr<char> full_set_doc;
+ gdb::unique_xmalloc_ptr<char> full_show_doc;
if (help_doc != NULL)
{
@@ -544,18 +544,18 @@ add_setshow_cmd_full_erased (const char *name,
}
else
{
- full_set_doc = xstrdup (set_doc);
- full_show_doc = xstrdup (show_doc);
+ full_set_doc = make_unique_xstrdup (set_doc);
+ full_show_doc = make_unique_xstrdup (show_doc);
}
set = add_set_or_show_cmd (name, set_cmd, theclass, var_type, args,
- full_set_doc, set_list);
+ full_set_doc.release (), set_list);
set->doc_allocated = 1;
if (set_func != NULL)
set->func = set_func;
show = add_set_or_show_cmd (name, show_cmd, theclass, var_type, args,
- full_show_doc, show_list);
+ full_show_doc.release (), show_list);
show->doc_allocated = 1;
show->show_value_func = show_func;
/* Disable the default symbol completer. Doesn't make much sense