This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 05/15] Simplify calls to init_psymbol_list
- From: Simon Marchi <simark at simark dot ca>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Tue, 17 Jul 2018 22:50:59 -0400
- Subject: Re: [RFA 05/15] Simplify calls to init_psymbol_list
- References: <20180510222357.27332-1-tom@tromey.com> <20180510222357.27332-6-tom@tromey.com>
On 2018-05-10 06:23 PM, Tom Tromey wrote:
> diff --git a/gdb/psymtab.c b/gdb/psymtab.c
> index 4fd47bf92b..c1c8cba800 100644
> --- a/gdb/psymtab.c
> +++ b/gdb/psymtab.c
> @@ -1725,14 +1725,14 @@ add_psymbol_to_list (const char *name, int namelength, int copy_name,
> append_psymbol_to_list (list, psym, objfile);
> }
>
> -/* Initialize storage for partial symbols. */
> +/* See psympriv.h. */
>
> void
> init_psymbol_list (struct objfile *objfile, int total_symbols)
> {
> - /* Free any previously allocated psymbol lists. */
> - objfile->global_psymbols.clear ();
> - objfile->static_psymbols.clear ();
> + if (objfile->global_psymbols.capacity () == 0
> + && objfile->static_psymbols.capacity () == 0)
> + return;
Hmm, isn't the condition backwards? If the capacity is zero, we want to
reserve some space. But maybe we can skip the check completely... if we
have already reserved the same space previously, calling reserve again
does nothing (is harmless).
Would LGTM with the condition fixed (assuming I am not the one being confused)
or removed.
Simon