[PATCH:libXt 2/4] Add XtAsprintf() to Alloc.c & Intrinsic.h
Alan Coopersmith
alan.coopersmith at oracle.com
Tue Dec 14 10:36:55 PST 2010
walter harms wrote:
>
> Am 14.12.2010 01:40, schrieb Alan Coopersmith:
>> Like asprintf() but using XtMalloc() to tie into the Xt memory allocation
>> and error handling subsystems.
>
> should that have a "#ifndef HAVE_ASPRINTF" ? when the system has asprintf why no use it ?
Because the system asprintf() uses malloc, and we need to use XtMalloc() so
that the Xt error handlers are called on failure (notice that Xt never checks
for failure, since failure in Xt is considered fatal, but the program can
provide an error handler for cleanup before exiting), and so that programs
can call XtFree() on the returned string without worrying about which memory
allocation library was used to allocate it (apparently a bigger problem on
Windows, but I can build Unix environments with different memory allocators
for different libraries - I just don't recommend trying it).
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Platform Engineering: X Window System
More information about the xorg-devel
mailing list