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
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: Michael Snyder <msnyder at vmware dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Sun, 9 May 2010 02:13:53 -0700
- Subject: Re: [patch] serial, mdebugread, top.c, utils, frame.c: remove unused variables
- References: <4BE363CE.2000807@vmware.com> <20100508211155.GA12079@host0.dyn.jankratochvil.net>
> > 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.
--
Joel