From: Amos Jeffries Date: Mon, 2 Jun 2014 07:19:35 +0000 (-0700) Subject: Cleanup: use C++ cerrno instead of C errno.h X-Git-Tag: SQUID_3_5_0_1~209 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a30fdf51d6c440c7e506db77a9269d5d7211aca;p=thirdparty%2Fsquid.git Cleanup: use C++ cerrno instead of C errno.h --- diff --git a/compat/xstring.cc b/compat/xstring.cc index 3a288780c7..6226958021 100644 --- a/compat/xstring.cc +++ b/compat/xstring.cc @@ -2,9 +2,7 @@ #include "compat/xalloc.h" #include "compat/xstring.h" -#if HAVE_ERRNO_H -#include -#endif +#include char * xstrdup(const char *s) diff --git a/compat/xstrto.cc b/compat/xstrto.cc index e6482ece4a..d6d9c07d41 100644 --- a/compat/xstrto.cc +++ b/compat/xstrto.cc @@ -47,9 +47,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#if HAVE_ERRNO_H -#include -#endif +#include bool xstrtoul(const char *s, char **end, unsigned long *value, diff --git a/helpers/external_acl/kerberos_ldap_group/support_ldap.cc b/helpers/external_acl/kerberos_ldap_group/support_ldap.cc index 73e7ec582e..553770b57b 100644 --- a/helpers/external_acl/kerberos_ldap_group/support_ldap.cc +++ b/helpers/external_acl/kerberos_ldap_group/support_ldap.cc @@ -28,9 +28,7 @@ #ifdef HAVE_LDAP #include "support.h" -#ifdef HAVE_ERRNO_H -#include -#endif +#include char *convert_domain_to_bind_path(char *domain); char *escape_filter(char *filter); diff --git a/helpers/external_acl/kerberos_ldap_group/support_resolv.cc b/helpers/external_acl/kerberos_ldap_group/support_resolv.cc index aa11112dd0..93e1d49981 100644 --- a/helpers/external_acl/kerberos_ldap_group/support_resolv.cc +++ b/helpers/external_acl/kerberos_ldap_group/support_resolv.cc @@ -28,9 +28,7 @@ #ifdef HAVE_LDAP #include "support.h" -#ifdef HAVE_ERRNO_H -#include -#endif +#include #ifdef HAVE_NETDB_H #include #endif diff --git a/src/DiskIO/AIO/AIODiskFile.cc b/src/DiskIO/AIO/AIODiskFile.cc index b16e4dc010..b22c4c7632 100644 --- a/src/DiskIO/AIO/AIODiskFile.cc +++ b/src/DiskIO/AIO/AIODiskFile.cc @@ -53,9 +53,7 @@ #include "DiskIO/WriteRequest.h" #include "globals.h" -#if HAVE_ERRNO_H -#include -#endif +#include CBDATA_CLASS_INIT(AIODiskFile); diff --git a/src/DiskIO/AIO/aio_win32.cc b/src/DiskIO/AIO/aio_win32.cc index 606d2473da..0097664d84 100644 --- a/src/DiskIO/AIO/aio_win32.cc +++ b/src/DiskIO/AIO/aio_win32.cc @@ -38,9 +38,7 @@ #include "StatCounters.h" #include "win32.h" -#if HAVE_ERRNO_H -#include -#endif +#include #if _SQUID_WINDOWS_ VOID CALLBACK IoCompletionRoutine(DWORD dwErrorCode, diff --git a/src/DiskIO/Blocking/BlockingFile.cc b/src/DiskIO/Blocking/BlockingFile.cc index c8c2c99724..0ea40d1e97 100644 --- a/src/DiskIO/Blocking/BlockingFile.cc +++ b/src/DiskIO/Blocking/BlockingFile.cc @@ -40,9 +40,7 @@ #include "DiskIO/WriteRequest.h" #include "globals.h" -#if HAVE_ERRNO_H -#include -#endif +#include CBDATA_CLASS_INIT(BlockingFile); diff --git a/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc b/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc index cb1a482a25..1892e433b3 100644 --- a/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc +++ b/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc @@ -46,6 +46,7 @@ #include "Store.h" #include "unlinkd.h" +#include #if HAVE_SYS_IPC_H #include #endif @@ -55,9 +56,6 @@ #if HAVE_SYS_SHM_H #include #endif -#if HAVE_ERRNO_H -#include -#endif diskd_stats_t diskd_stats; diff --git a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc index 3ee452e34e..31b6377b3d 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc +++ b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc @@ -43,9 +43,7 @@ #include "StatCounters.h" #include "Store.h" -#if HAVE_ERRNO_H -#include -#endif +#include /* === PUBLIC =========================================================== */ diff --git a/src/DiskIO/DiskThreads/aiops.cc b/src/DiskIO/DiskThreads/aiops.cc index b18220837c..a56598ba4b 100644 --- a/src/DiskIO/DiskThreads/aiops.cc +++ b/src/DiskIO/DiskThreads/aiops.cc @@ -41,11 +41,11 @@ #include "SquidTime.h" #include "Store.h" +#include #include #include #include #include -#include #include #if HAVE_SCHED_H #include diff --git a/src/DiskIO/DiskThreads/aiops_win32.cc b/src/DiskIO/DiskThreads/aiops_win32.cc index 4967789fe3..bf95ffd336 100644 --- a/src/DiskIO/DiskThreads/aiops_win32.cc +++ b/src/DiskIO/DiskThreads/aiops_win32.cc @@ -40,10 +40,10 @@ #include "SquidTime.h" #include "Store.h" +#include #include #include #include -#include #include #define RIDICULOUS_LENGTH 4096 diff --git a/src/DiskIO/IpcIo/IpcIoFile.cc b/src/DiskIO/IpcIo/IpcIoFile.cc index 6b7a67500a..e522001f21 100644 --- a/src/DiskIO/IpcIo/IpcIoFile.cc +++ b/src/DiskIO/IpcIo/IpcIoFile.cc @@ -23,9 +23,8 @@ #include "StatCounters.h" #include "tools.h" -#if HAVE_ERRNO_H -#include -#endif +#include + CBDATA_CLASS_INIT(IpcIoFile); /// shared memory segment path to use for IpcIoFile maps diff --git a/src/DiskIO/Mmapped/MmappedFile.cc b/src/DiskIO/Mmapped/MmappedFile.cc index 2c06746370..da6b81795f 100644 --- a/src/DiskIO/Mmapped/MmappedFile.cc +++ b/src/DiskIO/Mmapped/MmappedFile.cc @@ -11,15 +11,13 @@ #include "DiskIO/WriteRequest.h" #include "globals.h" +#include #if HAVE_SYS_MMAN_H #include #endif #if HAVE_SYS_STAT_H #include #endif -#if HAVE_ERRNO_H -#include -#endif // Some systems such as Hurd provide mmap() API but do not support MAP_NORESERVE #ifndef MAP_NORESERVE diff --git a/src/FwdState.cc b/src/FwdState.cc index 8dc6595849..ccdd03c9e4 100644 --- a/src/FwdState.cc +++ b/src/FwdState.cc @@ -81,9 +81,8 @@ #include "ssl/ServerBump.h" #include "ssl/support.h" #endif -#if HAVE_ERRNO_H -#include -#endif + +#include static PSC fwdPeerSelectionCompleteWrapper; static CLCB fwdServerClosedWrapper; diff --git a/src/HttpHeaderTools.cc b/src/HttpHeaderTools.cc index 16fe5e34e9..a4bce3313b 100644 --- a/src/HttpHeaderTools.cc +++ b/src/HttpHeaderTools.cc @@ -55,10 +55,8 @@ #endif #include +#include #include -#if HAVE_ERRNO_H -#include -#endif static void httpHeaderPutStrvf(HttpHeader * hdr, http_hdr_type id, const char *fmt, va_list vargs); diff --git a/src/cache_diff.cc b/src/cache_diff.cc index 99fdb9a53f..8e9f1c8dfc 100644 --- a/src/cache_diff.cc +++ b/src/cache_diff.cc @@ -37,10 +37,7 @@ */ #include "squid.h" - -#if HAVE_ERRNO_H -#include -#endif +#include typedef struct { const char *name; diff --git a/src/comm/ConnOpener.cc b/src/comm/ConnOpener.cc index c2913dbc55..fd26497ff4 100644 --- a/src/comm/ConnOpener.cc +++ b/src/comm/ConnOpener.cc @@ -17,9 +17,7 @@ #include "SquidConfig.h" #include "SquidTime.h" -#if HAVE_ERRNO_H -#include -#endif +#include class CachePeer; diff --git a/src/comm/ModEpoll.cc b/src/comm/ModEpoll.cc index 5072d7b9a9..d7cb229a64 100644 --- a/src/comm/ModEpoll.cc +++ b/src/comm/ModEpoll.cc @@ -65,12 +65,10 @@ #define DEBUG_EPOLL 0 +#include #if HAVE_SYS_EPOLL_H #include #endif -#if HAVE_ERRNO_H -#include -#endif static int kdpfd; static int max_poll_time = 1000; diff --git a/src/comm/ModKqueue.cc b/src/comm/ModKqueue.cc index 1a4d4248f9..b87f5d60ad 100644 --- a/src/comm/ModKqueue.cc +++ b/src/comm/ModKqueue.cc @@ -60,12 +60,10 @@ #include "StatCounters.h" #include "Store.h" +#include #if HAVE_SYS_EVENT_H #include #endif -#if HAVE_ERRNO_H -#include -#endif #define KE_LENGTH 128 diff --git a/src/comm/ModPoll.cc b/src/comm/ModPoll.cc index e7bbe182b8..dd3bd3349f 100644 --- a/src/comm/ModPoll.cc +++ b/src/comm/ModPoll.cc @@ -45,12 +45,10 @@ #include "StatCounters.h" #include "Store.h" +#include #if HAVE_POLL_H #include #endif -#if HAVE_ERRNO_H -#include -#endif /* Needed for poll() on Linux at least */ #if USE_POLL diff --git a/src/comm/ModSelect.cc b/src/comm/ModSelect.cc index 47c8225669..03e04884b0 100644 --- a/src/comm/ModSelect.cc +++ b/src/comm/ModSelect.cc @@ -45,12 +45,10 @@ #include "StatHist.h" #include "Store.h" +#include #if HAVE_SYS_STAT_H #include #endif -#if HAVE_ERRNO_H -#include -#endif static int MAX_POLL_TIME = 1000; /* see also Comm::QuickPollRequired() */ diff --git a/src/comm/ModSelectWin32.cc b/src/comm/ModSelectWin32.cc index b3292c65a4..1b52dcd39e 100644 --- a/src/comm/ModSelectWin32.cc +++ b/src/comm/ModSelectWin32.cc @@ -42,9 +42,7 @@ #include "StatHist.h" #include "Store.h" -#if HAVE_ERRNO_H -#include -#endif +#include static int MAX_POLL_TIME = 1000; /* see also Comm::QuickPollRequired() */ diff --git a/src/comm/TcpAcceptor.cc b/src/comm/TcpAcceptor.cc index 44a6c8263a..85e3d0ec8b 100644 --- a/src/comm/TcpAcceptor.cc +++ b/src/comm/TcpAcceptor.cc @@ -53,9 +53,7 @@ #include "SquidTime.h" #include "StatCounters.h" -#if HAVE_ERRNO_H -#include -#endif +#include #ifdef HAVE_NETINET_TCP_H // required for accept_filter to build. #include diff --git a/src/disk.cc b/src/disk.cc index fc9567e26f..d1dc04c90e 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -41,9 +41,7 @@ #include "profiler/Profiler.h" #include "StatCounters.h" -#if HAVE_ERRNO_H -#include -#endif +#include static PF diskHandleRead; static PF diskHandleWrite; diff --git a/src/dns_internal.cc b/src/dns_internal.cc index a8f6837e07..120e9dd03f 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -60,12 +60,10 @@ #if HAVE_ARPA_NAMESER_H #include #endif +#include #if HAVE_RESOLV_H #include #endif -#if HAVE_ERRNO_H -#include -#endif #if _SQUID_WINDOWS_ #define REG_TCPIP_PARA_INTERFACES "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces" diff --git a/src/eui/Eui48.cc b/src/eui/Eui48.cc index f97fe2b6b4..45a61ce46e 100644 --- a/src/eui/Eui48.cc +++ b/src/eui/Eui48.cc @@ -41,9 +41,7 @@ #include "globals.h" #include "ip/Address.h" -#if HAVE_ERRNO_H -#include -#endif +#include /* START Legacy includes pattern */ /* TODO: clean this up so we dont have per-OS requirements. diff --git a/src/fs/rock/RockRebuild.cc b/src/fs/rock/RockRebuild.cc index e230bdf687..45f5427925 100644 --- a/src/fs/rock/RockRebuild.cc +++ b/src/fs/rock/RockRebuild.cc @@ -15,9 +15,7 @@ #include "tools.h" #include "typedefs.h" -#if HAVE_ERRNO_H -#include -#endif +#include CBDATA_NAMESPACED_CLASS_INIT(Rock, Rebuild); diff --git a/src/ftp.cc b/src/ftp.cc index 214106437d..2acaafee9e 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -68,9 +68,7 @@ #include "MemObject.h" #endif -#if HAVE_ERRNO_H -#include -#endif +#include /** \defgroup ServerProtocolFTPInternal Server-Side FTP Internals diff --git a/src/icmp/IcmpPinger.cc b/src/icmp/IcmpPinger.cc index e49c69b8cd..bc8e5e0fb4 100644 --- a/src/icmp/IcmpPinger.cc +++ b/src/icmp/IcmpPinger.cc @@ -42,9 +42,7 @@ #include "IcmpPinger.h" #include "SquidTime.h" -#if HAVE_ERRNO_H -#include -#endif +#include IcmpPinger::IcmpPinger() : Icmp() { diff --git a/src/icmp/IcmpSquid.cc b/src/icmp/IcmpSquid.cc index e2c0493a44..f6483a4fc6 100644 --- a/src/icmp/IcmpSquid.cc +++ b/src/icmp/IcmpSquid.cc @@ -42,9 +42,7 @@ #include "SquidIpc.h" #include "SquidTime.h" -#if HAVE_ERRNO_H -#include -#endif +#include // Instance global to be available in main() and elsewhere. IcmpSquid icmpEngine; diff --git a/src/icp_v2.cc b/src/icp_v2.cc index a51090f63e..adcafa308d 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -65,9 +65,7 @@ #include "tools.h" #include "wordlist.h" -#if HAVE_ERRNO_H -#include -#endif +#include static void icpIncomingConnectionOpened(const Comm::ConnectionPointer &conn, int errNo); diff --git a/src/ip/Intercept.cc b/src/ip/Intercept.cc index 343916207b..feaa5c61ce 100644 --- a/src/ip/Intercept.cc +++ b/src/ip/Intercept.cc @@ -36,6 +36,8 @@ #include "ip/Intercept.h" #include "src/tools.h" +#include + #if IPF_TRANSPARENT #if HAVE_SYS_IOCTL_H @@ -71,9 +73,6 @@ #elif HAVE_NETINET_IP_NAT_H #include #endif -#if HAVE_ERRNO_H -#include -#endif #endif /* IPF_TRANSPARENT required headers */ diff --git a/src/ip/QosConfig.cc b/src/ip/QosConfig.cc index c1a52675f3..871b9d364e 100644 --- a/src/ip/QosConfig.cc +++ b/src/ip/QosConfig.cc @@ -11,11 +11,7 @@ #include "ip/tools.h" #include "Parsing.h" -#if HAVE_ERRNO_H -#include -#endif - -/* Qos namespace */ +#include void Ip::Qos::getTosFromServer(const Comm::ConnectionPointer &server, fde *clientFde) diff --git a/src/ipc/Coordinator.cc b/src/ipc/Coordinator.cc index bb7318fcba..26457d05e8 100644 --- a/src/ipc/Coordinator.cc +++ b/src/ipc/Coordinator.cc @@ -20,9 +20,8 @@ #include "snmp/Request.h" #include "snmp/Response.h" #endif -#if HAVE_ERRNO_H -#include -#endif + +#include CBDATA_NAMESPACED_CLASS_INIT(Ipc, Coordinator); Ipc::Coordinator* Ipc::Coordinator::TheInstance = NULL; diff --git a/src/ipc/StartListening.cc b/src/ipc/StartListening.cc index cd31ba5495..9bfe92118e 100644 --- a/src/ipc/StartListening.cc +++ b/src/ipc/StartListening.cc @@ -11,9 +11,7 @@ #include "ipc/StartListening.h" #include "tools.h" -#if HAVE_ERRNO_H -#include -#endif +#include Ipc::StartListeningCb::StartListeningCb(): conn(NULL), errNo(0) { diff --git a/src/ipc_win32.cc b/src/ipc_win32.cc index 01513139b2..c84e51724d 100644 --- a/src/ipc_win32.cc +++ b/src/ipc_win32.cc @@ -43,13 +43,11 @@ #include "SquidTime.h" #include "tools.h" +#include #ifndef _MSWSOCK_ #include #endif #include -#if HAVE_ERRNO_H -#include -#endif struct ipc_params { int type; diff --git a/src/log/ModDaemon.cc b/src/log/ModDaemon.cc index e03b677333..88a49f9283 100644 --- a/src/log/ModDaemon.cc +++ b/src/log/ModDaemon.cc @@ -42,9 +42,7 @@ #include "SquidIpc.h" #include "SquidTime.h" -#if HAVE_ERRNO_H -#include -#endif +#include /* How many buffers to keep before we say we've buffered too much */ #define LOGFILE_MAXBUFS 128 diff --git a/src/log/ModStdio.cc b/src/log/ModStdio.cc index 32b4832f7f..1425fd08d5 100644 --- a/src/log/ModStdio.cc +++ b/src/log/ModStdio.cc @@ -39,9 +39,7 @@ #include "log/ModStdio.h" #include "SquidConfig.h" -#if HAVE_ERRNO_H -#include -#endif +#include typedef struct { int fd; diff --git a/src/log/ModUdp.cc b/src/log/ModUdp.cc index 9191ad93d0..cd657dce9b 100644 --- a/src/log/ModUdp.cc +++ b/src/log/ModUdp.cc @@ -40,9 +40,7 @@ #include "Parsing.h" #include "SquidConfig.h" -#if HAVE_ERRNO_H -#include -#endif +#include /* * This logfile UDP module is mostly inspired by a patch by Tim Starling diff --git a/src/main.cc b/src/main.cc index ba13a2eec3..f388a8fa51 100644 --- a/src/main.cc +++ b/src/main.cc @@ -142,15 +142,13 @@ #include "snmp_core.h" #endif +#include #if HAVE_PATHS_H #include #endif #if HAVE_SYS_WAIT_H #include #endif -#if HAVE_ERRNO_H -#include -#endif #if USE_WIN32_SERVICE #include diff --git a/src/parser/Tokenizer.cc b/src/parser/Tokenizer.cc index a13e218ebe..4b0ec95109 100644 --- a/src/parser/Tokenizer.cc +++ b/src/parser/Tokenizer.cc @@ -1,12 +1,10 @@ #include "squid.h" #include "parser/Tokenizer.h" +#include #if HAVE_CTYPE_H #include #endif -#if HAVE_ERRNO_H -#include -#endif #if HAVE_STDINT_H #include #endif diff --git a/src/ssl/support.cc b/src/ssl/support.cc index 7e83ac8572..fad05b9b0c 100644 --- a/src/ssl/support.cc +++ b/src/ssl/support.cc @@ -51,9 +51,7 @@ #include "ssl/support.h" #include "URL.h" -#if HAVE_ERRNO_H -#include -#endif +#include static void setSessionCallbacks(SSL_CTX *ctx); Ipc::MemMap *SslSessionCache = NULL; diff --git a/src/store_rebuild.cc b/src/store_rebuild.cc index a80bc9d578..5a21a0b3e8 100644 --- a/src/store_rebuild.cc +++ b/src/store_rebuild.cc @@ -44,9 +44,8 @@ #include "StoreSearch.h" #include "SwapDir.h" -#if HAVE_ERRNO_H -#include -#endif +#include + static StoreRebuildData counts; static struct timeval rebuild_start; diff --git a/src/test_cache_digest.cc b/src/test_cache_digest.cc index 8613f8b172..5af008f8ba 100644 --- a/src/test_cache_digest.cc +++ b/src/test_cache_digest.cc @@ -38,9 +38,7 @@ #include "CacheDigest.h" #include "store_key_md5.h" -#if HAVE_ERRNO_H -#include -#endif +#include typedef struct { int query_count; diff --git a/src/tools.cc b/src/tools.cc index 19a61365cd..4d275a6b29 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -52,6 +52,7 @@ #include "tools.h" #include "wordlist.h" +#include #if HAVE_SYS_PRCTL_H #include #endif @@ -67,9 +68,6 @@ #if HAVE_GRP_H #include #endif -#if HAVE_ERRNO_H -#include -#endif #define DEAD_MSG "\ The Squid Cache (version %s) died.\n\ diff --git a/src/whois.cc b/src/whois.cc index 4f5201611b..7cfb39e016 100644 --- a/src/whois.cc +++ b/src/whois.cc @@ -43,9 +43,7 @@ #include "Store.h" #include "tools.h" -#if HAVE_ERRNO_H -#include -#endif +#include #define WHOIS_PORT 43