aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os/xprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/os/xprintf.c')
-rw-r--r--xorg-server/os/xprintf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/xorg-server/os/xprintf.c b/xorg-server/os/xprintf.c
index 3b4bb4117..fecaa1443 100644
--- a/xorg-server/os/xprintf.c
+++ b/xorg-server/os/xprintf.c
@@ -78,7 +78,9 @@
# ifdef __va_copy
# define va_copy __va_copy
# else
+# ifndef _MSC_VER
# error "no working va_copy was found"
+# endif
# endif
#endif
@@ -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)