From: Amos Jeffries Date: Sat, 23 Jul 2011 08:37:52 +0000 (+1200) Subject: Portability polish: use #if instead of #ifdef or #ifndef X-Git-Tag: take08~55^2~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1191b93b928bec671fbb2854205b799281619ba4;p=thirdparty%2Fsquid.git Portability polish: use #if instead of #ifdef or #ifndef ... when _SQUID_OS_ macros are involved. Coding guidelines since 3.1 have been not to. This cleans up all current variations from the guideline. --- diff --git a/compat/getaddrinfo.c b/compat/getaddrinfo.c index 4fdc03dc48..2119b161d3 100644 --- a/compat/getaddrinfo.c +++ b/compat/getaddrinfo.c @@ -73,7 +73,7 @@ #if HAVE_NETDB_H #include #endif -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ #undef IN_ADDR #include #endif diff --git a/compat/os/aix.h b/compat/os/aix.h index ac933ac294..8a540ae9d6 100644 --- a/compat/os/aix.h +++ b/compat/os/aix.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_AIX_H #define SQUID_OS_AIX_H -#ifdef _SQUID_AIX_ +#if _SQUID_AIX_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/os/dragonfly.h b/compat/os/dragonfly.h index 6fe742eb61..8390a1360a 100644 --- a/compat/os/dragonfly.h +++ b/compat/os/dragonfly.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_DRAGONFLY_H #define SQUID_OS_DRAGONFLY_H -#ifdef _SQUID_DRAGONFLY_ +#if _SQUID_DRAGONFLY_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/os/freebsd.h b/compat/os/freebsd.h index e8eff26c86..531e378e5b 100644 --- a/compat/os/freebsd.h +++ b/compat/os/freebsd.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_FREEBSD_H #define SQUID_OS_FREEBSD_H -#ifdef _SQUID_FREEBSD_ +#if _SQUID_FREEBSD_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/os/hpux.h b/compat/os/hpux.h index 9cdcd5cb32..a90e4b2a09 100644 --- a/compat/os/hpux.h +++ b/compat/os/hpux.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_HPUX_H #define SQUID_OS_PHUX_H -#ifdef _SQUID_HPUX_ +#if _SQUID_HPUX_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/os/linux.h b/compat/os/linux.h index d4ea1fb87d..a5261dc4d3 100644 --- a/compat/os/linux.h +++ b/compat/os/linux.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_LINUX_H #define SQUID_OS_LINUX_H -#ifdef _SQUID_LINUX_ +#if _SQUID_LINUX_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/os/macosx.h b/compat/os/macosx.h index 41abbccdc9..e601614f11 100644 --- a/compat/os/macosx.h +++ b/compat/os/macosx.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_MACOSX_H #define SQUID_OS_MACOSX_H -#ifdef _SQUID_APPLE_ +#if _SQUID_APPLE_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/os/netbsd.h b/compat/os/netbsd.h index dd48070f2f..813d20f471 100644 --- a/compat/os/netbsd.h +++ b/compat/os/netbsd.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_NETBSD_H #define SQUID_OS_NETBSD_H -#ifdef _SQUID_NETBSD_ +#if _SQUID_NETBSD_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/os/next.h b/compat/os/next.h index 016188abbf..556777e384 100644 --- a/compat/os/next.h +++ b/compat/os/next.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_NEXT_H #define SQUID_OS_NEXT_H -#ifdef _SQUID_NEXT_ +#if _SQUID_NEXT_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/os/openbsd.h b/compat/os/openbsd.h index 87c7e97808..7df8d82747 100644 --- a/compat/os/openbsd.h +++ b/compat/os/openbsd.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_OPENBSD_H #define SQUID_OS_OPENBSD_H -#ifdef _SQUID_OPENBSD_ +#if _SQUID_OPENBSD_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/os/os2.h b/compat/os/os2.h index f957945bea..72d943a321 100644 --- a/compat/os/os2.h +++ b/compat/os/os2.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_OS2_H #define SQUID_OS_OS2_H -#ifdef _SQUID_OS2_ +#if _SQUID_OS2_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/os/qnx.h b/compat/os/qnx.h index 1c0d5e35ac..1242e74e3a 100644 --- a/compat/os/qnx.h +++ b/compat/os/qnx.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_QNX_H #define SQUID_OS_QNX_H -#ifdef _SQUID_QNX_ +#if _SQUID_QNX_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/os/sunos.h b/compat/os/sunos.h index 1f9a766d86..ad0775401f 100644 --- a/compat/os/sunos.h +++ b/compat/os/sunos.h @@ -1,7 +1,7 @@ #ifndef SQUID_OS_SUNOS_H #define SQUID_OS_SUNOS_H -#ifdef _SQUID_SUNOS_ +#if _SQUID_SUNOS_ /**************************************************************************** *--------------------------------------------------------------------------* diff --git a/compat/types.h b/compat/types.h index 5026a46107..707a45191f 100644 --- a/compat/types.h +++ b/compat/types.h @@ -93,7 +93,7 @@ * "%lx" instead of "%llx" */ #ifndef PRId64 -#ifdef _SQUID_MSWIN_ /* Windows native port using MSVCRT */ +#if _SQUID_MSWIN_ /* Windows native port using MSVCRT */ #define PRId64 "I64d" #elif SIZEOF_INT64_T > SIZEOF_LONG #define PRId64 "lld" @@ -103,7 +103,7 @@ #endif #ifndef PRIu64 -#ifdef _SQUID_MSWIN_ /* Windows native port using MSVCRT */ +#if _SQUID_MSWIN_ /* Windows native port using MSVCRT */ #define PRIu64 "I64u" #elif SIZEOF_INT64_T > SIZEOF_LONG #define PRIu64 "llu" @@ -113,7 +113,7 @@ #endif #ifndef PRIX64 -#ifdef _SQUID_MSWIN_ /* Windows native port using MSVCRT */ +#if _SQUID_MSWIN_ /* Windows native port using MSVCRT */ #define PRIX64 "I64X" #elif SIZEOF_INT64_T > SIZEOF_LONG #define PRIX64 "llX" diff --git a/helpers/basic_auth/LDAP/basic_ldap_auth.cc b/helpers/basic_auth/LDAP/basic_ldap_auth.cc index 63b6c2fb4b..2ec5ef4d96 100644 --- a/helpers/basic_auth/LDAP/basic_ldap_auth.cc +++ b/helpers/basic_auth/LDAP/basic_ldap_auth.cc @@ -93,7 +93,7 @@ #include #include -#ifdef _SQUID_MSWIN_ /* Native Windows port and MinGW */ +#if _SQUID_MSWIN_ /* Native Windows port and MinGW */ #define snprintf _snprintf #include @@ -554,7 +554,7 @@ main(int argc, char **argv) /* On Windows ldap_start_tls_s is available starting from Windows XP, * so we need to bind at run-time with the function entry point */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (use_tls) { HMODULE WLDAP32Handle; diff --git a/helpers/basic_auth/RADIUS/basic_radius_auth.cc b/helpers/basic_auth/RADIUS/basic_radius_auth.cc index c52f9043b1..d219551873 100644 --- a/helpers/basic_auth/RADIUS/basic_radius_auth.cc +++ b/helpers/basic_auth/RADIUS/basic_radius_auth.cc @@ -120,14 +120,14 @@ static int retries = 30; char progname[] = "basic_radius_auth"; -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ void Win32SockCleanup(void) { WSACleanup(); return; } -#endif /* ifdef _SQUID_MSWIN_ */ +#endif /* * Diff two timeval, b - a @@ -498,7 +498,7 @@ main(int argc, char **argv) fprintf(stderr, "FATAL: %s: Shared secret not specified\n", argv[0]); exit(1); } -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ { WSADATA wsaData; WSAStartup(2, &wsaData); diff --git a/helpers/basic_auth/SSPI/valid.h b/helpers/basic_auth/SSPI/valid.h index 39c599639c..c6113b66e7 100644 --- a/helpers/basic_auth/SSPI/valid.h +++ b/helpers/basic_auth/SSPI/valid.h @@ -88,7 +88,7 @@ static void debug(char *format,...) { #ifdef DEBUG -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (debug_enabled) { va_list args; diff --git a/helpers/digest_auth/LDAP/ldap_backend.cc b/helpers/digest_auth/LDAP/ldap_backend.cc index 74fca3263a..d6a6deb5f7 100644 --- a/helpers/digest_auth/LDAP/ldap_backend.cc +++ b/helpers/digest_auth/LDAP/ldap_backend.cc @@ -12,7 +12,7 @@ #include "ldap_backend.h" -#ifdef _SQUID_MSWIN_ /* Native Windows port and MinGW */ +#if _SQUID_MSWIN_ /* Native Windows port and MinGW */ #define snprintf _snprintf #include @@ -301,7 +301,7 @@ ldapconnect(void) /* On Windows ldap_start_tls_s is available starting from Windows XP, * so we need to bind at run-time with the function entry point */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (use_tls) { HMODULE WLDAP32Handle; diff --git a/helpers/digest_auth/eDirectory/edir_ldapext.cc b/helpers/digest_auth/eDirectory/edir_ldapext.cc index d688fbcf58..48921f8400 100644 --- a/helpers/digest_auth/eDirectory/edir_ldapext.cc +++ b/helpers/digest_auth/eDirectory/edir_ldapext.cc @@ -26,7 +26,7 @@ #include "digest_common.h" -#ifdef _SQUID_MSWIN_ /* Native Windows port and MinGW */ +#if _SQUID_MSWIN_ /* Native Windows port and MinGW */ #define snprintf _snprintf #include diff --git a/helpers/digest_auth/eDirectory/ldap_backend.cc b/helpers/digest_auth/eDirectory/ldap_backend.cc index 109928dca0..5281369f03 100644 --- a/helpers/digest_auth/eDirectory/ldap_backend.cc +++ b/helpers/digest_auth/eDirectory/ldap_backend.cc @@ -11,7 +11,7 @@ #include "ldap_backend.h" -#ifdef _SQUID_MSWIN_ /* Native Windows port and MinGW */ +#if _SQUID_MSWIN_ /* Native Windows port and MinGW */ #define snprintf _snprintf #include @@ -329,7 +329,7 @@ ldapconnect(void) /* On Windows ldap_start_tls_s is available starting from Windows XP, * so we need to bind at run-time with the function entry point */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (use_tls) { HMODULE WLDAP32Handle; diff --git a/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc b/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc index c843d07390..135a21bd5e 100644 --- a/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc +++ b/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc @@ -51,7 +51,7 @@ #include #endif -#ifdef _SQUID_MSWIN_ /* Native Windows port and MinGW */ +#if _SQUID_MSWIN_ /* Native Windows port and MinGW */ #define snprintf _snprintf #include @@ -451,7 +451,7 @@ main(int argc, char **argv) /* On Windows ldap_start_tls_s is available starting from Windows XP, * so we need to bind at run-time with the function entry point */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (use_tls) { HMODULE WLDAP32Handle; diff --git a/include/util.h b/include/util.h index 4f4e426a75..d797d31b3b 100644 --- a/include/util.h +++ b/include/util.h @@ -115,7 +115,7 @@ SQUIDCEXTERN unsigned int RoundTo(const unsigned int num, const unsigned int wha /* Windows Port */ /* win32lib.c */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ SQUIDCEXTERN int chroot (const char *); SQUIDCEXTERN int ftruncate(int, off_t); #if !HAVE_GETTIMEOFDAY diff --git a/scripts/source-maintenance.sh b/scripts/source-maintenance.sh index 890f17319b..789d74f7a4 100755 --- a/scripts/source-maintenance.sh +++ b/scripts/source-maintenance.sh @@ -77,6 +77,11 @@ for FILENAME in `ls -1`; do ;; esac + # + # Scan for incorrect use of #ifdef/#ifndef + # + grep -R -E "ifn?def .*_SQUID_" ./* | grep -v -E "_H$" | while read f; do echo "PROBLEM?: ${f}"; done + # # DEBUG Section list maintenance # diff --git a/src/DiskIO/AIO/aio_win32.h b/src/DiskIO/AIO/aio_win32.h index cea94bacfa..099e846edb 100644 --- a/src/DiskIO/AIO/aio_win32.h +++ b/src/DiskIO/AIO/aio_win32.h @@ -44,7 +44,7 @@ typedef int64_t off64_t; #endif -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ union sigval { int sival_int; /* integer value */ diff --git a/src/WinSvc.cc b/src/WinSvc.cc index 5bfebdcf2b..13f6549d7b 100644 --- a/src/WinSvc.cc +++ b/src/WinSvc.cc @@ -37,7 +37,7 @@ #include "squid.h" #include "squid_windows.h" -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ #ifndef _MSWSOCK_ #include #endif @@ -401,7 +401,7 @@ WIN32_Abort(int sig) WIN32_Exit(); } -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ void WIN32_IpAddrChangeMonitorExit() { @@ -417,7 +417,7 @@ WIN32_IpAddrChangeMonitorExit() void WIN32_Exit() { -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ Win32SockCleanup(); #endif #if USE_WIN32_SERVICE @@ -430,7 +430,7 @@ WIN32_Exit() } #endif -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (dbg_mutex) DeleteCriticalSection(dbg_mutex); @@ -442,7 +442,7 @@ WIN32_Exit() _exit(0); } -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ static DWORD WINAPI WIN32_IpAddrChangeMonitor(LPVOID lpParam) { @@ -580,7 +580,7 @@ int WIN32_Subsystem_Init(int * argc, char *** argv) svcStatus.dwCheckPoint = 0; svcStatus.dwWaitHint = 10000; SetServiceStatus(svcHandle, &svcStatus); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ _setmaxstdio(Squid_MaxFD); #endif @@ -588,7 +588,7 @@ int WIN32_Subsystem_Init(int * argc, char *** argv) } #endif /* USE_WIN32_SERVICE */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (Win32SockInit() < 0) return 1; @@ -964,7 +964,7 @@ int main(int argc, char **argv) } } else { WIN32_run_mode = _WIN_SQUID_RUN_MODE_INTERACTIVE; -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ opt_no_daemon = 1; diff --git a/src/cache_manager.cc b/src/cache_manager.cc index efe8caf85e..bb00a4aa18 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -211,7 +211,7 @@ CacheManager::ParseUrl(const char *url) if (t < 2) xstrncpy(request, "menu", MAX_URL); -#ifdef _SQUID_OS2_ +#if _SQUID_OS2_ if (t == 2 && request[0] == '\0') { /* * emx's sscanf insists of returning 2 because it sets request diff --git a/src/cf_gen.cc b/src/cf_gen.cc index 1f94007624..aeab025cce 100644 --- a/src/cf_gen.cc +++ b/src/cf_gen.cc @@ -187,7 +187,7 @@ main(int argc, char *argv[]) enum State state; int rc = 0; char *ptr = NULL; -#ifdef _SQUID_OS2_ +#if _SQUID_OS2_ const char *rmode = "rt"; #else diff --git a/src/comm.cc b/src/comm.cc index 35b3b2a0aa..a6ab545de7 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -189,7 +189,7 @@ comm_read(const Comm::ConnectionPointer &conn, char *buf, int size, AsyncCall::P static void comm_empty_os_read_buffers(int fd) { -#ifdef _SQUID_LINUX_ +#if _SQUID_LINUX_ /* prevent those nasty RST packets */ char buf[SQUID_TCP_SO_RCVBUF]; @@ -645,7 +645,7 @@ comm_apply_flags(int new_socket, commSetReuseAddr(new_socket); if (addr.GetPort() > (u_short) 0) { -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (sock_type != SOCK_DGRAM) #endif commSetNoLinger(new_socket); @@ -704,7 +704,7 @@ comm_import_opened(const Comm::ConnectionPointer &conn, fd_table[conn->fd].flags.close_on_exec = 1; if (conn->local.GetPort() > (u_short) 0) { -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (AI->ai_socktype != SOCK_DGRAM) #endif fd_table[conn->fd].flags.nolinger = 1; @@ -910,7 +910,7 @@ comm_connect_addr(int sock, const Ip::Address &address) * we leak memory on many connect requests because of EINPROGRESS. * If you find that this code is needed, please file a bug report. */ #if 0 -#ifdef _SQUID_LINUX_ +#if _SQUID_LINUX_ /* 2007-11-27: * Linux Debian replaces our allocated AI pointer with garbage when * connect() fails. This leads to segmentation faults deallocating @@ -1204,7 +1204,7 @@ comm_udp_sendto(int fd, if (x >= 0) return x; -#ifdef _SQUID_LINUX_ +#if _SQUID_LINUX_ if (ECONNREFUSED != errno) #endif @@ -1324,7 +1324,7 @@ commSetTcpRcvbuf(int fd, int size) int commSetNonBlocking(int fd) { -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ int flags; int dummy = 0; #endif @@ -1344,7 +1344,7 @@ commSetNonBlocking(int fd) } else { #endif #endif -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ if ((flags = fcntl(fd, F_GETFL, dummy)) < 0) { debugs(50, 0, "FD " << fd << ": fcntl F_GETFL: " << xstrerror()); @@ -1368,7 +1368,7 @@ commSetNonBlocking(int fd) int commUnsetNonBlocking(int fd) { -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ int nonblocking = FALSE; if (ioctlsocket(fd, FIONBIO, (unsigned long *) &nonblocking) < 0) { diff --git a/src/debug.cc b/src/debug.cc index f6e6b50471..05ef8f6bff 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -64,7 +64,7 @@ static void _db_print_syslog(const char *format, va_list args); static void _db_print_stderr(const char *format, va_list args); static void _db_print_file(const char *format, va_list args); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ SQUIDCEXTERN LPCRITICAL_SECTION dbg_mutex; typedef BOOL (WINAPI * PFInitializeCriticalSectionAndSpinCount) (LPCRITICAL_SECTION, DWORD); #endif @@ -78,7 +78,7 @@ _db_print(const char *format,...) va_list args2; va_list args3; -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ /* Multiple WIN32 threads may call this simultaneously */ if (!dbg_mutex) { @@ -131,7 +131,7 @@ _db_print(const char *format,...) _db_print_syslog(format, args3); #endif -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ LeaveCriticalSection(dbg_mutex); #endif @@ -487,7 +487,7 @@ _db_rotate_log(void) i--; snprintf(from, MAXPATHLEN, "%s.%d", debug_log_file, i - 1); snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, i); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ remove (to); #endif @@ -498,14 +498,14 @@ _db_rotate_log(void) * You can't rename open files on Microsoft "operating systems" * so we close before renaming. */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (debug_log != stderr) fclose(debug_log); #endif /* Rotate the current log to .0 */ if (Debug::rotateNumber > 0) { snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, 0); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ remove (to); #endif diff --git a/src/defines.h b/src/defines.h index 40936b5324..c0e2c87aa7 100644 --- a/src/defines.h +++ b/src/defines.h @@ -211,7 +211,7 @@ /* * Max number of ICP messages to receive per call to icpHandleUdp */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ #define INCOMING_ICP_MAX 1 #else #define INCOMING_ICP_MAX 15 @@ -219,7 +219,7 @@ /* * Max number of DNS messages to receive per call to DNS read handler */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ #define INCOMING_DNS_MAX 1 #else #define INCOMING_DNS_MAX 15 @@ -228,7 +228,7 @@ * Max number of HTTP connections to accept per call to httpAccept * and PER HTTP PORT */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ #define INCOMING_HTTP_MAX 1 #else #define INCOMING_HTTP_MAX 10 diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 44532a174a..994416a3e7 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -225,7 +225,7 @@ static void idnsAddPathComponent(const char *buf); static void idnsFreeNameservers(void); static void idnsFreeSearchpath(void); static void idnsParseNameservers(void); -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ static void idnsParseResolvConf(void); #endif #if _SQUID_WINDOWS_ @@ -356,7 +356,7 @@ idnsParseNameservers(void) } } -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ static void idnsParseResolvConf(void) { @@ -1278,7 +1278,7 @@ idnsRead(int fd, void *data) if (ignoreErrno(errno)) break; -#ifdef _SQUID_LINUX_ +#if _SQUID_LINUX_ /* Some Linux systems seem to set the FD for reading and then * return ECONNREFUSED when sendto() fails and generates an ICMP * port unreachable message. */ @@ -1530,7 +1530,7 @@ idnsInit(void) assert(0 == nns); idnsParseNameservers(); -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ if (0 == nns) idnsParseResolvConf(); diff --git a/src/dnsserver.cc b/src/dnsserver.cc index 6205138955..420921f693 100644 --- a/src/dnsserver.cc +++ b/src/dnsserver.cc @@ -491,7 +491,7 @@ main(int argc, char *argv[]) } } -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ { WSADATA wsaData; @@ -505,7 +505,7 @@ main(int argc, char *argv[]) memset(request, '\0', REQ_SZ); if (fgets(request, REQ_SZ, stdin) == NULL) { -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ WSACleanup(); #endif exit(1); diff --git a/src/fd.cc b/src/fd.cc index e76178ac04..36a26b8adf 100644 --- a/src/fd.cc +++ b/src/fd.cc @@ -49,7 +49,7 @@ int default_read_method(int, char *, int); int default_write_method(int, const char *, int); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ int socket_read_method(int, char *, int); int socket_write_method(int, const char *, int); int file_read_method(int, char *, int); @@ -122,7 +122,7 @@ fd_close(int fd) *F = fde(); } -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ int socket_read_method(int fd, char *buf, int len) @@ -222,7 +222,7 @@ fd_open(int fd, unsigned int type, const char *desc) F->type = type; F->flags.open = 1; F->epoll_state = 0; -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ F->win32.handle = _get_osfhandle(fd); diff --git a/src/fde.cc b/src/fde.cc index b66542cf41..49bd5300b8 100644 --- a/src/fde.cc +++ b/src/fde.cc @@ -54,7 +54,7 @@ fde::dumpStats (StoreEntry &dumpEntry, int fdNumber) if (!flags.open) return; -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ storeAppendPrintf(&dumpEntry, "%4d 0x%-8lX %-6.6s %4d %7"PRId64"%c %7"PRId64"%c %-21s %s\n", fdNumber, @@ -78,7 +78,7 @@ fde::DumpStats (StoreEntry *dumpEntry) { int i; storeAppendPrintf(dumpEntry, "Active file descriptors:\n"); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ storeAppendPrintf(dumpEntry, "%-4s %-10s %-6s %-4s %-7s* %-7s* %-21s %s\n", "File", @@ -93,7 +93,7 @@ fde::DumpStats (StoreEntry *dumpEntry) "Nwrite", "Remote Address", "Description"); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ storeAppendPrintf(dumpEntry, "---- ---------- ------ ---- -------- -------- --------------------- ------------------------------\n"); #else storeAppendPrintf(dumpEntry, "---- ------ ---- -------- -------- --------------------- ------------------------------\n"); diff --git a/src/fde.h b/src/fde.h index 8cdfdd1a2b..94cf3568df 100644 --- a/src/fde.h +++ b/src/fde.h @@ -115,7 +115,7 @@ public: SSL *ssl; SSL_CTX *dynamicSslContext; ///< cached and then freed when fd is closed #endif -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ struct { long handle; } win32; @@ -169,7 +169,7 @@ private: ssl = NULL; dynamicSslContext = NULL; #endif -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ win32.handle = NULL; #endif tosFromServer = '\0'; diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index 025139c401..d30ec64fda 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -909,7 +909,7 @@ CossSwapDir::create() if (::stat(path, &swap_sb) < 0) { debugs (47, 2, "COSS swap space space being allocated."); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ mkdir(path); #else diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index cd706d7fdf..f5a36783b7 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -502,7 +502,7 @@ UFSSwapDir::createDirectory(const char *aPath, int should_exist) fatalf("Swap directory %s is not a directory.", aPath); } -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ } else if (0 == mkdir(aPath)) { #else @@ -1090,7 +1090,7 @@ UFSSwapDir::DirClean(int swap_index) if (dir_pointer == NULL) { if (errno == ENOENT) { debugs(36, 0, "storeDirClean: WARNING: Creating " << p1); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (mkdir(p1) == 0) #else diff --git a/src/globals.h b/src/globals.h index 57c0672d55..835c085b61 100644 --- a/src/globals.h +++ b/src/globals.h @@ -135,7 +135,7 @@ extern "C" { extern int64_t store_maxobjsize; /* -1 */ extern hash_table *proxy_auth_username_cache; /* NULL */ extern int incoming_sockets_accepted; -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ extern unsigned int WIN32_Socks_initialized; /* 0 */ #endif diff --git a/src/helper.cc b/src/helper.cc index c1332329af..9d385f6384 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -79,7 +79,7 @@ CBDATA_TYPE(helper_stateful_server); void HelperServerBase::closePipesSafely() { -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ int no = index + 1; shutdown(writePipe->fd, SD_BOTH); @@ -92,7 +92,7 @@ HelperServerBase::closePipesSafely() readPipe->close(); writePipe->close(); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (hIpc) { if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) { getCurrentTime(); @@ -108,7 +108,7 @@ HelperServerBase::closePipesSafely() void HelperServerBase::closeWritePipeSafely() { -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ int no = index + 1; shutdown(writePipe->fd, (readPipe->fd == writePipe->fd ? SD_BOTH : SD_SEND)); @@ -119,7 +119,7 @@ HelperServerBase::closeWritePipeSafely() readPipe->fd = -1; writePipe->close(); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (hIpc) { if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) { getCurrentTime(); diff --git a/src/icmp/Icmp4.h b/src/icmp/Icmp4.h index 10c869f6ba..60ea6eb1a5 100644 --- a/src/icmp/Icmp4.h +++ b/src/icmp/Icmp4.h @@ -52,7 +52,7 @@ #endif /* Linux uses its own field names. */ -#if defined (_SQUID_LINUX_) +#if _SQUID_LINUX_ #ifdef icmp_id #undef icmp_id #endif @@ -86,7 +86,7 @@ #if _SQUID_WINDOWS_ #include "fde.h" -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ #if HAVE_WINSOCK2_H #include diff --git a/src/icmp/IcmpPinger.cc b/src/icmp/IcmpPinger.cc index 35758b4907..cea2b37f6a 100644 --- a/src/icmp/IcmpPinger.cc +++ b/src/icmp/IcmpPinger.cc @@ -56,7 +56,7 @@ IcmpPinger::~IcmpPinger() Close(); } -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ void Win32SockCleanup(void) { @@ -68,7 +68,7 @@ Win32SockCleanup(void) int IcmpPinger::Open(void) { -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ WSADATA wsaData; WSAPROTOCOL_INFO wpi; @@ -162,7 +162,7 @@ IcmpPinger::Open(void) void IcmpPinger::Close(void) { -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ shutdown(icmp_sock, SD_BOTH); close(icmp_sock); diff --git a/src/icmp/IcmpSquid.cc b/src/icmp/IcmpSquid.cc index d530553164..125867f715 100644 --- a/src/icmp/IcmpSquid.cc +++ b/src/icmp/IcmpSquid.cc @@ -260,7 +260,7 @@ IcmpSquid::Open(void) if (localhost.SetIPv4()) SendEcho(localhost, S_ICMP_ECHO, "localhost"); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ debugs(37, 4, HERE << "Pinger handle: 0x" << std::hex << hIpc << std::dec << ", PID: " << pid); @@ -281,7 +281,7 @@ IcmpSquid::Close(void) debugs(37, 1, HERE << "Closing Pinger socket on FD " << icmp_sock); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ send(icmp_sock, (const void *) "$shutdown\n", 10, 0); @@ -289,7 +289,7 @@ IcmpSquid::Close(void) comm_close(icmp_sock); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (hIpc) { if (WaitForSingleObject(hIpc, 12000) != WAIT_OBJECT_0) { diff --git a/src/icmp/pinger.cc b/src/icmp/pinger.cc index bfc49a3785..8bcd798dec 100644 --- a/src/icmp/pinger.cc +++ b/src/icmp/pinger.cc @@ -72,7 +72,7 @@ #include "Icmp6.h" #include "IcmpPinger.h" -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ #if HAVE_WINSOCK2_H #include diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 4e4cf2f62b..1cfbd070ad 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -646,7 +646,7 @@ icpHandleUdp(int sock, void *data) if (ignoreErrno(errno)) break; -#ifdef _SQUID_LINUX_ +#if _SQUID_LINUX_ /* Some Linux systems seem to set the FD for reading and then * return ECONNREFUSED when sendto() fails and generates an ICMP * port unreachable message. */ diff --git a/src/ip/Address.h b/src/ip/Address.h index 216385f059..15920ca901 100644 --- a/src/ip/Address.h +++ b/src/ip/Address.h @@ -45,7 +45,7 @@ #if HAVE_NETINET_IP_H #include #endif -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ #include #endif #if HAVE_NETDB_H diff --git a/src/ipc/Kid.h b/src/ipc/Kid.h index 184f2391e4..869e06b0b0 100644 --- a/src/ipc/Kid.h +++ b/src/ipc/Kid.h @@ -14,7 +14,7 @@ class Kid { public: -#ifdef _SQUID_NEXT_ +#if _SQUID_NEXT_ typedef union wait status_type; #else typedef int status_type; diff --git a/src/main.cc b/src/main.cc index 485f1726bb..53d09a5bf5 100644 --- a/src/main.cc +++ b/src/main.cc @@ -130,7 +130,7 @@ void WINAPI WIN32_svcHandler(DWORD); #endif -#ifndef SQUID_BUILD_INFO +#if !defined(SQUID_BUILD_INFO) #define SQUID_BUILD_INFO "" #endif @@ -168,7 +168,7 @@ static void SquidShutdown(void); static void mainSetCwd(void); static int checkRunningPid(void); -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ static const char *squid_start_script = "squid_start"; #endif @@ -591,7 +591,7 @@ rotate_logs(int sig) { do_rotate = 1; RotateSignal = sig; -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ #if !HAVE_SIGACTION signal(sig, rotate_logs); @@ -605,7 +605,7 @@ reconfigure(int sig) { do_reconfigure = 1; ReconfigureSignal = sig; -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ #if !HAVE_SIGACTION signal(sig, reconfigure); @@ -634,7 +634,7 @@ shut_down(int sig) " pid " << ppid << ": " << xstrerror()); } -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ #if KILL_PARENT_OPT if (!IamMasterProcess() && ppid > 1) { @@ -926,7 +926,7 @@ setEffectiveUser(void) { keepCapabilities(); leave_suid(); /* Run as non privilegied user */ -#ifdef _SQUID_OS2_ +#if _SQUID_OS2_ return; #endif @@ -1010,7 +1010,7 @@ mainInitialize(void) setSystemLimits(); debugs(1, 1, "With " << Squid_MaxFD << " file descriptors available"); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ debugs(1, 1, "With " << _getmaxstdio() << " CRT stdio descriptors available"); @@ -1534,7 +1534,7 @@ sendSignal(void) WIN32_sendSignal(opt_send_signal); exit(0); } else -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ { fprintf(stderr, "%s: ERROR: Could not send ", APP_SHORTNAME); fprintf(stderr, "signal to Squid Service:\n"); @@ -1569,7 +1569,7 @@ sendSignal(void) exit(0); } -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ /* * This function is run when Squid is in daemon mode, just * before the parent forks and starts up the child process. @@ -1599,7 +1599,7 @@ mainStartScript(const char *prog) _exit(-1); } else { do { -#ifdef _SQUID_NEXT_ +#if _SQUID_NEXT_ union wait status; rpid = wait4(cpid, &status, 0, NULL); #else @@ -1642,9 +1642,9 @@ checkRunningPid(void) static void watch_child(char *argv[]) { -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ char *prog; -#ifdef _SQUID_NEXT_ +#if _SQUID_NEXT_ union wait status; #else @@ -1740,7 +1740,7 @@ watch_child(char *argv[]) squid_signal(SIGINT, SIG_IGN, SA_RESTART); -#ifdef _SQUID_NEXT_ +#if _SQUID_NEXT_ pid = wait3(&status, 0, NULL); @@ -1773,7 +1773,7 @@ watch_child(char *argv[]) } else { syslog(LOG_NOTICE, "Squid Parent: unknown child process %d exited", pid); } -#ifdef _SQUID_NEXT_ +#if _SQUID_NEXT_ } while ((pid = wait3(&status, WNOHANG, NULL)) > 0); #else } diff --git a/src/protos.h b/src/protos.h index 9b49041631..957a6aa217 100644 --- a/src/protos.h +++ b/src/protos.h @@ -689,7 +689,7 @@ SQUIDCEXTERN void *leakFreeFL(void *, const char *, int); * prototypes for system functions missing from system includes */ -#ifdef _SQUID_SOLARIS_ +#if _SQUID_SOLARIS_ SQUIDCEXTERN int getrusage(int, struct rusage *); SQUIDCEXTERN int getpagesize(void); @@ -719,7 +719,7 @@ SQUIDCEXTERN void WIN32_InstallService(void); SQUIDCEXTERN void WIN32_RemoveService(void); SQUIDCEXTERN int SquidMain(int, char **); #endif /* _SQUID_WINDOWS_ */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ SQUIDCEXTERN int WIN32_pipe(int[2]); diff --git a/src/squid.h b/src/squid.h index b6298c75d0..b55969f7dd 100644 --- a/src/squid.h +++ b/src/squid.h @@ -34,7 +34,7 @@ #include "config.h" -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ /** \cond AUTODOCS-IGNORE */ using namespace Squid; /** \endcond */ diff --git a/src/ssl/certificate_db.cc b/src/ssl/certificate_db.cc index be55da7f4d..88dcd29f97 100644 --- a/src/ssl/certificate_db.cc +++ b/src/ssl/certificate_db.cc @@ -36,7 +36,7 @@ Ssl::FileLocker::FileLocker(std::string const & filename) Ssl::FileLocker::~FileLocker() { -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (hFile != INVALID_HANDLE_VALUE) { UnlockFile(hFile, 0, 0, 1, 0); CloseHandle(hFile); @@ -258,14 +258,14 @@ void Ssl::CertificateDb::create(std::string const & db_path, int serial) std::string cert_full(db_path + "/" + cert_dir); std::string size_full(db_path + "/" + size_file); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (mkdir(db_path.c_str())) #else if (mkdir(db_path.c_str(), 0777)) #endif throw std::runtime_error("Cannot create " + db_path); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (mkdir(cert_full.c_str())) #else if (mkdir(cert_full.c_str(), 0777)) diff --git a/src/ssl/certificate_db.h b/src/ssl/certificate_db.h index 0efbd7fb02..9b10634105 100644 --- a/src/ssl/certificate_db.h +++ b/src/ssl/certificate_db.h @@ -22,7 +22,7 @@ public: /// Unlock file ~FileLocker(); private: -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ HANDLE hFile; ///< Windows file handle. #else int fd; ///< Linux file descriptor. diff --git a/src/ssl/support.h b/src/ssl/support.h index eb24fd347d..6ac0fd4406 100644 --- a/src/ssl/support.h +++ b/src/ssl/support.h @@ -153,9 +153,9 @@ int asn1timeToString(ASN1_TIME *tm, char *buf, int len); bool setClientSNI(SSL *ssl, const char *fqdn); } //namespace Ssl -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ -#ifdef __cplusplus +#if defined(__cplusplus) /** \cond AUTODOCS-IGNORE */ namespace Squid diff --git a/src/store_dir.cc b/src/store_dir.cc index 6925700c02..8e6ae59f2c 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -106,7 +106,7 @@ StoreController::createOneStore(Store &aStore) * The following is a workaround for create store directories sequentially * when running on native Windows port. */ -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ if (fork()) return; @@ -115,7 +115,7 @@ StoreController::createOneStore(Store &aStore) aStore.create(); -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ exit(0); @@ -127,13 +127,13 @@ StoreController::create() { swapDir->create(); -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ pid_t pid; do { int status; -#ifdef _SQUID_NEXT_ +#if _SQUID_NEXT_ pid = wait3(&status, WNOHANG, NULL); #else diff --git a/src/tools.cc b/src/tools.cc index 71bbe8804e..70ac390d4f 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -72,7 +72,7 @@ extern void log_trace_init(char *); static void restoreCapabilities(int keep); int DebugSignal = -1; -#ifdef _SQUID_LINUX_ +#if _SQUID_LINUX_ /* Workaround for crappy glic header files */ SQUIDCEXTERN int backtrace(void *, int); SQUIDCEXTERN void backtrace_symbols_fd(void *, int, int); @@ -338,7 +338,7 @@ death(int sig) fprintf(debug_log, "FATAL: Received signal %d...dying.\n", sig); #if PRINT_STACK_TRACE -#ifdef _SQUID_HPUX_ +#if _SQUID_HPUX_ { extern void U_STACK_TRACE(void); /* link with -lcl */ fflush(debug_log); @@ -558,8 +558,8 @@ debug_trap(const char *message) void sig_child(int sig) { -#ifndef _SQUID_MSWIN_ -#ifdef _SQUID_NEXT_ +#if !_SQUID_MSWIN_ +#if _SQUID_NEXT_ union wait status; #else @@ -569,7 +569,7 @@ sig_child(int sig) pid_t pid; do { -#ifdef _SQUID_NEXT_ +#if _SQUID_NEXT_ pid = wait3(&status, WNOHANG, NULL); #else @@ -1076,7 +1076,7 @@ squid_signal(int sig, SIGHDLR * func, int flags) debugs(50, 0, "sigaction: sig=" << sig << " func=" << func << ": " << xstrerror()); #else -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ /* On Windows, only SIGINT, SIGILL, SIGFPE, SIGTERM, SIGBREAK, SIGABRT and SIGSEGV signals are supported, so we must care of don't call signal() for other value. diff --git a/src/unlinkd.cc b/src/unlinkd.cc index 3e9a7d121a..c46e1c20fa 100644 --- a/src/unlinkd.cc +++ b/src/unlinkd.cc @@ -142,7 +142,7 @@ unlinkdUnlink(const char *path) void unlinkdClose(void) -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ { if (unlinkd_wfd > -1) { @@ -244,7 +244,7 @@ unlinkdInit(void) debugs(2, 1, "Unlinkd pipe opened on FD " << unlinkd_wfd); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ debugs(2, 4, "Unlinkd handle: 0x" << std::hex << hIpc << std::dec << ", PID: " << pid); diff --git a/src/win32.cc b/src/win32.cc index b89b798d13..81872324be 100644 --- a/src/win32.cc +++ b/src/win32.cc @@ -36,7 +36,7 @@ #include "squid.h" #include "squid_windows.h" -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ #if HAVE_WIN32_PSAPI #include #endif diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc index a279aaba5f..e8c7060b2a 100644 --- a/tools/cachemgr.cc +++ b/tools/cachemgr.cc @@ -165,7 +165,7 @@ static const char *make_auth_header(const cachemgr_request * req); static int check_target_acl(const char *hostname, int port); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ static int s_iInitCount = 0; int Win32SockInit(void) @@ -209,7 +209,7 @@ void Win32SockCleanup(void) return; } -#endif /* ifdef _SQUID_MSWIN_ */ +#endif static const char * safe_str(const char *str) @@ -577,7 +577,7 @@ static int read_reply(int s, cachemgr_request * req) { char buf[4 * 1024]; -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ int reply; char *tmpfile = tempnam(NULL, "tmp0000"); @@ -601,7 +601,7 @@ read_reply(int s, cachemgr_request * req) parse_menu = 1; if (fp == NULL) { -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ perror(tmpfile); xfree(tmpfile); #else @@ -613,7 +613,7 @@ read_reply(int s, cachemgr_request * req) return 1; } -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ while ((reply=recv(s, buf , sizeof(buf), 0)) > 0) fwrite(buf, 1, reply, fp); @@ -752,7 +752,7 @@ read_reply(int s, cachemgr_request * req) } fclose(fp); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ remove(tmpfile); xfree(tmpfile); @@ -867,7 +867,7 @@ main(int argc, char *argv[]) cachemgr_request *req; now = time(NULL); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ Win32SockInit(); atexit(Win32SockCleanup); @@ -975,7 +975,7 @@ read_request(void) else return NULL; -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ if (strlen(buf) == 0 || strlen(buf) == 4000) #else diff --git a/tools/squidclient.cc b/tools/squidclient.cc index f2fd99877a..41735ba255 100644 --- a/tools/squidclient.cc +++ b/tools/squidclient.cc @@ -38,7 +38,7 @@ #include "rfc1123.h" #include "SquidTime.h" -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ /** \cond AUTODOCS-IGNORE */ using namespace Squid; /** \endcond */ @@ -147,14 +147,14 @@ static struct stat sb; int total_bytes = 0; int io_timeout = 120; -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ void Win32SockCleanup(void) { WSACleanup(); return; } -#endif /* ifdef _SQUID_MSWIN_ */ +#endif static void usage(const char *progname) @@ -385,7 +385,7 @@ main(int argc, char *argv[]) break; } } -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ { WSADATA wsaData; WSAStartup(2, &wsaData); @@ -644,7 +644,7 @@ main(int argc, char *argv[]) if (put_file) { int x; lseek(put_fd, 0, SEEK_SET); -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ while ((x = read(put_fd, buf, sizeof(buf))) > 0) { #else @@ -664,7 +664,7 @@ main(int argc, char *argv[]) } /* Read the data */ -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ setmode(1, O_BINARY); #endif @@ -676,7 +676,7 @@ main(int argc, char *argv[]) perror("client: ERROR writing to stdout"); } -#ifdef _SQUID_MSWIN_ +#if _SQUID_MSWIN_ setmode(1, O_TEXT); #endif @@ -822,7 +822,7 @@ set_our_signal(void) static ssize_t myread(int fd, void *buf, size_t len) { -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ alarm(io_timeout); return read(fd, buf, len); #else @@ -834,7 +834,7 @@ myread(int fd, void *buf, size_t len) static ssize_t mywrite(int fd, void *buf, size_t len) { -#ifndef _SQUID_MSWIN_ +#if !_SQUID_MSWIN_ alarm(io_timeout); return write(fd, buf, len); #else