From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5015 invoked by alias); 22 Apr 2003 17:33:53 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 4996 invoked from network); 22 Apr 2003 17:33:52 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 22 Apr 2003 17:33:52 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 1981ee-0004nH-00; Tue, 22 Apr 2003 12:34:04 -0500 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 1981eO-00005r-00; Tue, 22 Apr 2003 13:33:48 -0400 Date: Tue, 22 Apr 2003 17:33:00 -0000 From: Daniel Jacobowitz To: Andrew Cagney Cc: Jason Molenda , gdb-patches@sources.redhat.com Subject: Re: PATCH: Add type_sprint() function to return type in string form Message-ID: <20030422173348.GA325@nevyn.them.org> Mail-Followup-To: Andrew Cagney , Jason Molenda , gdb-patches@sources.redhat.com References: <20030418152426.A93348@molenda.com> <20030422032629.GB5033@nevyn.them.org> <3EA57249.5020104@redhat.com> <20030422165455.GA31686@nevyn.them.org> <3EA57BD9.5020502@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3EA57BD9.5020502@redhat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-04/txt/msg00404.txt.bz2 On Tue, Apr 22, 2003 at 01:28:57PM -0400, Andrew Cagney wrote: > >On Tue, Apr 22, 2003 at 12:48:09PM -0400, Andrew Cagney wrote: > > > >>>On Fri, Apr 18, 2003 at 03:24:26PM -0700, Jason Molenda wrote: > >>> > > > >>>>There are a few places in gdb where code prints an error message > >>>>with a type included in it. The only way for these functions to > >>>>print a type is with type_print(), which takes a ui_file stream to > >>>>print its output to. This means they either have to send the output > >>>>to gdb_stderr, or build up a fake memory ui_file and retrieve the > >>>>contents. > >>>> > >>>>This patch adds a type_sprint() which does the latter and returns the > >>>>xmalloc()'ed string. > > > >> > >>Good interface choice! Just some tweaks. > >> > >>sprint makes me think of the nasty sprintf family, which this is > >>definitly not. So .. suggest calling it something like type_xstrdup: > >>x-> xmalloc family; strdup -> allocate a string duplicate (like > >>ui_file_xstrdup, but yes pushing it a bit). The alternative would be > >>type_xasprint (&string, ...) but I think that is getting ugly :-) > > > > > >How about type_asprint? I really don't think that the x is necessary, > >but the a would be a convenient reminder. > > GDB should use neither sprint* nor asprint*. I disagree. Why on earth wouldn't we use sprintf? Just because it can be used incorrectly is no excuse. > type_sprint or > type_asprint would confuse this. Even given the above assumption, I disagree with your conclusion. > The xasprint* family all have the signature: > > ...xasprint* (char **buf, ....) > > which doesn't apply here. Perhaps it should apply? > >>The old error message should never have included a period ("."), might > >>as well remove it while tweaking the code. > > > > > >Didn't we settle on full sentence error messages the last time this > >came up? > > For the moment, it's a full sentence, with a leading upper case letter > but no trailing period :-) The period doesn't make much sence to a GUI. > The ARI is looking for this. Huh, so it is. Odd. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer