This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Use custom hash function with bcache
>>>>> "Sami" == sami wagiaalla <swagiaal@redhat.com> writes:
Sami> Although, you are right, there is no strict type checking. Are you
Sami> suggesting we make psymbol_cache a new type ?
Tom> Yeah; at least, if it isn't too big.
Sami> Patch attached.
Aside from some formatting nits, this looks good to me.
Sami> +struct psymbol_bcache *
Sami> +psymbol_bcache_init ()
(void)
Sami> +{
Sami> + struct psymbol_bcache *bcache = XCALLOC (1, struct psymbol_bcache);
Sami> + bcache->bcache = bcache_xmalloc (psymbol_hash, psymbol_compare);
Sami> + return bcache;
Wrong amount of indentation here.
Also for a single object, use XNEW, not XCALLOC.
Sami> +void
Sami> +psymbol_bcache_free (struct psymbol_bcache *bcache)
Sami> +{
Sami> +
Sami> + if (bcache == NULL)
Sami> + return;
Spurious blank line.
Sami> + bcache_xfree(bcache->bcache);
Space before paren.
Sami> +static const struct partial_symbol *
Sami> +psymbol_bcache_full (struct partial_symbol *sym,
Sami> + struct psymbol_bcache *bcache,
Sami> + int *added)
Sami> +{
Sami> + return bcache_full (sym,
Wrong indentation.
Sami> +/* A bcache for partial symbols. */
Sami> +
Sami> +struct psymbol_bcache {
I usually put the brace in column 0 on the next line.
I don't think we're consistent here though.
Sami> +extern struct psymbol_bcache *psymbol_bcache_init ();
(void)
Tom