Check for va_copy declaration

ctx.c contains a workaround for systems without va_copy() support.
Improve this workaround in the way which is described in the autoconf
manual.

Also check for va_copy declaration in configure time.

Fixes #160.
This commit is contained in:
Dmitry Podgorny
2020-09-15 23:56:17 +03:00
parent 65b3a0996f
commit 4d93b6c0d6
2 changed files with 5 additions and 3 deletions

View File

@@ -33,6 +33,7 @@ AC_ARG_ENABLE([cares],
AC_SEARCH_LIBS([socket], [network socket])
AC_CHECK_FUNCS([snprintf vsnprintf])
AC_CHECK_DECLS([va_copy], [], [], [#include <stdarg.h>])
if test "x$enable_tls" != xno; then
PKG_CHECK_MODULES([openssl], [openssl],

View File

@@ -50,9 +50,10 @@
#include "resolver.h"
#include "util.h"
/* Workaround for visual studio without va_copy support. */
#if defined(_MSC_VER) && _MSC_VER < 1800 || defined(__HAIKU__)
#define va_copy(d, s) ((d) = (s))
/* Workaround for systems without va_copy support. */
#if defined(_MSC_VER) && _MSC_VER < 1800 || \
!defined(_MSC_VER) && !defined(HAVE_DECL_VA_COPY)
#define va_copy(d, s) (memcpy(&d, &s, sizeof(va_list)))
#endif
/** Initialize the Strophe library.