RFC: getting rid of Xalloc/Xfree/... in server
Matt Turner
mattst88 at gmail.com
Wed May 5 13:00:39 PDT 2010
On Wed, May 5, 2010 at 3:27 PM, Mikhail Gusarov <dottedmag at dottedmag.net> wrote:
> Hi,
>
> There is RFC patchset which gets rid of Xalloc/Xfree/... wrappers in X
> server while retaining the API and ABI.
>
> URL: git://anongit.freedesktop.org/~dottedmag/xserver no-xalloc
>
> The changes are as the following:
>
> * Xalloc/Xfree/Xrealloc/Xcalloc (and lowercase macros) usage is
> replaced by malloc/free/realloc/calloc.
>
> * lowercase macros are kept in headers as is
>
> * X* functions are cleaned up (no longer manual alignment tricks) and
> became just a plain wrappers without additional functionality.
>
> * X* functions are marked as deprecated.
>
> * XNF*/xnf* functions are kept as is, except that all XNF* uses in X
> server are replaced by xnf* for consistency.
>
> If retaining ABI is not necessary at this point of server lifecycle, it
> should be relatively easy to drop X* and XNF* exported symbols
> altogether, keeping xnf* functions and handful of compatibility macros.
>
> --
> http://fossarchy.blogspot.com/
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>
Hi,
I like the idea. I wondered many times why these wrappers exist, but
the answer to that kind of question seems to always begin with "long
ago..."
My concern is that free(), when called on a location that has already
been free()d, has an undefined behavior [1]. I'm afraid that the
xserver actually depends on this. This is definitely _not_ a reason to
not kill off the wrappers though, we just need to identify the places
the xserver does this.
Matt
[1] http://www.opengroup.org/onlinepubs/009695399/functions/free.html
More information about the xorg-devel
mailing list