xserver: Cleaning up memory allocation functions and macros

Alan Coopersmith alan.coopersmith at sun.com
Mon Apr 30 13:18:47 PDT 2007


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."

Requiring ANSI/ISO C89 as a minimum standard was announced in one of the old
X11R6.* releases from the original Consortium over a decade ago, so I think
it's safe to assume today.

-- 
	-Alan Coopersmith-           alan.coopersmith at sun.com
	 Sun Microsystems, Inc. - X Window System Engineering




More information about the xorg mailing list