summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorXuefer <xuefer@gmail.com>2012-07-18 01:54:45 +0000
committerXuefer <xuefer@gmail.com>2012-07-18 01:54:45 +0000
commit914233e41174e00785a14c5e3714b33f0380efaf (patch)
tree21ed8b56fdcc0422f56a81de4675aa1ed56b0eda /util
parent94c430e1b1a66cfc287cb096e8b3db97213ddacf (diff)
downloadxcache-914233e41174e00785a14c5e3714b33f0380efaf.tar.gz
xcache-914233e41174e00785a14c5e3714b33f0380efaf.zip
missed from previous commit
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@984 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
Diffstat (limited to 'util')
-rw-r--r--util/xc_trace.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/util/xc_trace.h b/util/xc_trace.h
new file mode 100644
index 0000000..285aead
--- /dev/null
+++ b/util/xc_trace.h
@@ -0,0 +1,47 @@
+#ifndef XC_TRACE_H_709AE2523EDACB72B54D9CB42DDB0FEE
+#define XC_TRACE_H_709AE2523EDACB72B54D9CB42DDB0FEE
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#ifdef XCACHE_DEBUG
+# define IFDEBUG(x) (x)
+int xc_vtrace(const char *fmt, va_list args);
+int xc_trace(const char *fmt, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2);
+
+# ifdef ZEND_WIN32
+static inline int TRACE(const char *fmt, ...)
+{
+ va_list args;
+ int ret;
+
+ va_start(args, fmt);
+ ret = xc_vtrace(fmt, args);
+ va_end(args);
+ return ret;
+}
+# else
+# define TRACE(fmt, ...) \
+ xc_trace("%s:%d: " fmt "\r\n", __FILE__, __LINE__, __VA_ARGS__)
+# endif /* ZEND_WIN32 */
+# undef NDEBUG
+# undef inline
+# define inline
+#else /* XCACHE_DEBUG */
+
+# ifdef ZEND_WIN32
+static inline int TRACE_DUMMY(const char *fmt, ...)
+{
+ return 0;
+}
+# define TRACE 1 ? 0 : TRACE_DUMMY
+# else
+# define TRACE(fmt, ...) do { } while (0)
+# endif /* ZEND_WIN32 */
+
+# define IFDEBUG(x) do { } while (0)
+#endif /* XCACHE_DEBUG */
+#include <assert.h>
+
+#endif /* XC_TRACE_H_709AE2523EDACB72B54D9CB42DDB0FEE */