PATCH: va_copy

Marcus Meissner meissner at suse.de
Wed Aug 7 02:46:10 CDT 2002


Hi,

On PPC you cannot assign va_list's by =, you need to use the canon
"va_copy" way. This adds autoconf checks and respective code in
msvcrt/process.c

Ciao, Marcus

License: LGPL
Changelog:
	Copy va_lists by using va_copy, not by just assigning them.

Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.67
diff -u -r1.67 configure.ac
--- configure.ac	3 Aug 2002 00:25:59 -0000	1.67
+++ configure.ac	7 Aug 2002 07:44:55 -0000
@@ -447,6 +447,34 @@
     AC_DEFINE(HAVE_PPDEV, 1, [Define if we can use ppdev.h for parallel port access])
 fi
 
+dnl **** Check for va_copy ****
+AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy,
+ AC_TRY_LINK(
+   [#include <stdarg.h>],
+   [va_list ap1, ap2;
+    va_copy(ap1,ap2);
+   ],
+   [ac_cv_c_va_copy="yes"],
+   [ac_cv_c_va_copy="no"])
+ )
+if test "$ac_cv_c_va_copy" = "yes"
+then
+    AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
+fi
+AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy,
+ AC_TRY_LINK(
+   [#include <stdarg.h>],
+   [va_list ap1, ap2;
+    __va_copy(ap1,ap2);
+   ],
+   [ac_cv_c___va_copy="yes"],
+   [ac_cv_c___va_copy="no"])
+ )
+if test "$ac_cv_c___va_copy" = "yes"
+then
+    AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
+fi
+
 dnl **** Check for IPX (currently Linux only) ****
 AC_CACHE_CHECK([for GNU style IPX support], ac_cv_c_ipx_gnu,
  AC_TRY_COMPILE(
Index: dlls/msvcrt/process.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/process.c,v
retrieving revision 1.12
diff -u -r1.12 process.c
--- dlls/msvcrt/process.c	19 Jul 2002 03:24:50 -0000	1.12
+++ dlls/msvcrt/process.c	7 Aug 2002 07:44:55 -0000
@@ -25,6 +25,10 @@
  *  open file handles, sometimes not. The docs are confusing
  * -No check for maximum path/argument/environment size is done
  */
+#include "config.h"
+
+#include <stdarg.h>
+
 #include "msvcrt.h"
 #include "ms_errno.h"
 
@@ -141,11 +145,21 @@
  */
 static char* msvcrt_valisttos(const char* arg0, va_list alist, char delim)
 {
-  va_list alist2 = alist;
+  va_list alist2;
   long size;
   const char *arg;
   char* p;
   char *ret;
+
+#if HAVE_VA_COPY
+  va_copy(alist2,alist);
+#else 
+# if HAVE___VA_COPY
+  __va_copy(alist2,alist);
+# else
+  alist2 = alist;
+# endif
+#endif
 
   if (!arg0 && !delim)
   {



More information about the wine-patches mailing list