From e0cc99a62f9ceb9a0db0b5bc28711fd8c82a6151 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 10 Nov 2017 13:47:05 -0700 Subject: 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 * 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) : 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. --- gdb/source.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gdb/source.h') diff --git a/gdb/source.h b/gdb/source.h index a21e919..a876950 100644 --- a/gdb/source.h +++ b/gdb/source.h @@ -32,9 +32,10 @@ enum openp_flag DEF_ENUM_FLAGS_TYPE(openp_flag, openp_flags); -extern int openp (const char *, openp_flags, const char *, int, char **); +extern int openp (const char *, openp_flags, const char *, int, + gdb::unique_xmalloc_ptr *); -extern int source_full_path_of (const char *, char **); +extern int source_full_path_of (const char *, gdb::unique_xmalloc_ptr *); extern void mod_path (const char *, char **); @@ -67,7 +68,7 @@ extern void init_source_path (void); FULLNAME is set to NULL. */ extern int find_and_open_source (const char *filename, const char *dirname, - char **fullname); + gdb::unique_xmalloc_ptr *fullname); /* Open a source file given a symtab S. Returns a file descriptor or negative number for error. */ -- cgit v1.1