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.
This commit is contained in:
Guus Sliepen 2013-07-17 18:06:56 +02:00
parent 54127996ca
commit 1828908148

View file

@ -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;
}