tidy-up: drop redundant includes

`sys/types.h` and `sys/socket.h` (non-Win32). They are included via
`curl/curl.h` and `curl_setup.h`.

This drops `HAVE_SYS_TYPES_H` guards from the codebase. It's safe
because `sys/types.h` (POSIX) is already required unconditionally by
`curl/curl.h`. It remains used in feature checks by both autotools and
cmake; to be reviewed in a future step.

Closes #22374
This commit is contained in:
Viktor Szakats 2026-06-28 13:10:38 +02:00
parent c4dcdb8388
commit ebc5212dac
No known key found for this signature in database
7 changed files with 4 additions and 28 deletions

View file

@ -506,12 +506,15 @@
#endif
#include <limits.h>
/* Include after setting system macros that may affect type sizes
(e.g. 'off_t' or 'time_t'), or suppress warnings
(e.g. '_CRT_SECURE_NO_WARNINGS`), but before including sys/stat.h */
#include <sys/types.h>
#ifdef _WIN32
# ifdef HAVE_IO_H
# include <io.h>
# endif
# include <sys/types.h>
# include <sys/stat.h>
/* Large file (>2Gb) support using Win32 functions. */
# define curl_lseek _lseeki64
@ -830,10 +833,6 @@
#include <time.h>
#include <errno.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/stat.h>
#if !defined(_WIN32) || defined(__MINGW32__)

View file

@ -47,10 +47,6 @@
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif

View file

@ -40,10 +40,6 @@
#include "curl_setup.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "urldata.h"
#include "cfilters.h"
#include "cf-dns.h"

View file

@ -40,10 +40,6 @@
#include "curl_setup.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "urldata.h"
#include "setopt.h"
#include "strcase.h"

View file

@ -25,10 +25,6 @@
#ifdef USE_SSL
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include "urldata.h"
#include "cfilters.h"

View file

@ -30,7 +30,6 @@
# define USE_XATTR
#elif (defined(__FreeBSD_version) && (__FreeBSD_version > 500000)) || \
defined(__MidnightBSD_version)
# include <sys/types.h>
# include <sys/extattr.h>
# define USE_XATTR
#elif defined(_WIN32)

View file

@ -23,12 +23,6 @@
***************************************************************************/
#include "unitcheck.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifndef _WIN32
#include <sys/socket.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif