From patchwork Mon Oct 21 02:47:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 35194 Received: (qmail 102864 invoked by alias); 21 Oct 2019 02:47:16 -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 102852 invoked by uid 89); 21 Oct 2019 02:47:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=mapped, destroyed, zap, H*RU:100.42.49.5 X-HELO: gateway36.websitewelcome.com Received: from gateway36.websitewelcome.com (HELO gateway36.websitewelcome.com) (192.185.193.12) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Oct 2019 02:47:14 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 66D35423E94D4 for ; Sun, 20 Oct 2019 20:54:48 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id MNixi79VOVUVYMNixiltiX; Sun, 20 Oct 2019 21:47:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=q1L0YjtuIAtIN+ujypI9gVGnQ8GAEgYu//cHxr/myl8=; b=e6H/p9ptt6T0qD0C7+x4WELZWZ 1yOtRZ+OkmpEW+v0lJoB7CcF5597lb44FGNwkdanJ1pq48aot5krNEtRvKn8ao0TFLt5Ui/Xi1lww 3ollBQbWC6c+bIpz3zObZTay1; Received: from 75-166-66-104.hlrn.qwest.net ([75.166.66.104]:56436 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iMNix-002GS5-Jz; Sun, 20 Oct 2019 20:47:11 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI] Make unlink_objfile and put_objfile_before static Date: Sun, 20 Oct 2019 20:47:09 -0600 Message-Id: <20191021024709.28557-1-tom@tromey.com> I noticed an obsolete comment just before unlink_objfile, and then I noticed that both unlink_objfile and put_objfile_before could be static. This patch makes these changes, and also moves unlink_objfile earlier, so that a forward declaration is not needed. Tested by rebuilding. gdb/ChangeLog 2019-10-20 Tom Tromey * objfiles.h (unlink_objfile, put_objfile_before): Don't declare. * objfiles.c (unlink_objfile): Move earlier. Now static. Remove obsolete comment. (put_objfile_before): Now static. Change-Id: I1b5927a60fd1cc59bfc9c6761f61652a01ef13e0 --- gdb/ChangeLog | 7 +++++++ gdb/objfiles.c | 55 ++++++++++++++++++++------------------------------ gdb/objfiles.h | 4 ---- 3 files changed, 29 insertions(+), 37 deletions(-) diff --git a/gdb/objfiles.c b/gdb/objfiles.c index f1e708de0fd..fd1cbf764d6 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -473,10 +473,31 @@ separate_debug_iterator::operator++ () return *this; } +/* Unlink OBJFILE from the list of known objfiles. */ + +static void +unlink_objfile (struct objfile *objfile) +{ + struct objfile **objpp; + + for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next)) + { + if (*objpp == objfile) + { + *objpp = (*objpp)->next; + objfile->next = NULL; + return; + } + } + + internal_error (__FILE__, __LINE__, + _("unlink_objfile: objfile already unlinked")); +} + /* Put one object file before a specified on in the global list. This can be used to make sure an object file is destroyed before another when using objfiles_safe to free all objfiles. */ -void +static void put_objfile_before (struct objfile *objfile, struct objfile *before_this) { struct objfile **objp; @@ -497,38 +518,6 @@ put_objfile_before (struct objfile *objfile, struct objfile *before_this) _("put_objfile_before: before objfile not in list")); } -/* Unlink OBJFILE from the list of known objfiles, if it is found in the - list. - - It is not a bug, or error, to call this function if OBJFILE is not known - to be in the current list. This is done in the case of mapped objfiles, - for example, just to ensure that the mapped objfile doesn't appear twice - in the list. Since the list is threaded, linking in a mapped objfile - twice would create a circular list. - - If OBJFILE turns out to be in the list, we zap it's NEXT pointer after - unlinking it, just to ensure that we have completely severed any linkages - between the OBJFILE and the list. */ - -void -unlink_objfile (struct objfile *objfile) -{ - struct objfile **objpp; - - for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next)) - { - if (*objpp == objfile) - { - *objpp = (*objpp)->next; - objfile->next = NULL; - return; - } - } - - internal_error (__FILE__, __LINE__, - _("unlink_objfile: objfile already unlinked")); -} - /* Add OBJFILE as a separate debug objfile of PARENT. */ void diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 2d92120870d..aa8e32081e9 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -637,12 +637,8 @@ extern CORE_ADDR entry_point_address (void); extern void build_objfile_section_table (struct objfile *); -extern void put_objfile_before (struct objfile *, struct objfile *); - extern void add_separate_debug_objfile (struct objfile *, struct objfile *); -extern void unlink_objfile (struct objfile *); - extern void free_objfile_separate_debug (struct objfile *); extern void free_all_objfiles (void);