summaryrefslogtreecommitdiff
path: root/gdb/nto-tdep.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-11-10 13:47:05 -0700
committerTom Tromey <tom@tromey.com>2018-02-14 08:09:53 -0700
commite0cc99a62f9ceb9a0db0b5bc28711fd8c82a6151 (patch)
tree4401d76103521d42ed82b58cf22eb6fe77abdbf2 /gdb/nto-tdep.c
parentb46a8d7c1d50c06e641af99b58301db0499111b9 (diff)
downloadbinutils-gdb-e0cc99a62f9ceb9a0db0b5bc28711fd8c82a6151.tar.gz
Change openp et al to use a unique_xmalloc_ptr
This changes openp, source_full_path_of, and find_and_open_source to take a unique_xmalloc_ptr, rather than a char*, as an outgoing argument type. This simplifies the API, ownership-wise, and allows for the removal of some cleanups. gdb/ChangeLog 2018-02-14 Tom Tromey <tom@tromey.com> * symfile.c (symfile_bfd_open): Update. * source.h (openp, source_full_path_of, find_and_open_source): Change argument type to unique_xmalloc_ptr. * source.c (openp): Take a unique_xmalloc_ptr. (source_full_path_of, find_and_open_source): Likewise. (open_source_file, symtab_to_fullname): Update. * solist.h (struct target_so_ops) <find_and_open_solib>: Take a unique_xmalloc_ptr. * solib.c (solib_find_1): Use unique_xmalloc_ptr. (exec_file_find): Update. * psymtab.c (psymtab_to_fullname): Update. * nto-tdep.h (nto_find_and_open_solib): Update. * nto-tdep.c (nto_find_and_open_solib): Change temp_path to a unique_xmalloc_ptr. * exec.c (exec_file_attach): Update. * dwarf2read.c (try_open_dwop_file): Use unique_xmalloc_ptr. * cli/cli-cmds.c (find_and_open_script): Use unique_xmalloc_ptr.
Diffstat (limited to 'gdb/nto-tdep.c')
-rw-r--r--gdb/nto-tdep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 30db99c759d..8eb864b871b 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -89,7 +89,7 @@ nto_map_arch_to_cputype (const char *arch)
int
nto_find_and_open_solib (const char *solib, unsigned o_flags,
- char **temp_pathname)
+ gdb::unique_xmalloc_ptr<char> *temp_pathname)
{
char *buf, *arch_path, *nto_root;
const char *endian;
@@ -143,9 +143,9 @@ nto_find_and_open_solib (const char *solib, unsigned o_flags,
if (temp_pathname)
{
if (ret >= 0)
- *temp_pathname = gdb_realpath (arch_path).release ();
+ *temp_pathname = gdb_realpath (arch_path);
else
- *temp_pathname = NULL;
+ temp_pathname->reset (NULL);
}
}
return ret;