About Xalloc()/Xfree() function used in liblbxutil library.

Carsten Haitzler (The Rasterman) raster at rasterman.com
Sat Sep 15 21:26:05 PDT 2007

On Sun, 16 Sep 2007 00:15:34 -0400 Bernardo Innocenti <bernie at codewiz.org>

> Tadashi Koike wrote:
> > But I think when "Library and server implementations are separate"
> > (reference: lib/liblbxutil/README), that dependence should be
> > got rid of.
> You could replace Xalloc() with malloc() and Xfree() with free().
> The only functional difference is that Xalloc() aborts on failure,
> while malloc() is _documented_ to return a NULL pointer on failure
> (but on Linux, I guess the OOM will kick in first ;-)

that depends - it can and will return NULL's without an OOM kick in. i try
alloc 3.5gb of ram and i know it will return NULL - i literally am out of
address space to find a 3.5gb chunk. :) 

> I'd be in favor of killing these ugly leftovers from an ancient
> age when OSes really sucked.
> A less drastic approach would be to convert all code to use
> xmalloc() and xcalloc() macro wrappers, which are a more common
> idiom these days.
> If the other X developers agree, I'd be glad to post a patch to
> do this.
> -- 
>    //  Bernardo Innocenti - http://www.codewiz.org/
>  \X/ One Laptop Per Child - http://www.laptop.org/
> _______________________________________________
> xorg mailing list
> xorg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xorg

------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster at rasterman.com
Tokyo, Japan (東京 日本)

More information about the xorg mailing list