From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10510 invoked by alias); 5 Nov 2009 19:59:56 -0000 Received: (qmail 10500 invoked by uid 22791); 5 Nov 2009 19:59:56 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Nov 2009 19:59:51 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 9D0DD10EC9; Thu, 5 Nov 2009 19:59:49 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id 87E3110EA9; Thu, 5 Nov 2009 19:59:49 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1N68Um-0004nU-6N; Thu, 05 Nov 2009 14:59:48 -0500 Date: Thu, 05 Nov 2009 19:59:00 -0000 From: Daniel Jacobowitz To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: RFC: save lots of memory Message-ID: <20091105195948.GA17864@caradoc.them.org> Mail-Followup-To: Tom Tromey , gdb-patches@sourceware.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-11/txt/msg00097.txt.bz2 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