From 0fc21fd8cf92de78c3c383378e70a2955e2631c3 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 6 Sep 2017 16:16:38 -0600 Subject: [PATCH] Use gdb::def_vector in create_sals_line_offset This changes create_sals_line_offset to use gdb::def_vector, removing some cleanups. ChangeLog 2017-09-09 Tom Tromey * linespec.c (create_sals_line_offset): Use gdb::def_vector. --- gdb/ChangeLog | 4 ++++ gdb/linespec.c | 11 +++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fd1f3609df1..c0569247349 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2017-09-09 Tom Tromey + + * linespec.c (create_sals_line_offset): Use gdb::def_vector. + 2017-09-09 Tom Tromey * p-valprint.c (pascal_object_print_value): Use gdb::byte_vector. diff --git a/gdb/linespec.c b/gdb/linespec.c index 480180869fa..abe66153fd7 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -45,6 +45,7 @@ #include "stack.h" #include "location.h" #include "common/function-view.h" +#include "common/def-vector.h" /* An enumeration of the various things a user might attempt to complete for a linespec location. */ @@ -2182,8 +2183,6 @@ create_sals_line_offset (struct linespec_state *self, else { struct linetable_entry *best_entry = NULL; - int *filter; - const struct block **blocks; int i, j; std::vector intermediate_results @@ -2203,10 +2202,8 @@ create_sals_line_offset (struct linespec_state *self, above, we see if there are other PCs that are in the same block. If yes, the other PCs are filtered out. */ - filter = XNEWVEC (int, intermediate_results.size ()); - struct cleanup *cleanup = make_cleanup (xfree, filter); - blocks = XNEWVEC (const struct block *, intermediate_results.size ()); - make_cleanup (xfree, blocks); + gdb::def_vector filter (intermediate_results.size ()); + gdb::def_vector blocks (intermediate_results.size ()); for (i = 0; i < intermediate_results.size (); ++i) { @@ -2245,8 +2242,6 @@ create_sals_line_offset (struct linespec_state *self, add_sal_to_sals (self, &values, &intermediate_results[i], sym ? SYMBOL_NATURAL_NAME (sym) : NULL, 0); } - - do_cleanups (cleanup); } if (values.empty ()) -- 2.30.2