RFC: save lots of memory
Daniel Jacobowitz
drow@false.org
Thu Nov 5 19:59:00 GMT 2009
On Wed, Nov 04, 2009 at 06:23:54PM -0700, Tom Tromey wrote:
> Let me know what you think.
Generally seems sound. There are two things I noticed:
* I don't think passing length == -1 is inherently ugly as a flag.
But it does seem silly to not pass the length when we often know it in
the caller.
* I can save you a couple more bytes:
> + *slot = obstack_alloc (&objfile->objfile_obstack,
> + sizeof (struct demangled_name_entry)
> + + demangled_len);
You want offsetof here, not sizeof. The struct will have either three
or seven bytes of padding on most platforms, so you're pushing out to
a word boundary unnecessarily.
--
Daniel Jacobowitz
CodeSourcery
More information about the Gdb-patches
mailing list