Hi,

nit pick, the usual way to do preprocessor macros with { } is:

#define foo(x) \
   do { \
       bar \
   } while (0)

This way you don't end up with a stray ; after the
} which sometimes can lead to issues / warnings.

IE:

if (x)
   foo(x);
else
   ...

Would not work with your way because it would expand to:

if (x)
{
   ...
};
else

And the ; makes the compiler not expect else, since there
are now 2 statements between the if and the else

Regards,

Hans



On 04/07/2011 06:10 PM, Alon Levy wrote:
---
  display/qxldd.h |    9 +++++++++
  1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/display/qxldd.h b/display/qxldd.h
index 0f90af1..7130b47 100644
--- a/display/qxldd.h
+++ b/display/qxldd.h
@@ -44,6 +44,15 @@

  #define DEBUG_PRINT(arg) DebugPrint arg

+#define DEBUG_PRINT_ONCE(arg)       \
+    {                               \
+        static int run = 0;         \
+        if (!run) {                 \
+            run = 1;                \
+            DebugPrint arg;         \
+        }                           \
+    }
+
  #ifdef DBG
  #define ASSERT(pdev, x) if (!(x)) { \
      DebugPrint(pdev, 0, "ASSERT(%s) failed @ %s\n", #x, __FUNCTION__); \
_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to