From 4b0511f8ace57406dcbd75a206148fc0e4180559 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sat, 25 Dec 2010 16:21:50 +0000 Subject: [PATCH] Provide fallback implementation of va_copy for VC++ and others (STR #115) --- mxml-string.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mxml-string.c b/mxml-string.c index 5a2c3f9..d83e5ea 100644 --- a/mxml-string.c +++ b/mxml-string.c @@ -29,6 +29,20 @@ #include "config.h" +/* + * The va_copy macro is part of C99, but many compilers don't implement it. + * Provide a "direct assignment" implmentation when va_copy isn't defined... + */ + +#ifndef va_copy +# ifdef __va_copy +# define va_copy(dst,src) __va_copy(dst,src) +# else +# define va_copy(dst,src) memcpy(&dst, &src, sizeof(va_list)) +# endif /* __va_copy */ +#endif /* va_copy */ + + #ifndef HAVE_SNPRINTF /* * '_mxml_snprintf()' - Format a string. @@ -58,7 +72,7 @@ _mxml_snprintf(char *buffer, /* I - Output buffer */ */ #ifndef HAVE_STRDUP -char * /* O - New string pointer */ +char * /* O - New string pointer */ _mxml_strdup(const char *s) /* I - String to duplicate */ { char *t; /* New string pointer */