[EMAIL PROTECTED] on 05/02/2000 03:13:34 PM
>i agree in principle ;).  It probably would be better to
>use calloc, within the xmalloc call( as that calloc will zero
>out the memory for you ), then malloc.

Larry's convinced me otherwise.  IMHO, the "right" way to fix the problem is to
have constructor-like functions to initialize the memory.  This would always
guarantee that the memory is initialized properly (given that anyone who changes
the structure also changes the constructor -- but at least it'd be easier to see
what needs to be changed).

>Although looking at the xmalloc call, I don't know if it's such
>a good thing for it to take a 0 length request and turn it into
>a 1 byte request.  Why would we need to ask for a 0 length portion
>of memory?

I was looking at that, too.  I tend to feel that 0-byte allocations should be
allowed (returning NULL) and, if systems' frees don't handle NULL properly,
there should be an xfree() that'll do so.

Noel



Reply via email to