From: Eric Engestrom Date: Fri, 19 Jul 2019 21:09:34 +0000 (+0100) Subject: util: add asprintf() wrapper for MSVC X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9607d499dcdd09160b13690397b159640fe0776f;p=mesa.git util: add asprintf() wrapper for MSVC Fixes: 856e84083eee9b22408a ("mesa/st: add sampler uniforms") Signed-off-by: Eric Engestrom Reviewed-by: Eric Anholt --- diff --git a/src/util/u_string.h b/src/util/u_string.h index 499894b9f94..e7163927667 100644 --- a/src/util/u_string.h +++ b/src/util/u_string.h @@ -98,6 +98,18 @@ util_vasprintf(char **ret, const char *format, va_list ap) return vsnprintf(*ret, r + 1, format, ap); } +#define asprintf util_asprintf +static inline char * +util_asprintf(const char *fmt, ...) +{ + char *ptr; + va_list args; + va_start(args, fmt); + if (vasprintf(&ptr, fmt, args) == -1) + ptr = NULL; + va_end(args); + return ptr; +} #define strcasecmp stricmp #define strdup _strdup