xserver: Cleaning up memory allocation functions and macros

Daniel Stone daniel at fooishbar.org
Mon Apr 30 14:50:24 PDT 2007


On Mon, Apr 30, 2007 at 01:18:47PM -0700, Alan Coopersmith wrote:
> Egbert Eich wrote:
> > >   - free() can take NULL as argument, so it's not needed to test for 
> > NULL > before calling it.
> >
> >Maybe not on all implementations? If we use a wrapper or macro this
> >can be handled there. The default wrapper doesn't need to address this.
> 
> Digging out my ancient copy of the Annotated ANSI C Standard (C89), it 
> requires
> free(NULL) to be safe - "If ptr is a null pointer, no action occurs."

Likewise, the standard specifies realloc() to malloc() on NULL.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20070501/d2e93479/attachment.pgp>


More information about the xorg mailing list