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 254b7374a..cc5a9b355 100644
--- a/xorg-server/os/xprintf.c
+++ b/xorg-server/os/xprintf.c
@@ -76,7 +76,9 @@
# ifdef __va_copy
# define va_copy __va_copy
# else
+# ifndef _MSC_VER
# error "no working va_copy was found"
+# endif
# endif
#endif
@@ -97,11 +99,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)