1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-10 08:58:16 +03:00

Remove arg cast configure checks

We can simply cast to non-const char * unconditionally.
This commit is contained in:
Nick Wellnhofer 2022-09-04 03:19:01 +02:00
parent 2d164d6835
commit fe02289fa5
6 changed files with 6 additions and 57 deletions

View File

@ -143,15 +143,6 @@ if (NOT MSVC)
if(HAVE_ATTRIBUTE_DESTRUCTOR)
set(ATTRIBUTE_DESTRUCTOR "__attribute__((destructor))")
endif()
check_c_source_compiles("
#include <netdb.h>
int main() { (void) gethostbyname((const char*) \"\"); return 0; }
" GETHOSTBYNAME_ARG_CAST_CONST)
if(NOT GETHOSTBYNAME_ARG_CAST_CONST)
set(GETHOSTBYNAME_ARG_CAST "(char *)")
else()
set(GETHOSTBYNAME_ARG_CAST "/**/")
endif()
check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
check_struct_has_member("struct sockaddr_storage" ss_family "sys/socket.h" HAVE_SS_FAMILY)
check_struct_has_member("struct sockaddr_storage" __ss_family "sys/socket.h" HAVE_BROKEN_SS_FAMILY)
@ -191,15 +182,6 @@ if (NOT MSVC)
check_function_exists(va_copy HAVE_VA_COPY)
check_function_exists(__va_copy HAVE___VA_COPY)
set(LT_OBJDIR ".libs/")
check_c_source_compiles("
#include <sys/socket.h>
int main() { (void) send(1, (const char*) \"\", 1, 1); return 0; }
" SEND_ARG2_CAST_CONST)
if(NOT SEND_ARG2_CAST_CONST)
set(SEND_ARG2_CAST "(char *)")
else()
set(SEND_ARG2_CAST "/**/")
endif()
check_c_source_compiles("
#include <stdarg.h>
void a(va_list* ap) {};

View File

@ -4,9 +4,6 @@
/* Define if __attribute__((destructor)) is accepted */
#cmakedefine ATTRIBUTE_DESTRUCTOR @ATTRIBUTE_DESTRUCTOR@
/* Type cast for the gethostbyname() argument */
#cmakedefine GETHOSTBYNAME_ARG_CAST @GETHOSTBYNAME_ARG_CAST@
/* Define to 1 if you have the <arpa/inet.h> header file. */
#cmakedefine HAVE_ARPA_INET_H 1
@ -138,9 +135,6 @@
/* Define to the version of this package. */
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
/* Type cast for the send() function 2nd arg */
#cmakedefine SEND_ARG2_CAST @SEND_ARG2_CAST@
/* Support for IPv6 */
#cmakedefine SUPPORT_IP6 1

View File

@ -381,36 +381,6 @@ AC_TRY_COMPILE2([
XML_SOCKLEN_T="int"])])])
AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
dnl Checking if gethostbyname() argument is const.
AC_MSG_CHECKING([for const gethostbyname() argument])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
[[(void)gethostbyname((const char *)"");]])],
have_gethostbyname_const_arg=yes,
have_gethostbyname_const_arg=no)
AC_MSG_RESULT($have_gethostbyname_const_arg)
if test x"$have_gethostbyname_const_arg" = x"yes"; then
AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [],
[Type cast for the gethostbyname() argument])
else
AC_DEFINE([GETHOSTBYNAME_ARG_CAST], [(char *)],
[Type cast for the gethostbyname() argument])
fi
dnl Checking if send() second argument is const.
AC_MSG_CHECKING([for const send() second argument])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]],
[[(void)send(1,(const char *)"",1,1);]])],
have_send_const_arg2=yes,
have_send_const_arg2=no)
AC_MSG_RESULT($have_send_const_arg2)
if test x"$have_send_const_arg2" = x"yes"; then
AC_DEFINE([SEND_ARG2_CAST], [],
[Type cast for the send() function 2nd arg])
else
AC_DEFINE([SEND_ARG2_CAST], [(char *)],
[Type cast for the send() function 2nd arg])
fi
dnl
dnl Checking for availability of IPv6
dnl

View File

@ -1,9 +1,6 @@
#ifndef __LIBXML_WIN32_CONFIG__
#define __LIBXML_WIN32_CONFIG__
#define SEND_ARG2_CAST
#define GETHOSTBYNAME_ARG_CAST
#define HAVE_SYS_STAT_H
#define HAVE_STAT
#define HAVE_FCNTL_H

View File

@ -88,6 +88,9 @@
#define XML_SOCKLEN_T unsigned int
#endif
#define GETHOSTBYNAME_ARG_CAST (char *)
#define SEND_ARG2_CAST (char *)
#define FTP_COMMAND_OK 200
#define FTP_SYNTAX_ERROR 500
#define FTP_GET_PASSWD 331

View File

@ -85,6 +85,9 @@
#define XML_SOCKLEN_T unsigned int
#endif
#define GETHOSTBYNAME_ARG_CAST (char *)
#define SEND_ARG2_CAST (char *)
#ifdef STANDALONE
#define DEBUG_HTTP
#define xmlStrncasecmp(a, b, n) strncasecmp((char *)a, (char *)b, n)