diff --git a/glamor/glamor_composite_glyphs.c b/glamor/glamor_composite_glyphs.c index 4c12fb5af..faf8409c3 100644 --- a/glamor/glamor_composite_glyphs.c +++ b/glamor/glamor_composite_glyphs.c @@ -22,6 +22,7 @@ #include #include +#include #include "os/bug_priv.h" diff --git a/include/Xprintf.h b/include/Xprintf.h index ede615dd6..6babd4df9 100644 --- a/include/Xprintf.h +++ b/include/Xprintf.h @@ -49,23 +49,12 @@ * on failure. */ 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) -_X_ATTRIBUTE_PRINTF(2, 0); -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) _X_ATTRIBUTE_PRINTF(2, 0); -#if !defined(HAVE_ASPRINTF) && !defined(HAVE_VASPRINTF) -#define asprintf Xasprintf -#define vasprintf Xvasprintf -#endif - /* * These functions provide a portable implementation of the linux kernel * scnprintf & vscnprintf routines that return the number of bytes actually diff --git a/os/xprintf.c b/os/xprintf.c index ab9f193e7..b30edf2f2 100644 --- a/os/xprintf.c +++ b/os/xprintf.c @@ -65,80 +65,6 @@ #include #include -#ifdef asprintf -#undef asprintf -#endif -#ifdef vasprintf -#undef vasprintf -#endif - -#ifndef va_copy -#ifdef __va_copy -#define va_copy __va_copy -#else -#error "no working va_copy was found" -#endif -#endif - -/** - * Varargs sprintf that allocates a string buffer the right size for - * the pattern & data provided and prints the requested data to it. - * - * @param ret Pointer to which the newly allocated buffer is written - * (contents undefined on error) - * @param format printf style format string - * @param va variable argument list - * @return size of allocated buffer, or -1 on error. - */ -int -Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va) -{ -#ifdef HAVE_VASPRINTF - return vasprintf(ret, format, va); -#else - int size; - va_list va2; - - va_copy(va2, va); - size = vsnprintf(NULL, 0, format, va2); - va_end(va2); - - *ret = calloc(1, size + 1); - if (*ret == NULL) - return -1; - - vsnprintf(*ret, size + 1, format, va); - (*ret)[size] = 0; - return size; -#endif -} - -#ifndef HAVE_VASPRINTF -#define vasprintf Xvasprintf -#endif - -/** - * sprintf that allocates a string buffer the right size for - * the pattern & data provided and prints the requested data to it. - * - * @param ret Pointer to which the newly allocated buffer is written - * (contents undefined on error) - * @param format printf style format string - * @param ... arguments for specified format - * @return size of allocated buffer, or -1 on error. - */ -int -Xasprintf(char **ret, const char *_X_RESTRICT_KYWD format, ...) -{ - int size; - va_list va; - - va_start(va, format); - size = vasprintf(ret, format, va); - va_end(va); - return size; -} - /** * Varargs sprintf that allocates a string buffer the right size for * the pattern & data provided and prints the requested data to it.