Donald Sharp <[EMAIL PROTECTED]> writes:

> 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?

malloc of 0 bytes on some platforms returns NULL.  xmalloc never returns
NULL.  This is the entire point and purpose of xmalloc; you call xmalloc
because you don't ever want to deal with malloc returning NULL pointers.
Either you get a valid pointer back or the program terminates.

Allowing xmalloc to return NULL even for a special case would, in my
opinion, violate a key portion of its semantics.

-- 
Russ Allbery ([EMAIL PROTECTED])             <http://www.eyrie.org/~eagle/>

Reply via email to