From 182890814881be90e28ac5183039e25709766992 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Wed, 17 Jul 2013 18:06:56 +0200 Subject: [PATCH] Don't use vasprintf() anymore on Windows. Windows doesn't actually support it, but MinGW provides it. However, with some versions of MinGW it doesn't work correctly. Instead, we vsnprintf() to a local buffer and xstrdup() the results. --- src/xalloc.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/xalloc.h b/src/xalloc.h index 6629b60..28960fb 100644 --- a/src/xalloc.h +++ b/src/xalloc.h @@ -52,9 +52,17 @@ static inline char *xstrdup(const char *s) { } static inline int xvasprintf(char **strp, const char *fmt, va_list ap) { +#ifdef HAVE_MINGW + char buf[1024]; + int result = vsnprintf(buf, sizeof buf, fmt, ap); + if(result < 0) + abort(); + *strp = xstrdup(buf); +#else int result = vasprintf(strp, fmt, ap); if(result < 0) abort(); +#endif return result; } -- 2.25.1