This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: save lots of memory
- From: Daniel Jacobowitz <drow at false dot org>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 5 Nov 2009 14:59:48 -0500
- Subject: Re: RFC: save lots of memory
- References: <m3ljil228l.fsf@fleche.redhat.com>
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