diff options
author | Pedro Alves <palves@redhat.com> | 2017-10-09 15:57:36 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-10-09 15:57:36 +0100 |
commit | 109483d9eec3f0d0c3eaafd5d829435059167c52 (patch) | |
tree | 4c41fa833332e7c4ae832313e3027eb70d5bcf2b /gdb/psymtab.c | |
parent | c474ea1a5f1524668cb8ce91c3682cb0cb837e08 (diff) | |
download | gdb-109483d9eec3f0d0c3eaafd5d829435059167c52.zip gdb-109483d9eec3f0d0c3eaafd5d829435059167c52.tar.gz gdb-109483d9eec3f0d0c3eaafd5d829435059167c52.tar.bz2 |
Make cp_remove_params return a gdb::unique_xmalloc_ptr
Use the type system instead of callers needing to know how the
returned string's memory is supposed to be managed.
gdb/ChangeLog:
2017-10-09 Pedro Alves <palves@redhat.com>
* cp-support.c (cp_remove_params): Return a gdb::unique_xmalloc_ptr.
Use bool.
(overload_list_add_symbol): Adjust to use gdb::unique_xmalloc_ptr.
* cp-support.h (cp_remove_params): Now returns a
gdb::unique_xmalloc_ptr.
* dwarf2read.c (find_slot_in_mapped_hash): Now returns bool.
Adjust to cp_remove_params returning a gdb::unique_xmalloc_ptr.
* psymtab.c (psymtab_search_name): Adjust to cp_remove_params
returning a gdb::unique_xmalloc_ptr.
(lookup_partial_symbol): Adjust to use gdb::unique_xmalloc_ptr.
* stack.c (find_frame_funname): Adjust to cp_remove_params
returning a gdb::unique_xmalloc_ptr.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r-- | gdb/psymtab.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 4527d69..f55c98c 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -623,9 +623,7 @@ match_partial_symbol (struct objfile *objfile, not contain any method/function instance information (since this would force reading type information while reading psymtabs). Therefore, if NAME contains overload information, it must be stripped before searching - psymtabs. - - The caller is responsible for freeing the return result. */ + psymtabs. */ static gdb::unique_xmalloc_ptr<char> psymtab_search_name (const char *name) @@ -636,10 +634,10 @@ psymtab_search_name (const char *name) { if (strchr (name, '(')) { - char *ret = cp_remove_params (name); + gdb::unique_xmalloc_ptr<char> ret = cp_remove_params (name); if (ret) - return gdb::unique_xmalloc_ptr<char> (ret); + return ret; } } break; |