From: Francesco Chemolli <5175948+kinkie@users.noreply.github.com> Date: Fri, 21 Apr 2023 16:25:02 +0000 (+0000) Subject: Maintenance: Use C++ stdlib headers (#1314) X-Git-Tag: SQUID_7_0_1~453 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b84e2b384b7ad0bb0c0d1b3b5a442299aa121be3;p=thirdparty%2Fsquid.git Maintenance: Use C++ stdlib headers (#1314) In C++ files, use C++ standard library headers instead of their (guarded) C equivalents (e.g., use `` instead of ``). --- diff --git a/compat/cpu.h b/compat/cpu.h index f832063ad5..5734b3501f 100644 --- a/compat/cpu.h +++ b/compat/cpu.h @@ -9,9 +9,8 @@ #ifndef SQUID_COMPAT_CPU_H #define SQUID_COMPAT_CPU_H -#if HAVE_ERRNO_H -#include /* for ENOTSUP */ -#endif +#include + #if HAVE_SCHED_H #include #endif diff --git a/compat/getaddrinfo.cc b/compat/getaddrinfo.cc index 17a3bbe147..c4b51b25ea 100644 --- a/compat/getaddrinfo.cc +++ b/compat/getaddrinfo.cc @@ -57,15 +57,9 @@ #undef _POSIX_C_SOURCE #undef _XOPEN_SOURCE -#if HAVE_STRING_H -#include -#endif -#if HAVE_CTYPE_H -#include -#endif -#if HAVE_ERRNO_H -#include -#endif +#include +#include +#include #if HAVE_SYS_SOCKET_H #include #endif diff --git a/compat/getnameinfo.cc b/compat/getnameinfo.cc index 05924ef157..55d08f70bb 100644 --- a/compat/getnameinfo.cc +++ b/compat/getnameinfo.cc @@ -106,18 +106,10 @@ #if HAVE_RESOLV_H #include #endif -#if HAVE_STRING_H -#include -#endif -#if HAVE_STDDEF_H -#include -#endif -#if HAVE_ERRNO_H -#include -#endif -#if HAVE_INTTYPES_H -#include -#endif +#include +#include +#include +#include #if _SQUID_WINDOWS_ #undef IN_ADDR diff --git a/compat/inet_ntop.cc b/compat/inet_ntop.cc index 1bf2c9d222..574ce4d3ae 100644 --- a/compat/inet_ntop.cc +++ b/compat/inet_ntop.cc @@ -74,12 +74,8 @@ static const char rcsid[] = "inet_ntop.c,v 1.1.2.1.8.2 2005/11/03 23:08:40 marka #include #endif -#if HAVE_ERRNO_H -#include -#endif -#if HAVE_STRING_H -#include -#endif +#include +#include #if ! defined(NS_INADDRSZ) #define NS_INADDRSZ 4 diff --git a/compat/inet_pton.cc b/compat/inet_pton.cc index 03e7fe9c48..6ff6a34e08 100644 --- a/compat/inet_pton.cc +++ b/compat/inet_pton.cc @@ -69,12 +69,8 @@ static const char rcsid[] = "inet_pton.c,v 1.2.206.2 2005/07/28 07:43:18 marka E #if HAVE_ARPA_NAMESER_H #include #endif -#if HAVE_STRING_H -#include -#endif -#if HAVE_ERRNO_H -#include -#endif +#include +#include #if ! defined(NS_INADDRSZ) #define NS_INADDRSZ 4 diff --git a/compat/shm.h b/compat/shm.h index 6006dd95fa..cf136c741d 100644 --- a/compat/shm.h +++ b/compat/shm.h @@ -25,9 +25,7 @@ #else /* HAVE_SHM */ -#if HAVE_ERRNO_H -#include -#endif +#include extern "C" { diff --git a/compat/xis.h b/compat/xis.h index 419272777b..d0391dd22a 100644 --- a/compat/xis.h +++ b/compat/xis.h @@ -9,11 +9,9 @@ #ifndef _SQUID_COMPAT_XIS_H #define _SQUID_COMPAT_XIS_H -#if HAVE_CTYPE_H -#include -#endif - #if __cplusplus +#include + #define xisspace(x) isspace(static_cast(x)) #define xtoupper(x) toupper(static_cast(x)) #define xtolower(x) tolower(static_cast(x)) @@ -30,6 +28,11 @@ #define xisgraph(x) isgraph(static_cast(x)) #else /* ! __cplusplus */ + +#if HAVE_CTYPE_H +#include +#endif + #define xisspace(x) isspace((unsigned char)x) #define xtoupper(x) toupper((unsigned char)x) #define xtolower(x) tolower((unsigned char)x) diff --git a/lib/libTrie/TrieCharTransform.h b/lib/libTrie/TrieCharTransform.h index 03450eda50..358c211ce9 100644 --- a/lib/libTrie/TrieCharTransform.h +++ b/lib/libTrie/TrieCharTransform.h @@ -21,9 +21,9 @@ /* C++ bindings */ #else +#include #include #include -#include /* TODO: parameterize this to be more generic - * i.e. M-ary internal node sizes etc diff --git a/lib/ntlmauth/support_bits.cci b/lib/ntlmauth/support_bits.cci index 37a381b06b..fdcdca5838 100644 --- a/lib/ntlmauth/support_bits.cci +++ b/lib/ntlmauth/support_bits.cci @@ -9,9 +9,7 @@ #ifndef SQUID_LIBNTLMAUTH_SUPPORT_BITS_CCI #define SQUID_LIBNTLMAUTH_SUPPORT_BITS_CCI -#if HAVE_STRING_H -#include -#endif +#include /* * Defines several functions which are used and mutually shared by the NTLM helpers diff --git a/src/acl/external/AD_group/ext_ad_group_acl.cc b/src/acl/external/AD_group/ext_ad_group_acl.cc index 5f8dacffca..228789cea6 100644 --- a/src/acl/external/AD_group/ext_ad_group_acl.cc +++ b/src/acl/external/AD_group/ext_ad_group_acl.cc @@ -70,7 +70,7 @@ #include "include/util.h" #if _SQUID_CYGWIN_ -#include +#include int _wcsicmp(const wchar_t *, const wchar_t *); #endif diff --git a/src/acl/external/LM_group/ext_lm_group_acl.cc b/src/acl/external/LM_group/ext_lm_group_acl.cc index 8a35d527d6..c26c154362 100644 --- a/src/acl/external/LM_group/ext_lm_group_acl.cc +++ b/src/acl/external/LM_group/ext_lm_group_acl.cc @@ -81,7 +81,7 @@ #include "util.h" #if _SQUID_CYGWIN_ -#include +#include int _wcsicmp(const wchar_t *, const wchar_t *); #endif diff --git a/src/auth/basic/SSPI/valid.cc b/src/auth/basic/SSPI/valid.cc index e93afc2b4e..5191033aec 100644 --- a/src/auth/basic/SSPI/valid.cc +++ b/src/auth/basic/SSPI/valid.cc @@ -44,7 +44,7 @@ #endif #if _SQUID_CYGWIN_ -#include +#include #endif #include "auth/basic/SSPI/valid.h" diff --git a/src/auth/digest/eDirectory/edir_ldapext.cc b/src/auth/digest/eDirectory/edir_ldapext.cc index 6f3afc2a60..f34341c912 100644 --- a/src/auth/digest/eDirectory/edir_ldapext.cc +++ b/src/auth/digest/eDirectory/edir_ldapext.cc @@ -56,9 +56,9 @@ #include #endif -#include #include "edir_ldapext.h" +#include #define NMASLDAP_GET_LOGIN_CONFIG_REQUEST "2.16.840.1.113719.1.39.42.100.3" #define NMASLDAP_GET_LOGIN_CONFIG_RESPONSE "2.16.840.1.113719.1.39.42.100.4" diff --git a/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc b/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc index 677f4ec8ea..77a3f238e0 100644 --- a/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc +++ b/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc @@ -51,15 +51,13 @@ #include "sspwin32.h" #include "util.h" -#include -#include -#include +#include #if HAVE_GETOPT_H #include #endif -#if HAVE_CTYPE_H -#include -#endif +#include +#include +#include int Negotiate_packet_debug_enabled = 0; static int have_serverblob; diff --git a/src/auth/ntlm/SSPI/ntlm_sspi_auth.cc b/src/auth/ntlm/SSPI/ntlm_sspi_auth.cc index 8cc8d7d890..701d7ebca3 100644 --- a/src/auth/ntlm/SSPI/ntlm_sspi_auth.cc +++ b/src/auth/ntlm/SSPI/ntlm_sspi_auth.cc @@ -79,17 +79,15 @@ #include "sspwin32.h" #include "util.h" -#include +#include +#include +#include #include #include -#if HAVE_CTYPE_H -#include -#endif #if HAVE_GETOPT_H #include #endif -#include -#include +#include int NTLM_packet_debug_enabled = 0; static int have_challenge; diff --git a/src/dns/rfc1035.cc b/src/dns/rfc1035.cc index cb5595ac6b..1d022b7aae 100644 --- a/src/dns/rfc1035.cc +++ b/src/dns/rfc1035.cc @@ -19,18 +19,14 @@ #include "dns/rfc2671.h" #include "util.h" -#if HAVE_STRING_H -#include -#endif +#include +#include #if HAVE_UNISTD_H #include #endif #if HAVE_MEMORY_H #include #endif -#if HAVE_ASSERT_H -#include -#endif #if HAVE_NETINET_IN_H #include #endif diff --git a/src/dns/rfc3596.cc b/src/dns/rfc3596.cc index d489bdfb29..022a650033 100644 --- a/src/dns/rfc3596.cc +++ b/src/dns/rfc3596.cc @@ -17,9 +17,7 @@ #if HAVE_MEMORY_H #include #endif -#if HAVE_ASSERT_H -#include -#endif +#include #if HAVE_NETINET_IN_H #include #endif diff --git a/src/http/url_rewriters/LFS/rredir.cc b/src/http/url_rewriters/LFS/rredir.cc index 8dceab7e5b..b2613c696a 100644 --- a/src/http/url_rewriters/LFS/rredir.cc +++ b/src/http/url_rewriters/LFS/rredir.cc @@ -44,8 +44,8 @@ */ #include -#include -#include +#include +#include #define ACCESS_LOCAL_DIR "/var/lib/httpd/htdocs/local/rredir" #define REDIRECT_TO_URL "http://www.hacom.nl/local/rredir" diff --git a/src/parser/Tokenizer.cc b/src/parser/Tokenizer.cc index 2bac7fb1f7..0bb0b855d4 100644 --- a/src/parser/Tokenizer.cc +++ b/src/parser/Tokenizer.cc @@ -14,10 +14,8 @@ #include "parser/Tokenizer.h" #include "sbuf/Stream.h" +#include #include -#if HAVE_CTYPE_H -#include -#endif /// convenience method: consumes up to n bytes, counts, and returns them SBuf diff --git a/src/time/iso3307.cc b/src/time/iso3307.cc index 74e7678e51..9bad9076b6 100644 --- a/src/time/iso3307.cc +++ b/src/time/iso3307.cc @@ -9,12 +9,8 @@ #include "squid.h" #include "time/gadgets.h" -#if HAVE_STRING_H -#include -#endif -#if HAVE_CTYPE_H -#include -#endif +#include +#include #define ASCII_DIGIT(c) ((c)-48) diff --git a/src/time/rfc1123.cc b/src/time/rfc1123.cc index d89d22262f..5496fe9857 100644 --- a/src/time/rfc1123.cc +++ b/src/time/rfc1123.cc @@ -13,15 +13,9 @@ * Adapted from HTSUtils.c in CERN httpd 3.0 (http://info.cern.ch/httpd/) * by Darren Hardy , November 1994. */ -#if HAVE_STRING_H -#include -#endif -#if HAVE_CTYPE_H -#include -#endif -#if HAVE_TIME_H -#include -#endif +#include +#include +#include #define RFC850_STRFTIME "%A, %d-%b-%y %H:%M:%S GMT" #define RFC1123_STRFTIME "%a, %d %b %Y %H:%M:%S GMT" diff --git a/tools/purge/squid-tlv.hh b/tools/purge/squid-tlv.hh index 7a1730a9b4..df8dcb7ff7 100644 --- a/tools/purge/squid-tlv.hh +++ b/tools/purge/squid-tlv.hh @@ -51,10 +51,10 @@ typedef int bool; #endif #endif /* __cplusplus */ +#include #include #include #include -#include // taken from Squid-2.x // NOTE! We must preserve the order of this list!