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/dwarf2read.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/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 3b90359..ca5b3a8 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3194,9 +3194,10 @@ mapped_index_string_hash (int index_version, const void *p) /* Find a slot in the mapped index INDEX for the object named NAME. If NAME is found, set *VEC_OUT to point to the CU vector in the - constant pool and return 1. If NAME cannot be found, return 0. */ + constant pool and return true. If NAME cannot be found, return + false. */ -static int +static bool find_slot_in_mapped_hash (struct mapped_index *index, const char *name, offset_type **vec_out) { @@ -3214,7 +3215,7 @@ find_slot_in_mapped_hash (struct mapped_index *index, const char *name, if (strchr (name, '(') != NULL) { - without_params.reset (cp_remove_params (name)); + without_params = cp_remove_params (name); if (without_params != NULL) name = without_params.get (); @@ -3239,14 +3240,14 @@ find_slot_in_mapped_hash (struct mapped_index *index, const char *name, offset_type i = 2 * slot; const char *str; if (index->symbol_table[i] == 0 && index->symbol_table[i + 1] == 0) - return 0; + return false; str = index->constant_pool + MAYBE_SWAP (index->symbol_table[i]); if (!cmp (name, str)) { *vec_out = (offset_type *) (index->constant_pool + MAYBE_SWAP (index->symbol_table[i + 1])); - return 1; + return true; } slot = (slot + step) & (index->symbol_table_slots - 1); |