Re: [ Code ] My previous post...

From: Chaotic (chaotic@ESKIMO.COM)
Date: 08/01/97


On Thu, 31 Jul 1997, David Klasinc wrote:

> On Wed, 30 Jul 1997, Sammy wrote:
>
> guarantee.  If you want to use null checks for protection, you could
> replace free() with FREE():
>
> #define FREE(ptr)       (free((ptr)); (ptr) = NULL:)
>
> Or you could do it the hard way and change free() on all the systems
> you're working with.

better yet sammy, why not do a check on the pointer and make a log entry?
you wouldn't know who the culprit is, but at least you'd know that you had
a problem somewhere.  as in:

#define FREE(ptr)      (                                    \
                             if (ptr == NULL)               \
                             log("SYSERR: NULL pointer");   \
                         else {                             \
                             free(ptr);                     \
                             ptr = NULL;                    \
                         }                                  \
                       )


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST