From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 082773857C7E for ; Mon, 20 Jul 2020 01:41:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 082773857C7E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id AF2C11E792; Sun, 19 Jul 2020 21:41:08 -0400 (EDT) Subject: Re: [PATCH 4/9] Use htab_up in filename_seen_cache To: Tom Tromey , gdb-patches@sourceware.org References: <20200718172915.6811-1-tom@tromey.com> <20200718172915.6811-5-tom@tromey.com> From: Simon Marchi Message-ID: <942aeedb-fb48-0a78-00fa-ea8d981491d7@simark.ca> Date: Sun, 19 Jul 2020 21:41:05 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200718172915.6811-5-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jul 2020 01:41:10 -0000 On 2020-07-18 1:29 p.m., Tom Tromey wrote: > This changes filename_seen_cache to use htab_up, rather than explicit > calls to htab_delete. > > gdb/ChangeLog > 2020-07-18 Tom Tromey > > * filename-seen-cache.c (filename_seen_cache::filename_seen_cache) > (filename_seen_cache::clear): Update. > (~filename_seen_cache): Remove. > (filename_seen_cache::seen): Update. > * filename-seen-cache.h (class filename_seen_cache) : Now > htab_up. > <~filename_seen_cache>: Default. > : Update. > --- > gdb/ChangeLog | 11 +++++++++++ > gdb/filename-seen-cache.c | 17 +++++------------ > gdb/filename-seen-cache.h | 6 +++--- > 3 files changed, 19 insertions(+), 15 deletions(-) > > diff --git a/gdb/filename-seen-cache.c b/gdb/filename-seen-cache.c > index f3905c0fb12..b0cda087cc0 100644 > --- a/gdb/filename-seen-cache.c > +++ b/gdb/filename-seen-cache.c > @@ -27,10 +27,10 @@ > /* filename_seen_cache constructor. */ > > filename_seen_cache::filename_seen_cache () > + : m_tab (htab_create_alloc (INITIAL_FILENAME_SEEN_CACHE_SIZE, > + filename_hash, filename_eq, > + NULL, xcalloc, xfree)) > { > - m_tab = htab_create_alloc (INITIAL_FILENAME_SEEN_CACHE_SIZE, > - filename_hash, filename_eq, > - NULL, xcalloc, xfree); > } > > /* See filename-seen-cache.h. */ > @@ -38,14 +38,7 @@ filename_seen_cache::filename_seen_cache () > void > filename_seen_cache::clear () > { > - htab_empty (m_tab); > -} > - > -/* See filename-seen-cache.h. */ > - > -filename_seen_cache::~filename_seen_cache () > -{ > - htab_delete (m_tab); > + htab_empty (m_tab.get ()); > } > > /* See filename-seen-cache.h. */ > @@ -56,7 +49,7 @@ filename_seen_cache::seen (const char *file) > void **slot; > > /* Is FILE in tab? */ > - slot = htab_find_slot (m_tab, file, INSERT); > + slot = htab_find_slot (m_tab.get (), file, INSERT); > if (*slot != NULL) > return true; > > diff --git a/gdb/filename-seen-cache.h b/gdb/filename-seen-cache.h > index ee064c32565..ccc47694fff 100644 > --- a/gdb/filename-seen-cache.h > +++ b/gdb/filename-seen-cache.h > @@ -29,7 +29,7 @@ class filename_seen_cache > { > public: > filename_seen_cache (); > - ~filename_seen_cache (); > + ~filename_seen_cache () = default; Same as in the other patch, I don't really see the point to keep the explicitly defaulted destructor. Otherwise, LGTM. Simon