[PATCH 2/7] Add asprintf() implementation for platforms without it

Jeremy Huddleston jeremyhu at apple.com
Fri Dec 3 22:35:36 PST 2010


On Dec 3, 2010, at 21:09, Alan Coopersmith wrote:
...
> +extern _X_EXPORT int Xasprintf (char **ret,
> +				const char * _X_RESTRICT_KYWD fmt,
> +				...) _X_ATTRIBUTE_PRINTF(2,3);
> +extern _X_EXPORT int Xvasprintf (char **ret,
> +				 const char * _X_RESTRICT_KYWD fmt,
> +				 va_list va);
> +extern _X_EXPORT int XNFasprintf (char **ret,
> +				  const char * _X_RESTRICT_KYWD fmt,
> +				  ...) _X_ATTRIBUTE_PRINTF(2,3);
> +extern _X_EXPORT int XNFvasprintf (char **ret,
> +				   const char * _X_RESTRICT_KYWD fmt,
> +				   va_list va);
> +
> 

...

> -extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
> -extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va);
> -extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
> -extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va);
> +/* Include new X*asprintf API */
> +#include "Xprintf.h"
> +
> +/* Older api deprecated in favor of the asprintf versions */
> +extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED;
> +extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va) _X_DEPRECATED;
> +extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED;
> +extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va) _X_DEPRECATED;
> 

The "v" versions are missing _X_ATTRIBUTE_PRINTF.  They should be _X_ATTRIBUTE_PRINTF(2,0) for the "as" ones and _X_ATTRIBUTE_PRINTF(1,0) for
the vanilla ones.


More information about the xorg-devel mailing list