From patchwork Fri Sep 23 19:53:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 15961 Received: (qmail 47220 invoked by alias); 23 Sep 2016 19:53:21 -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 46999 invoked by uid 89); 23 Sep 2016 19:53:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=AWL, BAYES_20, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=H*r:4.86_1, H*RU:sk:gproxy1, H*F:U*tom, Hx-languages-length:2172 X-HELO: gproxy10-pub.mail.unifiedlayer.com Received: from gproxy10-pub.mail.unifiedlayer.com (HELO gproxy10-pub.mail.unifiedlayer.com) (69.89.20.226) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Fri, 23 Sep 2016 19:53:12 +0000 Received: (qmail 1352 invoked by uid 0); 23 Sep 2016 19:53:10 -0000 Received: from unknown (HELO cmgw2) (10.0.90.83) by gproxy10.mail.unifiedlayer.com with SMTP; 23 Sep 2016 19:53:10 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw2 with id n7t41t00r2f2jeq017t72x; Fri, 23 Sep 2016 13:53:08 -0600 X-Authority-Analysis: v=2.1 cv=F4vEKMRN c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=GW1xBdLrtEIA:10 a=zstS-IiYAAAA:8 a=NDmkIkTCrRtSUSVVWsQA:9 a=gqnw5N2G_9YUBAYk:21 a=_0IRu_SlUnGBO63i:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 174-16-151-161.hlrn.qwest.net ([174.16.151.161]:55642 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_1) (envelope-from ) id 1bnWWw-0005Ed-7A; Fri, 23 Sep 2016 13:53:06 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI v2 4/5] Use std::vector in objfiles.c Date: Fri, 23 Sep 2016 13:53:01 -0600 Message-Id: <1474660382-14294-5-git-send-email-tom@tromey.com> In-Reply-To: <1474660382-14294-1-git-send-email-tom@tromey.com> References: <1474660382-14294-1-git-send-email-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1bnWWw-0005Ed-7A X-Source-Sender: 174-16-151-161.hlrn.qwest.net (bapiya.Home) [174.16.151.161]:55642 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== This patch changes a spot in objfiles.c to use a std::vector, removing a cleanup. 2016-09-23 Tom Tromey * objfiles.c: Include . (objfile_relocate): Use std::vector. --- gdb/ChangeLog | 5 +++++ gdb/objfiles.c | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ab90503..161da29 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2016-09-23 Tom Tromey + * objfiles.c: Include . + (objfile_relocate): Use std::vector. + +2016-09-23 Tom Tromey + * rust-lang.c: Include and . (rust_evaluate_funcall): Use std::vector, std::string. (rust_evaluate_subexp): Use std::string. diff --git a/gdb/objfiles.c b/gdb/objfiles.c index f022d10..71f771d 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -53,6 +53,8 @@ #include "gdb_bfd.h" #include "btrace.h" +#include + /* Keep a registry of per-objfile data-pointers required by other GDB modules. */ @@ -943,7 +945,6 @@ objfile_relocate (struct objfile *objfile, debug_objfile = objfile_separate_debug_iterate (objfile, debug_objfile)) { struct section_addr_info *objfile_addrs; - struct section_offsets *new_debug_offsets; struct cleanup *my_cleanups; objfile_addrs = build_section_addr_info_from_objfile (objfile); @@ -956,15 +957,13 @@ objfile_relocate (struct objfile *objfile, gdb_assert (debug_objfile->num_sections == gdb_bfd_count_sections (debug_objfile->obfd)); - new_debug_offsets = - ((struct section_offsets *) - xmalloc (SIZEOF_N_SECTION_OFFSETS (debug_objfile->num_sections))); - make_cleanup (xfree, new_debug_offsets); - relative_addr_info_to_section_offsets (new_debug_offsets, + std::vector + new_debug_offsets (SIZEOF_N_SECTION_OFFSETS (debug_objfile->num_sections)); + relative_addr_info_to_section_offsets (new_debug_offsets.data (), debug_objfile->num_sections, objfile_addrs); - changed |= objfile_relocate1 (debug_objfile, new_debug_offsets); + changed |= objfile_relocate1 (debug_objfile, new_debug_offsets.data ()); do_cleanups (my_cleanups); }