]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Maintenance: Use C++ stdlib headers (#1314)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Fri, 21 Apr 2023 16:25:02 +0000 (16:25 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 21 Apr 2023 19:08:24 +0000 (19:08 +0000)
In C++ files, use C++ standard library headers instead of their
(guarded) C equivalents (e.g., use `<cstdlib>` instead of `<stdlib.h>`).

22 files changed:
compat/cpu.h
compat/getaddrinfo.cc
compat/getnameinfo.cc
compat/inet_ntop.cc
compat/inet_pton.cc
compat/shm.h
compat/xis.h
lib/libTrie/TrieCharTransform.h
lib/ntlmauth/support_bits.cci
src/acl/external/AD_group/ext_ad_group_acl.cc
src/acl/external/LM_group/ext_lm_group_acl.cc
src/auth/basic/SSPI/valid.cc
src/auth/digest/eDirectory/edir_ldapext.cc
src/auth/negotiate/SSPI/negotiate_sspi_auth.cc
src/auth/ntlm/SSPI/ntlm_sspi_auth.cc
src/dns/rfc1035.cc
src/dns/rfc3596.cc
src/http/url_rewriters/LFS/rredir.cc
src/parser/Tokenizer.cc
src/time/iso3307.cc
src/time/rfc1123.cc
tools/purge/squid-tlv.hh

index f832063ad55f8b23c5982cd6967e33da9eb11d4c..5734b3501fd29965b5e0ce6e06bd248665f6be2f 100644 (file)
@@ -9,9 +9,8 @@
 #ifndef SQUID_COMPAT_CPU_H
 #define SQUID_COMPAT_CPU_H
 
-#if HAVE_ERRNO_H
-#include <errno.h> /* for ENOTSUP */
-#endif
+#include <cerrno>
+
 #if HAVE_SCHED_H
 #include <sched.h>
 #endif
index 17a3bbe1475c80778fc2a9097dd9aa9d142722ce..c4b51b25ea1bbf0ef453a0b0664485288086e9f7 100644 (file)
 #undef _POSIX_C_SOURCE
 #undef _XOPEN_SOURCE
 
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif
+#include <cstring>
+#include <cctype>
+#include <cerrno>
 #if HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index 05924ef157e72c0e4a23350985df1cc24ed11de8..55d08f70bb36fa7c6e398f0467a39110c26873ab 100644 (file)
 #if HAVE_RESOLV_H
 #include <resolv.h>
 #endif
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_STDDEF_H
-#include <stddef.h>
-#endif
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#if HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
+#include <cstring>
+#include <cstddef>
+#include <cerrno>
+#include <cinttypes>
 
 #if _SQUID_WINDOWS_
 #undef IN_ADDR
index 1bf2c9d222234f7337ca405267da966f8de3bd0c..574ce4d3aecf66f2a1306f29473973d745542192 100644 (file)
@@ -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 <arpa/nameser.h>
 #endif
 
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#if HAVE_STRING_H
-#include <string.h>
-#endif
+#include <cerrno>
+#include <cstring>
 
 #if ! defined(NS_INADDRSZ)
 #define NS_INADDRSZ      4
index 03e7fe9c48a0772a1e02720d42a0df32e6d6a982..6ff6a34e08974820d3793c8e738825a521528d5d 100644 (file)
@@ -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 <arpa/nameser.h>
 #endif
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif
+#include <cstring>
+#include <cerrno>
 
 #if ! defined(NS_INADDRSZ)
 #define NS_INADDRSZ      4
index 6006dd95fa0bca104870b66f5aae3d712c9ba24d..cf136c741d370d4e367c9d6ee44055b2ff2d05ed 100644 (file)
@@ -25,9 +25,7 @@
 
 #else /* HAVE_SHM */
 
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif
+#include <cerrno>
 
 extern "C" {
 
index 419272777bb17bbcecd008a841500c202872efed..d0391dd22a5961904ca27234ef635874ceea9df3 100644 (file)
@@ -9,11 +9,9 @@
 #ifndef _SQUID_COMPAT_XIS_H
 #define _SQUID_COMPAT_XIS_H
 
-#if HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-
 #if __cplusplus
+#include <cctype>
+
 #define xisspace(x) isspace(static_cast<unsigned char>(x))
 #define xtoupper(x) toupper(static_cast<unsigned char>(x))
 #define xtolower(x) tolower(static_cast<unsigned char>(x))
 #define xisgraph(x) isgraph(static_cast<unsigned char>(x))
 
 #else /* ! __cplusplus */
+
+#if HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+
 #define xisspace(x) isspace((unsigned char)x)
 #define xtoupper(x) toupper((unsigned char)x)
 #define xtolower(x) tolower((unsigned char)x)
index 03450eda5033337d276b12fe9f427f053f29cb6f..358c211ce9756831a4407162087a38543badff19 100644 (file)
@@ -21,9 +21,9 @@
 
 /* C++ bindings */
 #else
+#include <cctype>
 #include <sys/types.h>
 #include <utility>
-#include <ctype.h>
 
 /* TODO: parameterize this to be more generic -
 * i.e. M-ary internal node sizes etc
index 37a381b06b9329b1ed8fbc84399f7679c152c1b7..fdcdca5838ab3d78bb1a6db36c01b04f3745a209 100644 (file)
@@ -9,9 +9,7 @@
 #ifndef SQUID_LIBNTLMAUTH_SUPPORT_BITS_CCI
 #define SQUID_LIBNTLMAUTH_SUPPORT_BITS_CCI
 
-#if HAVE_STRING_H
-#include <string.h>
-#endif
+#include <cstring>
 
 /*
  * Defines several functions which are used and mutually shared by the NTLM helpers
index 5f8dacffca5ff95f9e30cd62343458b3186f43af..228789cea6f4b68c1ce9b351e602f98e26e2501e 100644 (file)
@@ -70,7 +70,7 @@
 #include "include/util.h"
 
 #if _SQUID_CYGWIN_
-#include <wchar.h>
+#include <cwchar>
 int _wcsicmp(const wchar_t *, const wchar_t *);
 #endif
 
index 8a35d527d6edafb16e9b4e5fbc793587b895fce3..c26c15436258dc103dce935cf2ff523f2b61698b 100644 (file)
@@ -81,7 +81,7 @@
 #include "util.h"
 
 #if _SQUID_CYGWIN_
-#include <wchar.h>
+#include <cwchar>
 int _wcsicmp(const wchar_t *, const wchar_t *);
 #endif
 
index e93afc2b4e37939492a238289448e6be7d9195b5..5191033aece6a8d0109bc09ed5e8ad1194fc2c9a 100644 (file)
@@ -44,7 +44,7 @@
 #endif
 
 #if _SQUID_CYGWIN_
-#include <wchar.h>
+#include <cwchar>
 #endif
 #include "auth/basic/SSPI/valid.h"
 
index 6f3afc2a60c5331df1ec67ae558e8267e37ec0bc..f34341c912c2930d517dea9538e610ca729303a7 100644 (file)
@@ -56,9 +56,9 @@
 #include <ldap.h>
 
 #endif
-#include <wchar.h>
 
 #include "edir_ldapext.h"
+#include <cwchar>
 
 #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"
index 677f4ec8ea0afdaf19eb054d0afb76d9bd0c84e4..77a3f238e09ecb157528947d39dcaecbe63bb804 100644 (file)
 #include "sspwin32.h"
 #include "util.h"
 
-#include <windows.h>
-#include <sspi.h>
-#include <security.h>
+#include <cctype>
 #if HAVE_GETOPT_H
 #include <getopt.h>
 #endif
-#if HAVE_CTYPE_H
-#include <ctype.h>
-#endif
+#include <security.h>
+#include <sspi.h>
+#include <windows.h>
 
 int Negotiate_packet_debug_enabled = 0;
 static int have_serverblob;
index 8cc8d7d890b25b1bb51211ccc6f85a4fe90e05d3..701d7ebca371c8cb9914d11aedc9f2ab8dbf0ab6 100644 (file)
 #include "sspwin32.h"
 #include "util.h"
 
-#include <windows.h>
+#include <cctype>
+#include <lm.h>
+#include <ntsecapi.h>
 #include <sspi.h>
 #include <security.h>
-#if HAVE_CTYPE_H
-#include <ctype.h>
-#endif
 #if HAVE_GETOPT_H
 #include <getopt.h>
 #endif
-#include <lm.h>
-#include <ntsecapi.h>
+#include <windows.h>
 
 int NTLM_packet_debug_enabled = 0;
 static int have_challenge;
index cb5595ac6b8615d90265f070750e978cb26e5bb4..1d022b7aae4701c0b48e9714c6cdfbc71b2d8bda 100644 (file)
 #include "dns/rfc2671.h"
 #include "util.h"
 
-#if HAVE_STRING_H
-#include <string.h>
-#endif
+#include <cassert>
+#include <cstring>
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #if HAVE_MEMORY_H
 #include <memory.h>
 #endif
-#if HAVE_ASSERT_H
-#include <assert.h>
-#endif
 #if HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
index d489bdfb291de29be1dc0f2ffc1c49e6c25aaae7..022a650033f071f0af12b2bcbbf2ccf268cc45a6 100644 (file)
@@ -17,9 +17,7 @@
 #if HAVE_MEMORY_H
 #include <memory.h>
 #endif
-#if HAVE_ASSERT_H
-#include <assert.h>
-#endif
+#include <cassert>
 #if HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
index 8dceab7e5be1dc3f7c238628e106a3b3408cc458..b2613c696af50a8c4b4881204813093c8cd78ee4 100644 (file)
@@ -44,8 +44,8 @@
  */
 
 #include <unistd.h>
-#include <string.h>
-#include <ctype.h>
+#include <cstring>
+#include <cctype>
 
 #define ACCESS_LOCAL_DIR        "/var/lib/httpd/htdocs/local/rredir"
 #define REDIRECT_TO_URL         "http://www.hacom.nl/local/rredir"
index 2bac7fb1f70039bea6ba4101b38c069e5d347b53..0bb0b855d435995432f8bacad3d9aed64da63d9e 100644 (file)
 #include "parser/Tokenizer.h"
 #include "sbuf/Stream.h"
 
+#include <cctype>
 #include <cerrno>
-#if HAVE_CTYPE_H
-#include <ctype.h>
-#endif
 
 /// convenience method: consumes up to n bytes, counts, and returns them
 SBuf
index 74e7678e5142ec728be870459f92e0901cf3dd5d..9bad9076b6bbd4fef2108c9a66f76bdd97f1acb3 100644 (file)
@@ -9,12 +9,8 @@
 #include "squid.h"
 #include "time/gadgets.h"
 
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_CTYPE_H
-#include <ctype.h>
-#endif
+#include <cctype>
+#include <cstring>
 
 #define ASCII_DIGIT(c) ((c)-48)
 
index d89d22262f6f25e1e7e793cc11ee0012ee5d7c67..5496fe98578da85f1865051c65d360fc23707500 100644 (file)
  *  Adapted from HTSUtils.c in CERN httpd 3.0 (http://info.cern.ch/httpd/)
  *  by Darren Hardy <hardy@cs.colorado.edu>, November 1994.
  */
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#if HAVE_TIME_H
-#include <time.h>
-#endif
+#include <cctype>
+#include <cstring>
+#include <ctime>
 
 #define RFC850_STRFTIME "%A, %d-%b-%y %H:%M:%S GMT"
 #define RFC1123_STRFTIME "%a, %d %b %Y %H:%M:%S GMT"
index 7a1730a9b43de30b403806da94b2a8f911433d3d..df8dcb7ff755dba6069c6fd45926227ffe6c243c 100644 (file)
@@ -51,10 +51,10 @@ typedef int bool;
 #endif
 #endif /* __cplusplus */
 
+#include <ctime>
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <time.h>
 
 // taken from Squid-2.x
 // NOTE!  We must preserve the order of this list!