From: Viktor Szakats Date: Thu, 13 Feb 2025 11:05:30 +0000 (+0100) Subject: tidy-up: drop unused `CURL_INADDR_NONE` macro and `in_addr_t` type X-Git-Tag: curl-8_13_0~493 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=90b72607fa63d54dc280d20cb73f6df9ee665e02;p=thirdparty%2Fcurl.git tidy-up: drop unused `CURL_INADDR_NONE` macro and `in_addr_t` type Closes #16318 --- diff --git a/CMake/CurlTests.c b/CMake/CurlTests.c index c5a5257672..64e2eadd06 100644 --- a/CMake/CurlTests.c +++ b/CMake/CurlTests.c @@ -106,21 +106,6 @@ int main(void) } #endif -#ifdef HAVE_IN_ADDR_T -#include -#include -#include -int main(void) -{ - if((in_addr_t *) 0) - return 0; - if(sizeof(in_addr_t)) - return 0; - ; - return 0; -} -#endif - #ifdef HAVE_BOOL_T #ifdef HAVE_SYS_TYPES_H #include diff --git a/CMakeLists.txt b/CMakeLists.txt index 566863e3b2..b7ecfaa415 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1810,7 +1810,6 @@ foreach(_curl_test IN ITEMS HAVE_GETHOSTBYNAME_R_3_REENTRANT HAVE_GETHOSTBYNAME_R_5_REENTRANT HAVE_GETHOSTBYNAME_R_6_REENTRANT - HAVE_IN_ADDR_T HAVE_BOOL_T STDC_HEADERS HAVE_FILE_OFFSET_BITS @@ -1906,10 +1905,6 @@ endif() # Some other minor tests -if(NOT HAVE_IN_ADDR_T) - set(in_addr_t "unsigned long") -endif() - if(CMAKE_COMPILER_IS_GNUCC AND APPLE) include(CheckCCompilerFlag) check_c_compiler_flag("-Wno-long-double" HAVE_C_FLAG_Wno_long_double) diff --git a/acinclude.m4 b/acinclude.m4 index b550761a00..6d34f5fa68 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -793,84 +793,6 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ ]) -dnl TYPE_IN_ADDR_T -dnl ------------------------------------------------- -dnl Check for in_addr_t: it is used to receive the return code of inet_addr() -dnl and a few other things. - -AC_DEFUN([TYPE_IN_ADDR_T], [ - AC_CHECK_TYPE([in_addr_t], ,[ - dnl in_addr_t not available - AC_CACHE_CHECK([for in_addr_t equivalent], - [curl_cv_in_addr_t_equiv], [ - curl_cv_in_addr_t_equiv="unknown" - for t in "unsigned long" int size_t unsigned long; do - if test "$curl_cv_in_addr_t_equiv" = "unknown"; then - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - #undef inline - #ifdef _WIN32 - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN - #endif - #include - #else - #ifdef HAVE_SYS_TYPES_H - #include - #endif - #ifdef HAVE_SYS_SOCKET_H - #include - #endif - #ifdef HAVE_NETINET_IN_H - #include - #endif - #ifdef HAVE_ARPA_INET_H - #include - #endif - #endif - ]],[[ - $t data = inet_addr ("1.2.3.4"); - ]]) - ],[ - curl_cv_in_addr_t_equiv="$t" - ]) - fi - done - ]) - case "$curl_cv_in_addr_t_equiv" in - unknown) - AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t]) - ;; - *) - AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv, - [Type to use in place of in_addr_t when system does not provide it.]) - ;; - esac - ],[ - #undef inline - #ifdef _WIN32 - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN - #endif - #include - #else - #ifdef HAVE_SYS_TYPES_H - #include - #endif - #ifdef HAVE_SYS_SOCKET_H - #include - #endif - #ifdef HAVE_NETINET_IN_H - #include - #endif - #ifdef HAVE_ARPA_INET_H - #include - #endif - #endif - ]) -]) - - dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC dnl ------------------------------------------------- dnl Check if monotonic clock_gettime is available. diff --git a/configure.ac b/configure.ac index 45dba219b9..f1989db135 100644 --- a/configure.ac +++ b/configure.ac @@ -4005,8 +4005,6 @@ case $host_os in ;; esac -TYPE_IN_ADDR_T - TYPE_SOCKADDR_STORAGE CURL_CHECK_FUNC_SELECT diff --git a/lib/config-os400.h b/lib/config-os400.h index 0bbbc514dd..85dd2e31b0 100644 --- a/lib/config-os400.h +++ b/lib/config-os400.h @@ -234,9 +234,6 @@ /* Define to empty if `const' does not conform to ANSI C. */ #undef const -/* type to use in place of in_addr_t if not defined */ -#define in_addr_t unsigned long - /* Define to `unsigned' if does not define. */ #undef size_t diff --git a/lib/config-win32.h b/lib/config-win32.h index 7c71eb684a..f584bed5b8 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -244,9 +244,6 @@ /* TYPEDEF REPLACEMENTS */ /* ---------------------------------------------------------------- */ -/* Define if in_addr_t is not an available 'typedefed' type. */ -#define in_addr_t unsigned long - /* Define if ssize_t is not an available 'typedefed' type. */ #ifndef _SSIZE_T_DEFINED # ifdef __MINGW32__ diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake index f4f3a186d4..cbc5ff87ee 100644 --- a/lib/curl_config.h.cmake +++ b/lib/curl_config.h.cmake @@ -797,9 +797,6 @@ ${SIZEOF_TIME_T_CODE} /* Define to empty if `const' does not conform to ANSI C. */ #cmakedefine const ${const} -/* Type to use in place of in_addr_t when system does not provide it. */ -#cmakedefine in_addr_t ${in_addr_t} - /* Define to `unsigned int' if does not define. */ #cmakedefine size_t ${size_t} diff --git a/lib/hostip.h b/lib/hostip.h index 10f70b2ba8..931b40b681 100644 --- a/lib/hostip.h +++ b/lib/hostip.h @@ -195,12 +195,6 @@ Curl_cache_addr(struct Curl_easy *data, struct Curl_addrinfo *addr, const char *hostname, size_t hostlen, int port, bool permanent); -#ifndef INADDR_NONE -#define CURL_INADDR_NONE (in_addr_t) ~0 -#else -#define CURL_INADDR_NONE INADDR_NONE -#endif - /* * Function provided by the resolver backend to set DNS servers to use. */