chiark / gitweb /
factor out DEBUG_DEFINE_DEBUGF
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 6 Jun 2009 19:48:17 +0000 (20:48 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 6 Jun 2009 19:48:17 +0000 (20:48 +0100)
pctb/ocr.c
pctb/ocr.h

index 436aa8dc16078ae830b54de0e1e7468c71bcb4fd..f5826dfe84a01e14b8ba1032aba301595eef367c 100644 (file)
@@ -37,6 +37,8 @@ static FILE *resolver;
 static pid_t resolver_pid;
 static int resolver_done;
 
+DEBUG_DEFINE_DEBUGF(ocr)
+
 static void fgetsline(FILE *f, char *lbuf, size_t lbufsz) {
   char *s= fgets(lbuf,lbufsz,f);
   eassert(s);
@@ -288,14 +290,6 @@ const struct OcrCellTypeInfo ocr_celltype_text= {
   .midword=1 /* Lower only */
 };
 
-static void vdebugf(const char *fmt, va_list al) {
-  if (DEBUGP(ocr))
-    vfprintf(debug,fmt,al);
-}
-static void debugf(const char *fmt, ...) {
-  va_list al;  va_start(al,fmt);  vdebugf(fmt,al);  va_end(al);
-}
-
 OcrResultGlyph *ocr(OcrReader *rd, OcrCellType ct, int w, Pixcol cols[]) {
   int nspaces;
   unsigned ctxmap;
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*/