This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: xfree() -- set ptr to nil (fwd)
- To: "John R. Moore" <jmoore at cygnus dot com>
- Subject: Re: xfree() -- set ptr to nil (fwd)
- From: jtc at redback dot com (J.T. Conklin)
- Date: 12 Feb 2001 15:54:07 -0800
- Cc: Kevin Buettner <kevinb at cygnus dot com>,<gdb-patches at sources dot redhat dot com>
- References: <Pine.GSO.4.31.0102121527310.16672-100000@cse.cygnus.com>
- Reply-To: jtc at redback dot com
>>>>> "John" == John R Moore <jmoore@cygnus.com> writes:
John> Yes, I've usually seen this as a macro
John>
John> #define XFREE(ptr) do \
John> { \
John> if (ptr) \
John> { \
John> free (ptr); \
John> ptr = NULL; \
John> } \
John> } while (0)
John>
John> Ok, then, do we want to replace xfree() with something like XFREE() ?
I'd say no, unless it has been established that we have a problem
where pointers are freed multiple times AND it's been determined that
its too difficult to fix the code to avoid the bug.
--jtc
--
J.T. Conklin
RedBack Networks