This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] serial, mdebugread, top.c, utils, frame.c: remove unused variables
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. */
- References:
- [patch] serial, mdebugread, top.c, utils, frame.c: remove unused variables
- Re: [patch] serial, mdebugread, top.c, utils, frame.c: remove unused variables
- Re: [patch] serial, mdebugread, top.c, utils, frame.c: remove unused variables