summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMicah Dowty <[email protected]>2009-04-24 23:45:16 +0200
committerJakob Bornecrantz <[email protected]>2009-04-24 23:59:21 +0200
commitb618827fac84ca12a354da5808f30e96bedbc92a (patch)
tree16af62421439fd58090a3c647b6f0de6b701a224 /src
parent99b77d05d2e8c4af5f7d752d6827c21fd6c4d5ee (diff)
util: Add debug_printf_once
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_debug.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index bcd8f0f3cf1..d42b65ce281 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -102,6 +102,22 @@ debug_printf(const char *format, ...)
}
+/*
+ * ... isn't portable so we need to pass arguments in parentheses.
+ *
+ * usage:
+ * debug_printf_once(("awnser: %i\n", 42));
+ */
+#define debug_printf_once(args) \
+ do { \
+ static boolean once = TRUE; \
+ if (once) { \
+ once = FALSE; \
+ debug_printf args; \
+ } \
+ } while (0)
+
+
#ifdef DEBUG
#define debug_vprintf(_format, _ap) _debug_vprintf(_format, _ap)
#else