gEDA-dev: PCB MyFree
ldoolitt at recycle.lbl.gov
ldoolitt at recycle.lbl.gov
Thu Jun 22 16:09:11 EDT 2006
DJ -
On Thu, Jun 22, 2006 at 03:56:12PM -0400, DJ Delorie wrote:
>
> > void *xcalloc_function(const char *file, int line, size_t nmemb, size_t size)
> > {
> > void *rv;
> > #ifdef __DMALLOC_H__
> > rv = dmalloc_malloc(file, line, (nmemb)*(size), DMALLOC_FUNC_CALLOC, 0, 0);
> > #else
> > rv = malloc((nmemb)*(size));
>
> xcalloc should call calloc, not malloc.
Oops, you're right. I cribbed from the dmalloc_malloc() line,
that cheats and adds the DMALLOC_FUNC_CALLOC.
> > This has to be duplicated
> > four times (calloc, malloc, realloc, strdup).
>
> Five. xfree().
Right again.
> > #if DMALLOC_VERSION_MAJOR != 5 || DMALLOC_VERSION_MINOR != 4
> > #warning this code untested against this dmalloc version
> > #endif
>
> Or use those defines to add ot the DMALLOC_H conditional, so that for
> older versions (what about dmalloc 6? ;) we just call malloc() and let
> the dmalloc.h #define it however it wants.
.. and then the line numbers dmalloc reports are useless.
Fine, I can live with that. A warning still might be good:
#warning dmalloc version unknown, will work but record useless line numbers
Sounds like a plan.
- Larry
More information about the geda-dev
mailing list