From: Nikos Mavrogiannopoulos Date: Mon, 5 Nov 2001 16:41:55 +0000 (+0000) Subject: added support for va_copy X-Git-Tag: gnutls_0_2_11~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8be8a91c687ad175bad0e79a8110fe8be4d98fc8;p=thirdparty%2Fgnutls.git added support for va_copy --- diff --git a/acconfig.h b/acconfig.h index b26e72d584..121cbab932 100644 --- a/acconfig.h +++ b/acconfig.h @@ -21,6 +21,9 @@ #undef GNUTLS_VERSION #undef USE_SIGNALS +#undef USE_VA_COPY +#undef HAVE_VA_COPY +#undef HAVE___VA_COPY #undef LIBMCRYPT22 #undef LIBMCRYPT24 diff --git a/configure.in b/configure.in index 86e53dbf2a..8aae057b45 100644 --- a/configure.in +++ b/configure.in @@ -132,6 +132,52 @@ AC_CHECK_HEADERS(utime.h zlib.h errno.h signal.h) AC_CHECK_FUNCS(signal sigaction,AC_DEFINE(USE_SIGNALS),) AC_CHECK_FUNCS(bzero memset lstat stat umask utime memmove bcopy getpwuid,,) +dnl Defines USE_VA_COPY +AC_MSG_CHECKING([whether we have va_copy or __va_copy]) +AC_TRY_RUN( +changequote(<<, >>)dnl +<<#include +int main() { +va_list a,b; +va_copy(a, b); +return 0; +} +>> +changequote([, ])dnl +, +dnl ************ HAVE_VA_COPY +AC_DEFINE(HAVE_VA_COPY) +AC_DEFINE(USE_VA_COPY) +AC_MSG_RESULT(va_copy) +, +dnl ************ NO VA_COPY + dnl Defines USE_VA_COPY + AC_TRY_RUN( + changequote(<<, >>)dnl + <<#include + int main() { + va_list a,b; + __va_copy(a, b); + return 0; + } + >> + changequote([, ])dnl + , + dnl ************ HAVE___VA_COPY + AC_DEFINE(HAVE___VA_COPY) + AC_DEFINE(USE_VA_COPY) + AC_MSG_RESULT(__va_copy) + , + dnl ************ NO __VA_COPY + AC_MSG_RESULT(none) + ) +, +dnl **** CROSS COMPILING +AC_MSG_RESULT(none) +) + + + AC_CHECK_LIB(gdbm, gdbm_open,, AC_MSG_WARN("GDBM was not found. You will not be able to use Server side session resuming.")) AC_CHECK_LIB(z, compress,,AC_MSG_WARN("ZLIB was not found. You will not be able to use ZLIB compression.")) diff --git a/lib/defines.h b/lib/defines.h index 485a0a7667..42d68e2016 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -109,4 +109,10 @@ # endif #endif +#ifdef USE_VA_COPY +# ifndef HAVE_VA_COPY +# define va_copy(x,y) __va_copy(x,y) +# endif +#endif + #endif /* defines_h */ diff --git a/lib/gnutls_priority.c b/lib/gnutls_priority.c index 747dfbf844..a5c94de94d 100644 --- a/lib/gnutls_priority.c +++ b/lib/gnutls_priority.c @@ -44,7 +44,11 @@ int gnutls_set_cipher_priority( GNUTLS_STATE state, GNUTLS_LIST) { va_start( ap, state); +#ifdef USE_VA_COPY + va_copy( _ap, ap); +#else _ap = ap; +#endif while( va_arg(ap, BulkCipherAlgorithm) != 0) { num++; @@ -86,7 +90,12 @@ int gnutls_set_kx_priority( GNUTLS_STATE state, GNUTLS_LIST) { int i,num=0; va_start( ap, state); + +#ifdef USE_VA_COPY + va_copy( _ap, ap); +#else _ap = ap; +#endif while( va_arg(ap, KXAlgorithm) != 0) { num++; @@ -127,7 +136,12 @@ int gnutls_set_mac_priority( GNUTLS_STATE state, GNUTLS_LIST) { va_start( ap, state); +#ifdef USE_VA_COPY + va_copy( _ap, ap); +#else _ap = ap; +#endif + while( va_arg(ap, MACAlgorithm) != 0) { num++; } @@ -166,7 +180,12 @@ int gnutls_set_compression_priority( GNUTLS_STATE state, GNUTLS_LIST) { va_list _ap; va_start( ap, state); + +#ifdef USE_VA_COPY + va_copy( _ap, ap); +#else _ap = ap; +#endif while( va_arg( ap, CompressionMethod) != 0) { num++; @@ -205,7 +224,12 @@ int gnutls_set_protocol_priority( GNUTLS_STATE state, GNUTLS_LIST) { va_list _ap; va_start( ap, state); + +#ifdef USE_VA_COPY + va_copy( _ap, ap); +#else _ap = ap; +#endif while( va_arg( ap, int) != 0) { num++;