This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: save lots of memory


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]