[PATCH] gdb: make inferior::terminal a unique ptr
Pedro Alves
pedro@palves.net
Thu Jun 25 17:32:49 GMT 2020
On 6/25/20 4:55 PM, Simon Marchi via Gdb-patches wrote:
> This changes the inferior::terminal field to be a unique pointer, so its
> deallocation is automatically managed.
>
> gdb/ChangeLog:
>
> * inferior.h (struct inferior) <terminal>: Change type to
> gdb::unique_xmalloc_ptr<char>.
> * inferior.c (inferior::~inferior): Don't free inf->terminal.
> * infcmd.c (set_inferior_io_terminal): Don't free terminal
> field, adjust to unique pointer.
> (get_inferior_io_terminal): Adjust to unique pointer.
>
LGTM.
This reminds me of this patch:
https://github.com/palves/gdb/commit/f240d57e3e659d13a01d9dda79120e2ce6bc7e74
IMO, the code is more readable with that. WDYT?
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list