chiark / gitweb /
quieten compiler
[disorder] / disobedience / disobedience.h
index 59cc6e9b22c8678d7acc0e21f59397e9ce6d59b9..1745764f76d073ba1bcef64176c2f9c877b650fe 100644 (file)
@@ -167,6 +167,24 @@ GtkWidget *choose_widget(void);
 void choose_update(void);
 /* Called when we think the choose tree might need updating */
 
+/* Widget leakage debugging rubbish ---------------------------------------- */
+
+#if MDEBUG
+#define NW(what) do {                                   \
+  if(++current##what % 100 > max##what) {               \
+    fprintf(stderr, "%s:%d: %d %s\n",                   \
+            __FILE__, __LINE__, current##what, #what);  \
+    max##what = current##what;                          \
+  }                                                     \
+} while(0)
+#define WT(what) static int current##what, max##what
+#define DW(what) (--current##what)
+#else
+#define NW(what) do { } while(0)
+#define DW(what) do { } while(0)
+#define WT(what) struct neverused
+#endif
+
 #endif /* DISOBEDIENCE_H */
 
 /*