diff --git a/CMakeLists.txt b/CMakeLists.txt index c7c9eeb9..db8c2ab4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,19 +157,7 @@ if (NOT MSVC) check_include_files(sys/timeb.h HAVE_SYS_TIMEB_H) check_include_files(sys/time.h HAVE_SYS_TIME_H) check_include_files(unistd.h HAVE_UNISTD_H) - check_symbol_exists(va_copy stdarg.h HAVE_VA_COPY) - check_symbol_exists(__va_copy stdarg.h HAVE___VA_COPY) set(LT_OBJDIR ".libs/") - check_c_source_compiles(" - #include - void a(va_list* ap) {}; - int main() { va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1; return 0; } - " VA_LIST_IS_ARRAY_TEST) - if(VA_LIST_IS_ARRAY_TEST) - set(VA_LIST_IS_ARRAY FALSE) - else() - set(VA_LIST_IS_ARRAY TRUE) - endif() check_c_source_compiles(" #include #include diff --git a/config.h.cmake.in b/config.h.cmake.in index 8fd47dea..4b2a21ba 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -90,15 +90,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UNISTD_H 1 -/* Whether va_copy() is available */ -#cmakedefine HAVE_VA_COPY 1 - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_ZLIB_H 1 -/* Whether __va_copy() is available */ -#cmakedefine HAVE___VA_COPY 1 - /* Define to the sub-directory where libtool stores uninstalled libraries. */ #cmakedefine LT_OBJDIR "@LT_OBJDIR@" @@ -126,9 +120,6 @@ /* Support for IPv6 */ #cmakedefine SUPPORT_IP6 1 -/* Define if va_list is an array type */ -#cmakedefine VA_LIST_IS_ARRAY 1 - /* Version number of package */ #cmakedefine VERSION "@VERSION@" diff --git a/configure.ac b/configure.ac index 63078475..f495d02e 100644 --- a/configure.ac +++ b/configure.ac @@ -317,37 +317,6 @@ AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */ # undef /**/ HAVE_MMAP #endif]) -dnl Checking for va_copy availability -AC_MSG_CHECKING([for va_copy]) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include -va_list ap1,ap2;]], [[va_copy(ap1,ap2);]])], -have_va_copy=yes, -have_va_copy=no) -AC_MSG_RESULT($have_va_copy) -if test x"$have_va_copy" = x"yes"; then - AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available]) -else - AC_MSG_CHECKING([for __va_copy]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include - va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])], - have___va_copy=yes, - have___va_copy=no) - AC_MSG_RESULT($have___va_copy) - if test x"$have___va_copy" = x"yes"; then - AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available]) - fi -fi - -dnl Checking whether va_list is an array type -AC_MSG_CHECKING([whether va_list is an array type]) -AC_TRY_COMPILE2([ -#include -void a(va_list * ap) {}],[ -va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1],[ - AC_MSG_RESULT(no)],[ - AC_MSG_RESULT(yes) - AC_DEFINE([VA_LIST_IS_ARRAY], [1],[Define if va_list is an array type])]) - dnl dnl Checks for inet libraries dnl diff --git a/xmlreader.c b/xmlreader.c index 5c37738e..7dd6a69c 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -54,26 +54,11 @@ #define MAX_FREE_NODES 100 #endif -/* - * The following VA_COPY was coded following an example in - * the Samba project. It may not be sufficient for some - * esoteric implementations of va_list but (hopefully) will - * be sufficient for libxml2. - */ -#ifndef VA_COPY - #ifdef HAVE_VA_COPY - #define VA_COPY(dest, src) va_copy(dest, src) +#ifndef va_copy + #ifdef __va_copy + #define va_copy(dest, src) __va_copy(dest, src) #else - #ifdef HAVE___VA_COPY - #define VA_COPY(dest,src) __va_copy(dest, src) - #else - #ifndef VA_LIST_IS_ARRAY - #define VA_COPY(dest,src) (dest) = (src) - #else - #include - #define VA_COPY(dest,src) memcpy((char *)(dest),(char *)(src),sizeof(va_list)) - #endif - #endif + #define va_copy(dest, src) memcpy(dest, src, sizeof(va_list)) #endif #endif @@ -4590,7 +4575,7 @@ xmlTextReaderBuildMessage(const char *msg, va_list ap) { va_list aq; while (1) { - VA_COPY(aq, ap); + va_copy(aq, ap); chars = vsnprintf(str, size, msg, aq); va_end(aq); if (chars < 0) { diff --git a/xmlwriter.c b/xmlwriter.c index ad6e00cc..686c99ec 100644 --- a/xmlwriter.c +++ b/xmlwriter.c @@ -11,6 +11,7 @@ #define IN_LIBXML #include "libxml.h" #include +#include #include #include @@ -30,26 +31,11 @@ #define B64LINELEN 72 #define B64CRLF "\r\n" -/* - * The following VA_COPY was coded following an example in - * the Samba project. It may not be sufficient for some - * esoteric implementations of va_list but (hopefully) will - * be sufficient for libxml2. - */ -#ifndef VA_COPY - #ifdef HAVE_VA_COPY - #define VA_COPY(dest, src) va_copy(dest, src) +#ifndef va_copy + #ifdef __va_copy + #define va_copy(dest, src) __va_copy(dest, src) #else - #ifdef HAVE___VA_COPY - #define VA_COPY(dest,src) __va_copy(dest, src) - #else - #ifndef VA_LIST_IS_ARRAY - #define VA_COPY(dest,src) (dest) = (src) - #else - #include - #define VA_COPY(dest,src) memcpy((char *)(dest),(char *)(src),sizeof(va_list)) - #endif - #endif + #define va_copy(dest, src) memcpy(dest, src, sizeof(va_list)) #endif #endif @@ -4486,7 +4472,7 @@ xmlTextWriterVSprintf(const char *format, va_list argptr) return NULL; } - VA_COPY(locarg, argptr); + va_copy(locarg, argptr); while (((count = vsnprintf((char *) buf, size, format, locarg)) < 0) || (count == size - 1) || (count == size) || (count > size)) { va_end(locarg); @@ -4498,7 +4484,7 @@ xmlTextWriterVSprintf(const char *format, va_list argptr) "xmlTextWriterVSprintf : out of memory!\n"); return NULL; } - VA_COPY(locarg, argptr); + va_copy(locarg, argptr); } va_end(locarg);