Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [patches] freeing NULL ptrs
Home

[Freeciv-Dev] Re: [patches] freeing NULL ptrs

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Kevin Brown <kevin@xxxxxxxxxxxxxx>
Cc: Justin Moore <justin@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [patches] freeing NULL ptrs
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 19 Aug 2001 16:02:45 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

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


[Prev in Thread] Current Thread [Next in Thread]