This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 22/22] Introduce and use bcache_up


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]