This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 22/22] Introduce and use bcache_up
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 7 Mar 2019 17:09:24 +0000
- Subject: Re: [PATCH v2 22/22] Introduce and use bcache_up
- References: <20190227201849.32210-1-tom@tromey.com> <20190227201849.32210-23-tom@tromey.com> <6b7f0a4c-f06b-9046-c91d-ae402eae6c51@redhat.com> <87sgvyeicd.fsf@tromey.com>
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