[libxml2] Remove ICONV_CONST test



commit 21ddad52840195b443ea57cf1cd0e123a8c10c24
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Fri Mar 4 01:07:40 2022 +0100

    Remove ICONV_CONST test
    
    We can simply cast the offending pointer to (void *).

 CMakeLists.txt         | 17 -----------------
 config.h.cmake.in      |  3 ---
 configure.ac           | 23 -----------------------
 encoding.c             |  5 ++++-
 include/win32config.h  |  4 ----
 os400/os400config.h.in |  3 ---
 vms/config.vms         |  2 --
 7 files changed, 4 insertions(+), 53 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6794148..1c37b8cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -194,23 +194,6 @@ else()
        check_include_files(unistd.h HAVE_UNISTD_H)
        check_function_exists(va_copy HAVE_VA_COPY)
        check_function_exists(__va_copy HAVE___VA_COPY)
-       check_c_source_compiles("
-               #include <stdlib.h>
-               #include <iconv.h>
-               extern
-               #ifdef __cplusplus
-               \"C\"
-               #endif
-               #if defined(__STDC__) || defined(__cplusplus)
-               size_t iconv(iconv_t cd, char** inbuf, size_t* inbytesleft, char** outbuf, size_t* 
outbytesleft);
-               #else
-               size_t iconv();
-               #endif
-               int main() { return 0; }
-       " ICONV_CONST_TEST)
-       if(NOT ICONV_CONST_TEST)
-               set(ICONV_CONST "const")
-       endif()
        set(LT_OBJDIR ".libs/")
        check_c_source_compiles("
                #include <sys/socket.h>
diff --git a/config.h.cmake.in b/config.h.cmake.in
index bb9d340d..5af19f9a 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -123,9 +123,6 @@
 /* Whether __va_copy() is available */
 #cmakedefine HAVE___VA_COPY 1
 
-/* Define as const if the declaration of iconv() needs const. */
-#define ICONV_CONST @ICONV_CONST@
-
 /* Define to the sub-directory where libtool stores uninstalled libraries. */
 #cmakedefine LT_OBJDIR "@LT_OBJDIR@"
 
diff --git a/configure.ac b/configure.ac
index 5f9dfa78..496018de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1370,29 +1370,6 @@ iconv (cd, NULL, NULL, NULL, NULL);]])],[
                AC_MSG_RESULT(no)
                LIBS="${_libs}"
                LDFLAGS="${_ldflags}"])]))
-
-       if test "$WITH_ICONV" = "1" ; then
-               AC_MSG_CHECKING([for iconv declaration])
-               AC_CACHE_VAL(xml_cv_iconv_arg2, [
-                       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
-#include <iconv.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-#if defined(__STDC__) || defined(__cplusplus)
-size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
-#else
-size_t iconv();
-#endif
-]], [])], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
-
-               xml_cv_iconv_decl="extern size_t iconv (iconv_t cd, $xml_cv_iconv_arg2 char * *inbuf, size_t 
*inbytesleft, char * *outbuf, size_t *outbytesleft);"
-               AC_MSG_RESULT([${xml_xxx:-
-       }$xml_cv_iconv_decl])
-               AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
-                       [Define as const if the declaration of iconv() needs const.])
-       fi
 fi
 case "$host" in
        *mingw*) M_LIBS=""
diff --git a/encoding.c b/encoding.c
index 8b01b96c..951c5285 100644
--- a/encoding.c
+++ b/encoding.c
@@ -1840,7 +1840,10 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
     }
     icv_inlen = *inlen;
     icv_outlen = *outlen;
-    ret = iconv(cd, (ICONV_CONST char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
+    /*
+     * Some versions take const, other versions take non-const input.
+     */
+    ret = iconv(cd, (void *) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
     *inlen -= icv_inlen;
     *outlen -= icv_outlen;
     if ((icv_inlen != 0) || (ret == (size_t) -1)) {
diff --git a/include/win32config.h b/include/win32config.h
index 41618cc1..5a935d04 100644
--- a/include/win32config.h
+++ b/include/win32config.h
@@ -12,10 +12,6 @@
 
 #include <libxml/xmlversion.h>
 
-#ifndef ICONV_CONST
-#define ICONV_CONST const
-#endif
-
 /*
  * Windows platforms may define except 
  */
diff --git a/os400/os400config.h.in b/os400/os400config.h.in
index 4497b07a..479486e2 100644
--- a/os400/os400config.h.in
+++ b/os400/os400config.h.in
@@ -119,9 +119,6 @@
 /* Whether __va_copy() is available */
 #undef HAVE___VA_COPY
 
-/* Define as const if the declaration of iconv() needs const. */
-#define ICONV_CONST
-
 /* Define to the sub-directory in which libtool stores uninstalled libraries.
    */
 #undef LT_OBJDIR
diff --git a/vms/config.vms b/vms/config.vms
index b7a2fc87..1ba9df88 100755
--- a/vms/config.vms
+++ b/vms/config.vms
@@ -11,8 +11,6 @@
 #undef HAVE_LIBHISTORY
 #undef HAVE_LIBREADLINE
 
-#define ICONV_CONST
-
 /* Define if you have the <arpa/inet.h> header file.  */
 #undef HAVE_ARPA_INET_H
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]