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:
parent
54127996ca
commit
1828908148
1 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue