Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>,
	 "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [patch] serial, mdebugread, top.c, utils, frame.c: remove unused variables
Date: Mon, 10 May 2010 17:26:00 -0000	[thread overview]
Message-ID: <4BE841AC.8010701@vmware.com> (raw)
In-Reply-To: <20100509091353.GB7479@adacore.com>

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  <msnyder@vmware.com>

         * 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.  */


      reply	other threads:[~2010-05-10 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-07  0:50 Michael Snyder
2010-05-08 21:12 ` Jan Kratochvil
2010-05-09  9:14   ` Joel Brobecker
2010-05-10 17:26     ` Michael Snyder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BE841AC.8010701@vmware.com \
    --to=msnyder@vmware.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox