This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Remove a VEC from remote.c
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Tom Tromey <tom at tromey dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 9 Nov 2018 22:13:37 +0000
- Subject: Re: [PATCH] Remove a VEC from remote.c
- References: <20181104160649.8292-1-tom@tromey.com>
On 2018-11-04 11:06 a.m., Tom Tromey wrote:
> This removes the VEC from remote_g_packet_data, replacing it with a
> std::vector. This is a bit odd in that this object is never
> destroyed, and is obstack-allocated. I believe a gdbarch is never
> destroyed, so this seemed ok.
This seems ok to me. If gdbarch were destroyable, we would need a new
"cleanup" hook to call ~remote_g_packet_data. But we would need such a
hook even without your patch, to free the VEC, which it itself not allocated
on the gdbarch obstack.
Tiny nit:
> + data->guesses.push_back (new_guess);
I always prefer having a constructor and using
data->guesses.emplace_back (bytes, tdesc);
since it makes it impossible to have uninitialized fields by mistake.
Simon