From: Amos Jeffries Date: Thu, 9 Aug 2012 10:32:57 +0000 (+1200) Subject: Portability: shuffle out the last useful macros from squid-old.h X-Git-Tag: sourceformat-review-1~128 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aff65b8374775a10d7b992fb50633d178ee7bdf3;p=thirdparty%2Fsquid.git Portability: shuffle out the last useful macros from squid-old.h --- diff --git a/compat/os/next.h b/compat/os/next.h index 556777e384..7fd8240d8f 100644 --- a/compat/os/next.h +++ b/compat/os/next.h @@ -42,5 +42,9 @@ #undef HAVE_NETDB_H #define HAVE_NETDB_H 0 +#if !defined(S_ISDIR) +#define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR)) +#endif + #endif /* _SQUID_NEXT_ */ #endif /* SQUID_OS_NEXT_H */ diff --git a/include/leakcheck.h b/include/leakcheck.h new file mode 100644 index 0000000000..acb05efd05 --- /dev/null +++ b/include/leakcheck.h @@ -0,0 +1,13 @@ +#ifndef _SQUID_LEAKCHECK_H +#define _SQUID_LEAKCHECK_H + +#if LEAK_CHECK_MODE && 0 /* doesn't work at the moment */ +#define LOCAL_ARRAY(type,name,size) \ + static type *local_##name=NULL; \ + type *name = local_##name ? local_##name : \ + ( local_##name = (type *)xcalloc(size, sizeof(type)) ) +#else +#define LOCAL_ARRAY(type,name,size) static type name[size] +#endif + +#endif diff --git a/include/squid.h b/include/squid.h index 34ae37b417..b5ecdeb304 100644 --- a/include/squid.h +++ b/include/squid.h @@ -116,4 +116,11 @@ /* temp hack: needs to be pre-defined for now. */ #define SQUID_MAXPATHLEN 256 +// TODO: determine if this is required. OR if compat/os/mswin.h works +#if _SQUID_MSWIN_ +/** \cond AUTODOCS-IGNORE */ +using namespace Squid; +/** \endcond */ +#endif + #endif /* SQUID_CONFIG_H */ diff --git a/src/squid-old.h b/src/squid-old.h index a5ccf4953e..9c54dc2466 100644 --- a/src/squid-old.h +++ b/src/squid-old.h @@ -34,12 +34,6 @@ #include "squid.h" -#if _SQUID_MSWIN_ -/** \cond AUTODOCS-IGNORE */ -using namespace Squid; -/** \endcond */ -#endif - #if HAVE_UNISTD_H #include #endif @@ -140,19 +134,6 @@ using namespace Squid; #define MAXPATHLEN SQUID_MAXPATHLEN #endif -#if LEAK_CHECK_MODE -#define LOCAL_ARRAY(type,name,size) \ - static type *local_##name=NULL; \ - type *name = local_##name ? local_##name : \ - ( local_##name = (type *)xcalloc(size, sizeof(type)) ) -#else -#define LOCAL_ARRAY(type,name,size) static type name[size] -#endif - -#if _SQUID_NEXT_ && !defined(S_ISDIR) -#define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR)) -#endif - #include "md5.h" #if SQUID_SNMP #include "cache_snmp.h"