]> git.notmuchmail.org Git - notmuch/commitdiff
lib/thread: add macro for debug printing of threading
authorDavid Bremner <david@tethera.net>
Mon, 3 Sep 2018 14:00:26 +0000 (11:00 -0300)
committerDavid Bremner <david@tethera.net>
Thu, 6 Sep 2018 11:07:12 +0000 (08:07 -0300)
This is analogous to DEBUG_DATABASE_SANITY, and is intended to help
debugging and to help users submit bug reports.

lib/notmuch-private.h
lib/thread.cc

index bd9d27476a4406d88ecf86f9b6543cc6800c6587..02cc0e09da163251b40547a6e2aea182877f9231 100644 (file)
@@ -56,6 +56,7 @@ NOTMUCH_BEGIN_DECLS
 
 #ifdef DEBUG
 # define DEBUG_DATABASE_SANITY 1
+# define DEBUG_THREADING 1
 # define DEBUG_QUERY 1
 #endif
 
index b599a97d445ec1cd5a5efbe647f85ae2f95efb8a..6d15c49b761b2fc81e36a1f2adfd8e6c07dff4e7 100644 (file)
 #include <gmime/gmime.h>
 #include <glib.h> /* GHashTable */
 
+#ifdef DEBUG_THREADING
+#define THREAD_DEBUG(format, ...) fprintf(stderr, format " (%s).\n", ##__VA_ARGS__, __location__)
+#else
+#define THREAD_DEBUG(format, ...) do {} while (0) /* ignored */
+#endif
+
 #define EMPTY_STRING(s) ((s)[0] == '\0')
 
 struct _notmuch_thread {