chiark / gitweb /
factor out DEBUG_DEFINE_DEBUGF
[ypp-sc-tools.db-test.git] / pctb / ocr.h
index a688742cc631f0bdb88b66bce1b3e8d360713794..93b158b6a4ee220d0d15466310adb5295d79371e 100644 (file)
@@ -81,4 +81,13 @@ void debug_flush(void);
 
 const char *get_vardir(void);
 
+#define DEBUG_DEFINE_DEBUGF(f)                                         \
+  static void vdebugf(const char *fmt, va_list al) {                   \
+    if (DEBUGP(f))                                                     \
+      vfprintf(debug,fmt,al);                                          \
+  }                                                                    \
+  static void debugf(const char *fmt, ...) {                           \
+    va_list al;  va_start(al,fmt);  vdebugf(fmt,al);  va_end(al);      \
+  }
+
 #endif /*OCR_H*/