windows: delete redundant headers

`winsock2.h` pulls in `windows.h`. `ws2tcpip.h` pulls in `winsock2.h`.
`winsock2.h` and `ws2tcpip.h` are also pulled by `curl/curl.h`.

Keep only those headers that are not already included, or the code under
it uses something from that specific header.

Closes #12539
This commit is contained in:
Viktor Szakats 2023-12-12 19:27:44 +00:00
parent 7e8fdad2d5
commit 03e7dff8ff
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
9 changed files with 3 additions and 33 deletions

View File

@ -169,7 +169,6 @@ int main(void) { ; return 0; }
# define WIN32_LEAN_AND_MEAN
# endif
# include <winsock2.h>
# include <windows.h>
#endif
int main(void)
{
@ -189,7 +188,6 @@ int main(void)
# define WIN32_LEAN_AND_MEAN
# endif
# include <winsock2.h>
# include <windows.h>
#endif
int main(void)
{
@ -208,7 +206,6 @@ int main(void)
# define WIN32_LEAN_AND_MEAN
# endif
# include <winsock2.h>
# include <windows.h>
#endif
int main(void)
{
@ -228,7 +225,6 @@ int main(void)
# define WIN32_LEAN_AND_MEAN
# endif
# include <winsock2.h>
# include <windows.h>
#endif
int main(void)
{
@ -304,7 +300,6 @@ int main(void)
# define WIN32_LEAN_AND_MEAN
# endif
# include <winsock2.h>
# include <windows.h>
#endif
/* includes start */
#ifdef HAVE_SYS_TYPES_H

View File

@ -589,7 +589,6 @@ AC_DEFUN([TYPE_SOCKADDR_STORAGE],
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#include <windows.h>
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@ -625,7 +624,6 @@ AC_DEFUN([CURL_CHECK_FUNC_RECV], [
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#include <windows.h>
#else
$curl_includes_bsdsocket
#ifdef HAVE_SYS_TYPES_H
@ -674,7 +672,6 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#include <windows.h>
#else
$curl_includes_bsdsocket
#ifdef HAVE_SYS_TYPES_H
@ -719,7 +716,6 @@ AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#include <windows.h>
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@ -762,7 +758,6 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#include <windows.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@ -815,7 +810,6 @@ AC_DEFUN([TYPE_IN_ADDR_T], [
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#include <windows.h>
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@ -855,7 +849,6 @@ AC_DEFUN([TYPE_IN_ADDR_T], [
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#include <windows.h>
#else
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@ -1134,7 +1127,6 @@ AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#include <windows.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>

View File

@ -1125,7 +1125,6 @@ then
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#include <windows.h>
#endif
]],[[
gethostbyname("localhost");

View File

@ -32,8 +32,6 @@
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#define close closesocket
#else
#include <sys/types.h> /* socket types */

View File

@ -91,11 +91,11 @@
#include <stdio.h>
#include <time.h>
#ifndef __CYGWIN__
#include <winsock2.h>
#include <curl/curl.h>
#ifdef _WIN32
#include <windows.h>
#endif
#include <curl/curl.h>
#define MAX_STRING 256

View File

@ -31,9 +31,6 @@ int Curl_inet_pton(int, const char *, void *);
#ifdef HAVE_INET_PTON
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#elif defined(USE_WINSOCK)
/* inet_pton() exists in Vista or later */
#include <ws2tcpip.h>
#endif
#define Curl_inet_pton(x,y,z) inet_pton(x,y,z)
#endif

View File

@ -33,9 +33,6 @@
* This is a socketpair() implementation for Windows.
*/
#include <string.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <io.h>
#else
#ifdef HAVE_NETDB_H

View File

@ -419,7 +419,6 @@ curl_includes_winsock2="\
# define WIN32_LEAN_AND_MEAN
# endif
# include <winsock2.h>
# include <windows.h>
#endif
/* includes end */"
CURL_CHECK_NATIVE_WINDOWS
@ -440,7 +439,6 @@ curl_includes_ws2tcpip="\
# endif
# include <winsock2.h>
# include <ws2tcpip.h>
# include <windows.h>
#endif
/* includes end */"
CURL_CHECK_NATIVE_WINDOWS

View File

@ -25,12 +25,6 @@
#ifdef HAVE_INET_PTON
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif