From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3180 invoked by alias); 3 May 2019 23:13:01 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 931 invoked by uid 89); 3 May 2019 23:12:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.9 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= X-HELO: gateway31.websitewelcome.com Received: from gateway31.websitewelcome.com (HELO gateway31.websitewelcome.com) (192.185.143.38) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 May 2019 23:12:42 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 85E25CEE3 for ; Fri, 3 May 2019 18:12:41 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id MhM9hcYSBdnCeMhM9hMCSh; Fri, 03 May 2019 18:12:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=njDbqqCLzDMQqGMc5E7AkrQfDbnfzncO8DDV8L17JP8=; b=VfEHqBlJpTt+PPxrm1kaGuj7qq d9woiY6FjadNlndgv+k2ubtYEW9rlyi4LE7tP+M/I7VLjDmTiDIDSJ2pyjovGUjgTDxgj0EZDRPtY Jb9Hiio+GbN3+LtoY3u6W3urj; Received: from 97-122-168-123.hlrn.qwest.net ([97.122.168.123]:37502 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1hMhM9-003AAO-AS; Fri, 03 May 2019 18:12:41 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 29/31] Convert objc-lang.c to type-safe registry API Date: Fri, 03 May 2019 23:13:00 -0000 Message-Id: <20190503231231.8954-30-tom@tromey.com> In-Reply-To: <20190503231231.8954-1-tom@tromey.com> References: <20190503231231.8954-1-tom@tromey.com> X-SW-Source: 2019-05/txt/msg00117.txt.bz2 This changes objc-lang.c to use the type-safe registry API. 2019-05-02 Tom Tromey * objc-lang.c (objc_objfile_data): Change type. (find_methods): Update. (_initialize_objc_lang): Remove. --- gdb/ChangeLog | 6 ++++++ gdb/objc-lang.c | 16 +++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index b25a98106c1..ab40e54a169 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -75,7 +75,7 @@ struct objc_method { CORE_ADDR imp; }; -static const struct objfile_data *objc_objfile_data; +static const struct objfile_key objc_objfile_data; /* Lookup a structure type named "struct NAME", visible in lexical block BLOCK. If NOERR is nonzero, return zero if NAME is not @@ -1004,7 +1004,7 @@ find_methods (char type, const char *theclass, const char *category, unsigned int objfile_csym = 0; - objc_csym = (unsigned int *) objfile_data (objfile, objc_objfile_data); + objc_csym = objc_objfile_data.get (objfile); if (objc_csym != NULL && *objc_csym == 0) /* There are no ObjC symbols in this objfile. Skip it entirely. */ continue; @@ -1056,11 +1056,7 @@ find_methods (char type, const char *theclass, const char *category, } if (objc_csym == NULL) - { - objc_csym = XOBNEW (&objfile->objfile_obstack, unsigned int); - *objc_csym = objfile_csym; - set_objfile_data (objfile, objc_objfile_data, objc_csym); - } + objc_csym = objc_objfile_data.emplace (objfile, objfile_csym); else /* Count of ObjC methods in this objfile should be constant. */ gdb_assert (*objc_csym == objfile_csym); @@ -1576,9 +1572,3 @@ resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc) return 1; return 0; } - -void -_initialize_objc_lang (void) -{ - objc_objfile_data = register_objfile_data (); -} -- 2.17.2