diff options
Diffstat (limited to 'xorg-server/os/xprintf.c')
-rw-r--r-- | xorg-server/os/xprintf.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xorg-server/os/xprintf.c b/xorg-server/os/xprintf.c index 80caa5790..58aad894b 100644 --- a/xorg-server/os/xprintf.c +++ b/xorg-server/os/xprintf.c @@ -78,9 +78,11 @@ #ifdef __va_copy #define va_copy __va_copy #else +#ifndef _MSC_VER #error "no working va_copy was found" #endif #endif +#endif /** * Varargs sprintf that allocates a string buffer the right size for @@ -99,11 +101,16 @@ Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va) return vasprintf(ret, format, va); #else int size; + +#ifdef _MSC_VER + size = vsnprintf(NULL, 0, format, va); +#else va_list va2; va_copy(va2, va); size = vsnprintf(NULL, 0, format, va2); va_end(va2); +#endif *ret = malloc(size + 1); if (*ret == NULL) |