]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Remove duplicate code now in libsquid-compat
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 21 Jan 2009 09:46:54 +0000 (22:46 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 21 Jan 2009 09:46:54 +0000 (22:46 +1300)
include/config.h
libsquid-compat/compat.h
libsquid-compat/os/squid_dragonfly.h [new file with mode: 0644]
libsquid-compat/os/squid_os2.h [new file with mode: 0644]
libsquid-compat/osdetect.h
libsquid-compat/squid_valgrind.h

index a050ff9e8b7b6720006ff3df8ccb73e3bd60b4b3..e4b401f6f31164afa0fe361dbc574b7b359360b0 100644 (file)
 #endif
 #endif
 
-/* define the _SQUID_TYPE_ based on a guess of the OS */
-#if defined(__sun__) || defined(__sun) /* SUN */
-#define _SQUID_SUN_
-#if defined(__SVR4)            /* SOLARIS */
-#define _SQUID_SOLARIS_
-#else /* SUNOS */
-#define _SQUID_SUNOS_
-#endif
-
-#elif defined(__hpux)          /* HP-UX - SysV-like? */
-#define _SQUID_HPUX_
-#define _SQUID_SYSV_
-
-#elif defined(__osf__)         /* OSF/1 */
-#define _SQUID_OSF_
-
-#elif defined(__ultrix)                /* Ultrix */
-#define _SQUID_ULTRIX_
-
-#elif defined(_AIX)            /* AIX */
-#define _SQUID_AIX_
-
-#elif defined(__linux__)       /* Linux */
-#define _SQUID_LINUX_
-#if USE_ASYNC_IO
-#define _SQUID_LINUX_THREADS_
-#endif
-
-#elif defined(__FreeBSD__)     /* FreeBSD */
-#define _SQUID_FREEBSD_
-#if USE_ASYNC_IO && defined(LINUXTHREADS)
-#define _SQUID_LINUX_THREADS_
-#endif
-
-#elif defined(__sgi__) || defined(sgi) || defined(__sgi)       /* SGI */
-#define _SQUID_SGI_
-#if !defined(_SVR4_SOURCE)
-#define _SVR4_SOURCE           /* for tempnam(3) */
-#endif
-#if USE_ASYNC_IO
-#define _ABI_SOURCE
-#endif /* USE_ASYNC_IO */
-
-#elif defined(__NeXT__)
-#define _SQUID_NEXT_
-
-#elif defined(__bsdi__)
-#define _SQUID_BSDI_           /* BSD/OS */
-
-#elif defined(__NetBSD__)
-#define _SQUID_NETBSD_
-
-#elif defined(__OpenBSD__)
-#define _SQUID_OPENBSD_
-
-#elif defined(__DragonFly__)
-#define _SQUID_DRAGONFLY_
-
-#elif defined(__CYGWIN32__)  || defined(__CYGWIN__)
-#define _SQUID_CYGWIN_
-#define _SQUID_WIN32_
-
-#elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32)
-#define _SQUID_MSWIN_
-#define _SQUID_WIN32_
-#include "squid_mswin.h"
-
-#elif defined(__APPLE__)
-#define _SQUID_APPLE_
-
-#elif defined(sony_news) && defined(__svr4)
-#define _SQUID_NEWSOS6_
-
-#elif defined(__EMX__) || defined(OS2) || defined(__OS2__)
-#define _SQUID_OS2_
-/*
-*  FIXME: the os2 port of bash seems to have problems checking
-*  the return codes of programs in if statements.  These options
-*  need to be overridden.
-*/
-#endif
 
 /* Typedefs for missing entries on a system */
 
-#include "squid_types.h"
-
 /* int8_t */
 #ifndef HAVE_INT8_T
 #if HAVE_CHAR && SIZEOF_CHAR == 1
@@ -262,40 +179,6 @@ typedef int socklen_t;
 typedef long mtyp_t;
 #endif
 
-/*
- * On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
- * that is incompatible with the updated Solaris header files.
- */
-#if defined(_SQUID_SOLARIS_) && (defined(i386) || defined(__i386))
-#ifndef HAVE_PAD128_T
-typedef union {
-    long double        _q;
-    int32_t            _l[4];
-} pad128_t;
-#endif
-#ifndef HAVE_UPAD128_T
-typedef union {
-    long double        _q;
-    uint32_t   _l[4];
-} upad128_t;
-#endif
-#endif
-
-/*
- * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD
- */
-#if defined(HAVE_MALLOC_H) && (defined(_SQUID_FREEBSD_) || defined(_SQUID_NEXT_) || defined(_SQUID_OPENBSD_) || defined(_SQUID_DRAGONFLY_))
-#undef HAVE_MALLOC_H
-#endif
-
-/*
- * res_init() is just a macro re-definition of __res_init on Linux (Debian/Ubuntu)
- */
-#if !defined(HAVE_RES_INIT) && defined(HAVE___RES_INIT) && !defined(res_init)
-#define res_init  __res_init
-#define HAVE_RES_INIT  HAVE___RES_INIT
-#endif
-
 #if !defined(CACHEMGR_HOSTNAME)
 #define CACHEMGR_HOSTNAME ""
 #else
@@ -379,33 +262,6 @@ typedef union {
 #define LEAK_CHECK_MODE 1
 #endif
 
-/*
- * valgrind debug support
- */
-#if WITH_VALGRIND
-#include <valgrind/memcheck.h>
-/* A little glue for older valgrind version prior to 3.2.0 */
-#ifndef VALGRIND_MAKE_MEM_NOACCESS
-#define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS
-#define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE
-#define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE
-#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE
-#else
-#undef VALGRIND_MAKE_NOACCESS
-#undef VALGRIND_MAKE_WRITABLE
-#undef VALGRIND_MAKE_READABLE
-#endif
-#else
-#define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0)
-#define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0)
-#define VALGRIND_MAKE_MEM_DEFINED(a,b) (0)
-#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0)
-#define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0)
-#define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d)
-#define VALGRIND_FREELIKE_BLOCK(a,b)
-#define RUNNING_ON_VALGRIND 0
-#endif /* WITH_VALGRIND */
-
 
 /*
  * strnstr() is needed. The OS may not provide a working copy.
index d959778bf716506466d90aff3fc6621419afe0d5..980ef0759d3045a9de85556739f5a36bd57df1e5 100644 (file)
@@ -7,16 +7,16 @@
 
 /*
  * From discussions it was chosen to push compat code as far down as possible.
- * That means we can eventually have a seperate libcompat for most
+ * That means we can have a seperate libsquid-compat for most
  *  compatability and portability hacks and resolutions.
  * 
  * This file is meant to collate all those hacks files together and
- * provide a simple include form them in the core squid headers
+ * provide a simple include for them in the core squid headers
  * (presently squid.h and config.h) 
  *
  * It should not be included directly in any of the squid sources.
  * If your code requires any symbols from here you should be importing
- * squid.h at the top line of your .cc or .h file.
+ * config.h/squid.h at the top line of your .cc or .h file.
  */
 
 
 /*****************************************************/
 
 #include "os/squid_aix.h"
+#include "os/squid_dragonfly.h"
 #include "os/squid_freebsd.h"
 #include "os/squid_hpux.h"
 #include "os/squid_linux.h"
 #include "os/squid_mswin.h"
 #include "os/squid_next.h"
 #include "os/squid_openbsd.h"
+#include "os/squid_os2.h"
 #include "os/squid_qnx.h"
 #include "os/squid_sgi.h"
 #include "os/squid_solaris.h"
+#include "os/squid_sunos.h"
 #include "os/squid_windows.h"
 
+
 /*****************************************************/
 /* portabilities shared between all platforms and    */
 /* components as found to be needed                  */
diff --git a/libsquid-compat/os/squid_dragonfly.h b/libsquid-compat/os/squid_dragonfly.h
new file mode 100644 (file)
index 0000000..e7fa904
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_DRAGONFLY_H
+#define SQUID_OS_DRAGONFLY_H
+
+#ifdef _SQUID_DRAGONFLY_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+/*
+ * Don't allow inclusion of malloc.h
+ */
+#if defined(HAVE_MALLOC_H)
+#undef HAVE_MALLOC_H
+#endif
+
+
+#endif /* _SQUID_DRAGONFLY_ */
+#endif /* SQUID_OS_DRAGONFLY_H */
diff --git a/libsquid-compat/os/squid_os2.h b/libsquid-compat/os/squid_os2.h
new file mode 100644 (file)
index 0000000..92f99f1
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef SQUID_OS_OS2_H
+#define SQUID_OS_OS2_H
+
+#ifdef _SQUID_OS2_
+
+/****************************************************************************
+ *--------------------------------------------------------------------------*
+ * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
+ *--------------------------------------------------------------------------*
+ ****************************************************************************/
+
+/*
+*  FIXME: the os2 port of bash seems to have problems checking
+*  the return codes of programs in if statements.  These options
+*  need to be overridden.
+*/
+
+
+#endif /* _SQUID_OS2_ */
+#endif /* SQUID_OS_OS2_H */
index e32b6295b48a312ab7f12986af45332d1a7a0ccc..fb1eb9acad11abdd1ad7b0e9282c658ba807fa70 100644 (file)
  */
 
 #if defined(__sun__) || defined(__sun) /* SUN */
-#define _SQUID_SUN_
-#if defined(__SVR4)            /* SOLARIS */
-#define _SQUID_SOLARIS_
-#else /* SUNOS */
-#define _SQUID_SUNOS_
-#endif
+# define _SQUID_SUN_
+# if defined(__SVR4)           /* SOLARIS */
+#  define _SQUID_SOLARIS_
+# else /* SUNOS */
+#  define _SQUID_SUNOS_
+# endif
 
 #elif defined(__hpux)          /* HP-UX - SysV-like? */
 #define _SQUID_HPUX_
 
 #elif defined(__EMX__) || defined(OS2) || defined(__OS2__)
 #define _SQUID_OS2_
-/*
- *  FIXME: the os2 port of bash seems to have problems checking
- *  the return codes of programs in if statements.  These options
- *  need to be overridden.
- */
 
 #endif /* OS automatic detection */
 
index 7c3bc46e9fd65403a603c55d1fd7652c4629cac8..737ee8f128880a593ce11852b1c1cac209fb1a2c 100644 (file)
  * valgrind debug support
  */
 #if WITH_VALGRIND
-#include <valgrind/memcheck.h>
-#undef VALGRIND_MAKE_NOACCESS
-#undef VALGRIND_MAKE_WRITABLE
-#undef VALGRIND_MAKE_READABLE
+# include <valgrind/memcheck.h>
 /* A little glue for older valgrind version prior to 3.2.0 */
-#ifndef VALGRIND_MAKE_MEM_NOACCESS
-#define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS
-#define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE
-#define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE
-#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE
-#endif
+# ifndef VALGRIND_MAKE_MEM_NOACCESS
+#  define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS
+#  define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE
+#  define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE
+#  define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE
+# else
+#  undef VALGRIND_MAKE_NOACCESS
+#  undef VALGRIND_MAKE_WRITABLE
+#  undef VALGRIND_MAKE_READABLE
+# endif
 #else
-#define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0)
-#define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0)
-#define VALGRIND_MAKE_MEM_DEFINED(a,b) (0)
-#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0)
-#define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0)
-#define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d)
-#define VALGRIND_FREELIKE_BLOCK(a,b)
-#define RUNNING_ON_VALGRIND 0
+# define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0)
+# define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0)
+# define VALGRIND_MAKE_MEM_DEFINED(a,b) (0)
+# define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0)
+# define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0)
+# define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d)
+# define VALGRIND_FREELIKE_BLOCK(a,b)
+# define RUNNING_ON_VALGRIND 0
 #endif /* WITH_VALGRIND */
 
 #endif /* SQUID_CONFIG_H */