From patchwork Sat Sep 9 00:41:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 22775 Received: (qmail 28842 invoked by alias); 9 Sep 2017 00:41:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 28594 invoked by uid 89); 9 Sep 2017 00:41:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: outbound-ss-1812.hostmonster.com Received: from gproxy1-pub.mail.unifiedlayer.com (HELO outbound-ss-1812.hostmonster.com) (69.89.25.95) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Sep 2017 00:41:41 +0000 Received: from cmgw4 (cmgw5 [10.0.90.85]) by gproxy1.mail.unifiedlayer.com (Postfix) with ESMTP id E5A7C175AB8 for ; Fri, 8 Sep 2017 18:41:39 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id 7Chc1w00c2f2jeq01Chf4B; Fri, 08 Sep 2017 18:41:39 -0600 X-Authority-Analysis: v=2.2 cv=OZLoNlbY c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=7ICmlIZfIzKMgP0IbXgA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-76-94.hlrn.qwest.net ([75.166.76.94]:58538 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dqTq4-000TWc-Kv; Fri, 08 Sep 2017 18:41:36 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 3/4] Use gdb::def_vector in create_sals_line_offset Date: Fri, 8 Sep 2017 18:41:28 -0600 Message-Id: <20170909004129.28782-4-tom@tromey.com> In-Reply-To: <20170909004129.28782-1-tom@tromey.com> References: <20170909004129.28782-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dqTq4-000TWc-Kv X-Source-Sender: 75-166-76-94.hlrn.qwest.net (bapiya.Home) [75.166.76.94]:58538 X-Source-Auth: tom+tromey.com X-Email-Count: 8 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes This changes create_sals_line_offset to use gdb::def_vector, removing some cleanups. gdb/ChangeLog 2017-09-08 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 1f8bb71..4f4b543 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2017-09-08 Tom Tromey + * linespec.c (create_sals_line_offset): Use gdb::def_vector. + +2017-09-08 Tom Tromey + * p-valprint.c (pascal_object_print_value): Use gdb::byte_vector. 2017-09-08 Tom Tromey diff --git a/gdb/linespec.c b/gdb/linespec.c index 4801808..abe6615 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 ())