From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30679 invoked by alias); 29 May 2005 14:23:41 -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 30670 invoked by uid 22791); 29 May 2005 14:23:39 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sun, 29 May 2005 14:23:39 +0000 Received: from drow by nevyn.them.org with local (Exim 4.50) id 1DcOhE-0006Ji-Ms; Sun, 29 May 2005 10:23:20 -0400 Date: Sun, 29 May 2005 15:07:00 -0000 From: Daniel Jacobowitz To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [commit] Fix "show prompt" Message-ID: <20050529142320.GD23858@nevyn.them.org> Mail-Followup-To: Eli Zaretskii , gdb-patches@sourceware.org References: <20050528182825.GD26806@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i X-SW-Source: 2005-05/txt/msg00618.txt.bz2 On Sun, May 29, 2005 at 09:13:06AM +0300, Eli Zaretskii wrote: > > switch (c->var_type) > > { > > case var_string: > > - if (((char *)c->var)[0] != '\0') > > - fputstr_filtered ((char *)c->var, '"', stb->stream); > > + if (*(char **) c->var) > > Doesn't this work without a cast, like this: > > if (*c->var != NULL) > > ? I think we should avoid unneeded type-casting. No: /* Pointer to variable affected by "set" and "show". Doesn't matter if type is not_set. */ void *var; Can't dereference that. Really, this ought to be replaced with a union, so that we could eliminate all the casts. -- Daniel Jacobowitz CodeSourcery, LLC