From b66d7317ca6c882afbe52fe426f68c119c40d348 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 1 Apr 2023 01:02:06 +0000 Subject: [PATCH] delete redundant `HAVE_WS2TCPIP_H` It was used once in `src/libssh2_priv.h`, but without any effect. The header included `ws2tcpip.h` twice, once guarded by `HAVE_WS2TCPIP_H` and another time by `HAVE_WINSOCK2_H`. Dedupe these to not use `HAVE_WS2TCPIP_H`. Then delete detection of this feature from all build methods. TODO: Replace `HAVE_WINSOCK2_H` with `_WIN32`/`WIN32`. --- CMakeLists.txt | 1 - configure.ac | 2 +- os400/libssh2_config.h | 3 --- src/libssh2_config_cmake.h.in | 1 - src/libssh2_priv.h | 14 +++++--------- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40b7563b..301718f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,7 +130,6 @@ check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) check_include_files(sys/ioctl.h HAVE_SYS_IOCTL_H) check_include_files(sys/time.h HAVE_SYS_TIME_H) check_include_files(sys/un.h HAVE_SYS_UN_H) -check_include_files(ws2tcpip.h HAVE_WS2TCPIP_H) check_include_files(winsock2.h HAVE_WINSOCK2_H) # for example and tests diff --git a/configure.ac b/configure.ac index c7f47767..6c51288f 100644 --- a/configure.ac +++ b/configure.ac @@ -289,7 +289,7 @@ case $host in # These are POSIX-like systems using BSD-like sockets API. ;; *) - AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h]) + AC_CHECK_HEADERS([windows.h winsock2.h]) ;; esac diff --git a/os400/libssh2_config.h b/os400/libssh2_config.h index 5de01fdb..df3c381d 100644 --- a/os400/libssh2_config.h +++ b/os400/libssh2_config.h @@ -137,9 +137,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_WINSOCK2_H -/* Define to 1 if you have the header file. */ -#undef HAVE_WS2TCPIP_H - /* to make a symbol visible */ #undef LIBSSH2_API diff --git a/src/libssh2_config_cmake.h.in b/src/libssh2_config_cmake.h.in index 8ee6389b..e0ccdade 100644 --- a/src/libssh2_config_cmake.h.in +++ b/src/libssh2_config_cmake.h.in @@ -45,7 +45,6 @@ #cmakedefine HAVE_SYS_IOCTL_H #cmakedefine HAVE_SYS_TIME_H #cmakedefine HAVE_SYS_UN_H -#cmakedefine HAVE_WS2TCPIP_H #cmakedefine HAVE_WINSOCK2_H /* for example and tests */ diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index adb0dca9..87c7d4db 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -78,8 +78,12 @@ # endif #endif /* WIN32 */ -#ifdef HAVE_WS2TCPIP_H +#ifdef HAVE_WINSOCK2_H +#include #include +/* Force parameter type. */ +#define recv(s, b, l, f) recv((s), (b), (int)(l), (f)) +#define send(s, b, l, f) send((s), (b), (int)(l), (f)) #endif #include @@ -164,14 +168,6 @@ struct iovec { #include "crypto.h" -#ifdef HAVE_WINSOCK2_H -#include -#include -/* Force parameter type. */ -#define recv(s, b, l, f) recv((s), (b), (int)(l), (f)) -#define send(s, b, l, f) send((s), (b), (int)(l), (f)) -#endif - #ifndef SIZE_MAX #if _WIN64 #define SIZE_MAX 0xFFFFFFFFFFFFFFFF