summaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-04-06 16:38:56 -0600
committerTom Tromey <tom@tromey.com>2017-04-12 11:16:17 -0600
commit67d89901506da74d00a482b7560237dce404b41c (patch)
tree9c9c308fbaabb9ac805325be91bd2f75a07e040e /gdb/symtab.c
parent93921405a46c0a58eae19fffb92e02416082801a (diff)
Change find_pcs_for_symtab_line to return a std::vector
This changes find_pcs_for_symtab_line to return a std::vector. This allows the removal of some cleanups. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * symtab.h (find_pcs_for_symtab_line): Change return type. * symtab.c (find_pcs_for_symtab_line): Change return type. * python/py-linetable.c (build_line_table_tuple_from_pcs): Change type of "vec". Update. (ltpy_get_pcs_for_line): Update. * linespec.c (decode_digits_ordinary): Update.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index cc2f4001e0..20ef76ddd8 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3289,15 +3289,15 @@ done:
}
/* Given SYMTAB, returns all the PCs function in the symtab that
- exactly match LINE. Returns NULL if there are no exact matches,
- but updates BEST_ITEM in this case. */
+ exactly match LINE. Returns an empty vector if there are no exact
+ matches, but updates BEST_ITEM in this case. */
-VEC (CORE_ADDR) *
+std::vector<CORE_ADDR>
find_pcs_for_symtab_line (struct symtab *symtab, int line,
struct linetable_entry **best_item)
{
int start = 0;
- VEC (CORE_ADDR) *result = NULL;
+ std::vector<CORE_ADDR> result;
/* First, collect all the PCs that are at this line. */
while (1)
@@ -3320,8 +3320,7 @@ find_pcs_for_symtab_line (struct symtab *symtab, int line,
break;
}
- VEC_safe_push (CORE_ADDR, result,
- SYMTAB_LINETABLE (symtab)->item[idx].pc);
+ result.push_back (SYMTAB_LINETABLE (symtab)->item[idx].pc);
start = idx + 1;
}