[PATCH 1/6 v2] Add X*asprintf() routines to mirror common asprintf() routines

Julien Cristau jcristau at debian.org
Wed Dec 1 01:12:13 PST 2010


On Tue, Nov 30, 2010 at 21:53:26 -0800, Alan Coopersmith wrote:

> Provides a portable implementation of this common allocating sprintf()
> API found in many, but not yet all, of the platforms we support.
> If the platform provides vasprintf() we simply wrap it, otherwise we
> implement it - either way callers can use it regardless of platform.
> 
> Since not all platforms guarantee to NULL out the return pointer on
> failure, we don't either, and require callers to check the return
> value for -1, in order to allow easier transition to asprintf() in the
> future when we no longer support platforms without it.
> 
> The old Xprintf() API is deprecated, but left for compatibility for now.
> 
> The new API is added in a new header so that it can be used in parts of
> the server such as hw/xfree86/parser that don't include all the server
> headers.
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  configure.ac                 |    2 +-
>  hw/xfree86/loader/sdksyms.sh |    1 +
>  include/Makefile.am          |    1 +
>  include/Xprintf.h            |   63 ++++++++++++++++
>  include/dix-config.h.in      |    3 +
>  include/os.h                 |   12 ++-
>  os/xprintf.c                 |  163 +++++++++++++++++++++++++++++++++++------
>  7 files changed, 216 insertions(+), 29 deletions(-)
>  create mode 100644 include/Xprintf.h
> 
Reviewed-by: Julien Cristau <jcristau at debian.org>

Cheers,
Julien


More information about the xorg-devel mailing list