From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60932 invoked by alias); 7 Mar 2019 17:09:29 -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 60924 invoked by uid 89); 7 Mar 2019 17:09:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=touching X-HELO: mail-wr1-f65.google.com Received: from mail-wr1-f65.google.com (HELO mail-wr1-f65.google.com) (209.85.221.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Mar 2019 17:09:28 +0000 Received: by mail-wr1-f65.google.com with SMTP id n2so18323627wrw.8 for ; Thu, 07 Mar 2019 09:09:27 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:4c97:6d52:2cea:997b? ([2001:8a0:f913:f700:4c97:6d52:2cea:997b]) by smtp.gmail.com with ESMTPSA id t16sm3325454wmj.47.2019.03.07.09.09.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:09:25 -0800 (PST) Subject: Re: [PATCH v2 22/22] Introduce and use bcache_up To: Tom Tromey References: <20190227201849.32210-1-tom@tromey.com> <20190227201849.32210-23-tom@tromey.com> <6b7f0a4c-f06b-9046-c91d-ae402eae6c51@redhat.com> <87sgvyeicd.fsf@tromey.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <84420de3-2ac8-84a5-3361-cd5baf57209f@redhat.com> Date: Thu, 07 Mar 2019 17:09:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <87sgvyeicd.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-03/txt/msg00157.txt.bz2 On 03/07/2019 04:53 PM, Tom Tromey wrote: >>> This introduces a new bcache_up typedef, which is a unique_ptr >>> specialization for managing a bcache. Then, this changes various >>> spots to use this object, rather than manually calling bcache_xfree. >>> This lets us remove a try/catch that only existed to call >>> bcache_xfree. > > Pedro> I won't object, but is seems to me that it'd be better to > Pedro> make bcache_xmalloc / bcache_free ctors/dtors of struct bcache, > Pedro> and then we'd allocate a bcache object on the stack (and likewise > Pedro> hold bcache objects in structures instead of bcache pointers). > > I broke this one out from the series. Let me know what you think. Thanks! Almost perfect. On a quick skim, the only thing missing is renaming the now-private fields of struct bcache to have an "m_" prefix. I think it's worth doing here since it'll end up touching many of the same same lines you're already touching in bcache.c. LGTM with that change. Thanks, Pedro Alves