From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3025 invoked by alias); 10 May 2010 17:26:14 -0000 Received: (qmail 3008 invoked by uid 22791); 10 May 2010 17:26:13 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 May 2010 17:26:08 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 6629F4100E; Mon, 10 May 2010 10:26:05 -0700 (PDT) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost3.vmware.com (Postfix) with ESMTP id 5B2BFCD91E; Mon, 10 May 2010 10:26:05 -0700 (PDT) Message-ID: <4BE841AC.8010701@vmware.com> Date: Mon, 10 May 2010 17:26:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.22 (X11/20090609) MIME-Version: 1.0 To: Joel Brobecker CC: Jan Kratochvil , "gdb-patches@sourceware.org" Subject: Re: [patch] serial, mdebugread, top.c, utils, frame.c: remove unused variables References: <4BE363CE.2000807@vmware.com> <20100508211155.GA12079@host0.dyn.jankratochvil.net> <20100509091353.GB7479@adacore.com> In-Reply-To: <20100509091353.GB7479@adacore.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2010-05/txt/msg00225.txt.bz2 Joel Brobecker wrote: >>> static void >>> do_fclose_cleanup (void *arg) >>> { >>> - FILE *file = arg; >>> fclose (arg); >>> } >> I believe the intentional was rather `fclose (file);' according to the general >> GDB template of callback functions: > > Good catch, Jan. > >> void >> func (void *arg) >> { >> real_type *var = arg; >> >> Use VAR having it type-checked callee prototypes or real_type changes. >> } >> >> But I understand it is a nitpick for never-changing FILE * and fclose. > > I think it's still important that we follow that paradigm (IMO). > It makes the code clearer. > OK, restored as: 2010-05-10 Michael Snyder * utils.c (do_fclose_cleanup) Restore local variable. Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.232 diff -u -p -r1.232 utils.c --- utils.c 7 May 2010 00:47:37 -0000 1.232 +++ utils.c 10 May 2010 17:24:40 -0000 @@ -266,7 +266,8 @@ make_cleanup_close (int fd) static void do_fclose_cleanup (void *arg) { - fclose (arg); + FILE *file = arg; + fclose (file); } /* Return a new cleanup that closes FILE. */