gEDA-dev: PCB MyFree

ldoolitt at recycle.lbl.gov ldoolitt at recycle.lbl.gov
Thu Jun 22 11:32:58 EDT 2006


DJ -

On Thu, Jun 22, 2006 at 09:04:40AM -0400, DJ Delorie wrote:
> It would be better to rename the function, and have the macro called
> MyFree()

I thought about that, and didn't like changing the semantics
without changing the name.  A change from MyFree(&foo) to
MyFree(foo) would be bothersome to untangle if a change was
half-applied.

My patch removed the MyFree() function entirely.  The macro
MYFREE now calls an unmodified SaveFree().

> For extra credit, have the macro pass __FUNCTION__ and __LINE__ to
> MyFree_2() (or whatever) and add useful diagnostics.  Similarly for
> MyCalloc and MyAlloc.

My goal was to improve things with minimally invasive changes.

> Bonus if the new macros are called malloc() and free() :-)

Umm.  That would confuse me.

There is already a hook to use <dmalloc.h>.  Surely they do
all this better than we do.  Would it be better to drop all
this stuff, and go back to the raw (possibly dmalloc-ified)
malloc() and free()?

   - Larry


More information about the geda-dev mailing list