On Fri, May 06, 2016 at 11:11:29PM +0800, Marcel Böhme wrote:
> +  dpi.copy_templates
> +    = (struct d_print_template *) malloc (((size_t) dpi.num_copy_templates) 
> +                                       * sizeof (*dpi.copy_templates));
> +  if (! dpi.copy_templates)
> +    {
> +      d_print_error (&dpi);
> +      return 0;
> +    }

Another thing to consider is if the common values of dpi.num_*
and similarly in the other block are small enough, it might be desirable
to just use an automatic fixed size array (or even alloca) and only
fall back to malloc if it is too large.
Would be nice to say on some distro grab using nm and nm -D all _Z* symbols
from all binaries and shared libraries and run the demangler with some
statistics gathering.  If say dpi.num_saved_scopes is <= 16 in 99.5% cases
(completely random guess), it might be a useful optimization.

Anyway, that is all from me, I'll defer to the demangler maintainers for the
rest.

        Jakub

Reply via email to