This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [patch] more robust free_current_contents + mi cleanup cleanup
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: Re: [patch] more robust free_current_contents + mi cleanup cleanup
- From: Fernando Nasser <fnasser at cygnus dot com>
- Date: Tue, 16 May 2000 07:00:09 +0000
- Organization: Cygnus Solutions (a Red Hat company) - Toronto
- References: <3920D564.86185905@cygnus.com> <20000516010255.A11622@cygnus.com>
(list off)
Chris Faylor wrote:
>
> On Tue, May 16, 2000 at 02:58:12PM +1000, Andrew Cagney wrote:
> >Index: utils.c
> >===================================================================
> >RCS file: /cvs/src/src/gdb/utils.c,v
> >retrieving revision 1.10
> >diff -p -r1.10 utils.c
> >*** utils.c 2000/05/16 02:43:39 1.10
> >--- utils.c 2000/05/16 04:54:29
> >*************** void
> >*** 390,397 ****
> > free_current_contents (void *ptr)
> > {
> > void **location = ptr;
> > if (*location != NULL)
> >! free (*location);
> > }
> >
> > /* Provide a known function that does nothing, to use as a base for
> >--- 390,402 ----
> > free_current_contents (void *ptr)
> > {
> > void **location = ptr;
> >+ if (location == NULL)
> >+ internal_error ("free_current_contents: NULL pointer");
> > if (*location != NULL)
>
> Wouldn't an "else" be a little clearer here instead of another test of
> *location?
>
One test is for (location) and the other is for (*location).
I was also looking at this puzzled once until I saw it.
A pair of comments would be helpful though.
> >! {
> >! free (*location);
> >! *location = NULL;
> >! }
> > }
> >
> > /* Provide a known function that does nothing, to use as a base for
>
> cgf
--
Fernando Nasser
Cygnus Solutions (a Red Hat company) E-Mail: fnasser@cygnus.com
2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
Toronto, Ontario M4P 2C9 Fax: 416-482-6299