[Freeciv-Dev] Re: [patches] freeing NULL ptrs
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Fri, Aug 17, 2001 at 09:50:47PM -0700, Kevin Brown wrote:
> Justin Moore <justin@xxxxxxxxxxx> wrote:
> >
> > More of the same. All these patches can also be grabbed from
> > http://opus.dulug.duke.edu/~justin/public/FreeCiv/
> >
> > > > PS. Would it be worth it to create a fc_free that ignores all NULL
> > > > pointers passed to it?
> > >
> > > Probably. It might be helpful, too, to have that same function
> > > assert(ptr != NULL) first if compiled with debugging turned on, so
> > > that any instances where the code tries to free a NULL can be tracked
> > > down and, if necessary, fixed.
> >
> > The patch defining this function is included. It'll be quite a series
> > of patches to switch everyone from using free() to fc_free(), though. :)
>
> One comment: it looks like handle_free_failure will always drop core
> unless the assert() is nooped out by defining NDEBUG (which also
> happened to break other things as of 1.11.4. Haven't looked at the
> current sources to see if that remains the case). I'd say if you put
> the assert() within an #ifdef DEBUG block then you'll be all set.
Let the action (warning and dropping core or warning only) be depend
on IS_DEVEL_VERSION and/or IS_BETA_VERSION from common/version.h.
Could the dropping core be make explicit "assert(0);"?
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
[Freeciv-Dev] Re: [patches] freeing NULL ptrs, David Pfitzner, 2001/08/17
|
|