aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/u_string.h
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2019-07-19 22:09:34 +0100
committerEric Engestrom <[email protected]>2019-07-23 08:57:27 +0100
commit9607d499dcdd09160b13690397b159640fe0776f (patch)
tree7c4f023b105e0a5ea43af41b539e391c134d5e40 /src/util/u_string.h
parentaffb2da0f862e0a604a9a075f2b45d57038797d5 (diff)
util: add asprintf() wrapper for MSVC
Fixes: 856e84083eee9b22408a ("mesa/st: add sampler uniforms") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/util/u_string.h')
-rw-r--r--src/util/u_string.h12
1 files changed, 12 insertions, 0 deletions
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