From: Amos Jeffries Date: Tue, 29 Nov 2011 06:20:26 +0000 (-0700) Subject: Cleanup: remove defined() from compat OS macros X-Git-Tag: SQUID_3_2_0_14~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2232d18633f7749ebcc7fdb09b1a9b5768323f51;p=thirdparty%2Fsquid.git Cleanup: remove defined() from compat OS macros --- diff --git a/compat/shm.cc b/compat/shm.cc index dbaf430e11..29a44c3451 100644 --- a/compat/shm.cc +++ b/compat/shm.cc @@ -1,8 +1,8 @@ #include "config.h" #include "compat/shm.h" -#if defined(__FreeBSD__) && (__FreeBSD__ >= 7) -# include +#if _SQUID_FREEBSD_ && (__FreeBSD__ >= 7) +#include #endif @@ -15,9 +15,9 @@ bool shm_portable_segment_name_is_path() { -#if defined(_SQUID_HPUX_) || defined(_SQUID_OSF_) || defined(__vms) || (defined(_SQUID_FREEBSD_) && (__FreeBSD__ < 7)) +#if _SQUID_HPUX_ || _SQUID_OSF_ || defined(__vms) || (_SQUID_FREEBSD_ && (__FreeBSD__ < 7)) return true; -#elif defined(_SQUID_FREEBSD_) +#elif _SQUID_FREEBSD_ int jailed = 0; size_t len = sizeof(jailed); ::sysctlbyname("security.jail.jailed", &jailed, &len, NULL, 0); diff --git a/include/squid_endian.h b/include/squid_endian.h index 74040330f8..278305c97c 100644 --- a/include/squid_endian.h +++ b/include/squid_endian.h @@ -127,7 +127,7 @@ * * Except OpenBSD - htole16 & 32 exist, but not le16toh etc */ -#if defined(_SQUID_OPENBSD_) +#if _SQUID_OPENBSD_ # define le16toh(x) htole16(x) # define le32toh(x) htole32(x) #endif diff --git a/lib/dirent.c b/lib/dirent.c index df96de8928..392031d911 100644 --- a/lib/dirent.c +++ b/lib/dirent.c @@ -51,7 +51,7 @@ #include "config.h" /* The following code section is part of the native Windows Squid port */ -#if defined(_SQUID_MSWIN_) +#if _SQUID_MSWIN_ #include "util.h" #include diff --git a/src/WinSvc.cc b/src/WinSvc.cc index 13f6549d7b..2b8b7eaf34 100644 --- a/src/WinSvc.cc +++ b/src/WinSvc.cc @@ -57,7 +57,7 @@ static void WIN32_build_argv (char *); #endif extern "C" void WINAPI SquidWinSvcMain(DWORD, char **); -#if defined(_SQUID_MSWIN_) +#if _SQUID_MSWIN_ #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ void Squid_Win32InvalidParameterHandler(const wchar_t*, const wchar_t*, const wchar_t*, unsigned int, uintptr_t); #endif @@ -978,7 +978,7 @@ int main(int argc, char **argv) #endif /* USE_WIN32_SERVICE */ -#if defined(_SQUID_MSWIN_) +#if _SQUID_MSWIN_ static int Win32SockInit(void) { int iVersionRequested; diff --git a/src/comm.cc b/src/comm.cc index 4a45eb0400..b605f40e9b 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -870,7 +870,7 @@ comm_connect_addr(int sock, const Ip::Address &address) debugs(14,9, "connecting to: " << address ); } } else { -#if defined(_SQUID_NEWSOS6_) +#if _SQUID_NEWSOS6_ /* Makoto MATSUSHITA */ connect(sock, AI->ai_addr, AI->ai_addrlen); @@ -891,7 +891,7 @@ comm_connect_addr(int sock, const Ip::Address &address) if (x == 0) errno = err; -#if defined(_SQUID_SOLARIS_) +#if _SQUID_SOLARIS_ /* * Solaris 2.4's socket emulation doesn't allow you * to determine the error from a failed non-blocking diff --git a/src/ipc.cc b/src/ipc.cc index f346c9a5cd..763050fc1b 100644 --- a/src/ipc.cc +++ b/src/ipc.cc @@ -87,8 +87,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name int t1, t2, t3; int x; -#if USE_POLL && defined(_SQUID_OSF_) - +#if USE_POLL && _SQUID_OSF_ assert(type != IPC_FIFO); #endif diff --git a/src/squid.h b/src/squid.h index b55969f7dd..c1f4560432 100644 --- a/src/squid.h +++ b/src/squid.h @@ -149,7 +149,7 @@ using namespace Squid; #define LOCAL_ARRAY(type,name,size) static type name[size] #endif -#if defined(_SQUID_NEXT_) && !defined(S_ISDIR) +#if _SQUID_NEXT_ && !defined(S_ISDIR) #define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR)) #endif diff --git a/src/tools.cc b/src/tools.cc index bd0c3334c0..4b7a0ad921 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -271,18 +271,9 @@ int rusage_maxrss(struct rusage *r) { -#if defined(_SQUID_SGI_) && _ABIAPI +#if _SQUID_SGI_ && _ABIAPI return r->ru_pad[0]; -#elif defined(_SQUID_SGI_) - - return r->ru_maxrss; -#elif defined(_SQUID_OSF_) - - return r->ru_maxrss; -#elif defined(_SQUID_AIX_) - - return r->ru_maxrss; -#elif defined(BSD4_4) +#elif _SQUID_SGI_|| _SQUID_OSF_ || _SQUID_AIX_ || defined(BSD4_4) return r->ru_maxrss; #elif defined(HAVE_GETPAGESIZE) && HAVE_GETPAGESIZE != 0 @@ -301,7 +292,7 @@ int rusage_pagefaults(struct rusage *r) { -#if defined(_SQUID_SGI_) && _ABIAPI +#if _SQUID_SGI_ && _ABIAPI return r->ru_pad[5]; #else @@ -347,7 +338,7 @@ death(int sig) } #endif /* _SQUID_HPUX_ */ -#if defined(_SQUID_SOLARIS_) && HAVE_LIBOPCOM_STACK +#if _SQUID_SOLARIS_ && HAVE_LIBOPCOM_STACK { /* get ftp://opcom.sun.ca/pub/tars/opcom_stack.tar.gz and */ extern void opcom_stack_trace(void); /* link with -lopcom_stack */ fflush(debug_log); @@ -368,7 +359,7 @@ death(int sig) #endif #endif /* PRINT_STACK_TRACE */ -#if SA_RESETHAND == 0 && !defined(_SQUID_MSWIN_) +#if SA_RESETHAND == 0 && !_SQUID_MSWIN_ signal(SIGSEGV, SIG_DFL); signal(SIGBUS, SIG_DFL); @@ -1383,7 +1374,7 @@ restoreCapabilities(int keep) } cap_free(caps); } -#elif defined(_SQUID_LINUX_) +#elif _SQUID_LINUX_ Ip::Interceptor.StopTransparency("Missing needed capability support."); #endif /* HAVE_SYS_CAPABILITY_H */ } diff --git a/src/unlinkd.cc b/src/unlinkd.cc index 09066fbb64..96dbf9d12c 100644 --- a/src/unlinkd.cc +++ b/src/unlinkd.cc @@ -215,10 +215,10 @@ unlinkdInit(void) localhost.SetLocalhost(); pid = ipcCreate( -#if USE_POLL && defined(_SQUID_OSF_) +#if USE_POLL && _SQUID_OSF_ /* pipes and poll() don't get along on DUNIX -DW */ IPC_STREAM, -#elif defined(_SQUID_MSWIN_) +#elif _SQUID_MSWIN_ /* select() will fail on a pipe */ IPC_TCP_SOCKET, #else diff --git a/test-suite/tcp-banger2.c b/test-suite/tcp-banger2.c index 4c775497eb..aa297a14a0 100644 --- a/test-suite/tcp-banger2.c +++ b/test-suite/tcp-banger2.c @@ -11,7 +11,7 @@ #define CHANGE_FD_SETSIZE 1 /* Cannot increase FD_SETSIZE on Linux */ -#if defined(_SQUID_LINUX_) +#if _SQUID_LINUX_ #undef CHANGE_FD_SETSIZE #define CHANGE_FD_SETSIZE 0 #endif @@ -20,7 +20,7 @@ * to return EINVAL. */ /* Marian Durkovic */ /* Peter Wemm */ -#if defined(_SQUID_FREEBSD_) +#if _SQUID_FREEBSD_ #include #if __FreeBSD_version < 220000 #undef CHANGE_FD_SETSIZE diff --git a/test-suite/tcp-banger3.c b/test-suite/tcp-banger3.c index 7161503616..e3d4f3fbe6 100644 --- a/test-suite/tcp-banger3.c +++ b/test-suite/tcp-banger3.c @@ -9,7 +9,7 @@ #define CHANGE_FD_SETSIZE 1 /* Cannot increase FD_SETSIZE on Linux */ -#if defined(_SQUID_LINUX_) +#if _SQUID_LINUX_ #undef CHANGE_FD_SETSIZE #define CHANGE_FD_SETSIZE 0 #endif @@ -18,7 +18,7 @@ * to return EINVAL. */ /* Marian Durkovic */ /* Peter Wemm */ -#if defined(_SQUID_FREEBSD_) +#if _SQUID_FREEBSD_ #include #if __FreeBSD_version < 220000 #undef CHANGE_FD_SETSIZE