[patch] more robust free_current_contents + mi cleanup cleanup
Fernando Nasser
fnasser@cygnus.com
Tue May 16 00:01:00 GMT 2000
(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
More information about the Gdb-patches
mailing list