mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
lib/thread: add common prefix to debug messages, join lines
This will simplify filtering these message, e.g. in the test suite.
This commit is contained in:
parent
1222cba7e4
commit
748352693c
1 changed files with 11 additions and 10 deletions
|
@ -25,7 +25,8 @@
|
||||||
#include <glib.h> /* GHashTable */
|
#include <glib.h> /* GHashTable */
|
||||||
|
|
||||||
#ifdef DEBUG_THREADING
|
#ifdef DEBUG_THREADING
|
||||||
#define THREAD_DEBUG(format, ...) fprintf (stderr, format " (%s).\n", ##__VA_ARGS__, __location__)
|
#define THREAD_DEBUG(format, ...) fprintf (stderr, "DT: " format " (%s).\n", ##__VA_ARGS__, \
|
||||||
|
__location__)
|
||||||
#else
|
#else
|
||||||
#define THREAD_DEBUG(format, ...) do {} while (0) /* ignored */
|
#define THREAD_DEBUG(format, ...) do {} while (0) /* ignored */
|
||||||
#endif
|
#endif
|
||||||
|
@ -400,7 +401,7 @@ _parent_via_in_reply_to (notmuch_thread_t *thread, notmuch_message_t *message)
|
||||||
const char *in_reply_to;
|
const char *in_reply_to;
|
||||||
|
|
||||||
in_reply_to = _notmuch_message_get_in_reply_to (message);
|
in_reply_to = _notmuch_message_get_in_reply_to (message);
|
||||||
THREAD_DEBUG ("checking message = %s in_reply_to=%s\n",
|
THREAD_DEBUG ("checking message = %s in_reply_to=%s",
|
||||||
notmuch_message_get_message_id (message), in_reply_to);
|
notmuch_message_get_message_id (message), in_reply_to);
|
||||||
|
|
||||||
if (in_reply_to && (! EMPTY_STRING (in_reply_to)) &&
|
if (in_reply_to && (! EMPTY_STRING (in_reply_to)) &&
|
||||||
|
@ -423,31 +424,31 @@ _parent_or_toplevel (notmuch_thread_t *thread, notmuch_message_t *message)
|
||||||
const notmuch_string_list_t *references =
|
const notmuch_string_list_t *references =
|
||||||
_notmuch_message_get_references (message);
|
_notmuch_message_get_references (message);
|
||||||
|
|
||||||
THREAD_DEBUG ("trying to reparent via references: %s\n",
|
THREAD_DEBUG ("trying to reparent via references: %s",
|
||||||
notmuch_message_get_message_id (message));
|
notmuch_message_get_message_id (message));
|
||||||
|
|
||||||
for (notmuch_string_node_t *ref_node = references->head;
|
for (notmuch_string_node_t *ref_node = references->head;
|
||||||
ref_node; ref_node = ref_node->next) {
|
ref_node; ref_node = ref_node->next) {
|
||||||
THREAD_DEBUG ("checking reference=%s\n", ref_node->string);
|
THREAD_DEBUG ("checking reference=%s", ref_node->string);
|
||||||
if ((g_hash_table_lookup_extended (thread->message_hash,
|
if ((g_hash_table_lookup_extended (thread->message_hash,
|
||||||
ref_node->string, NULL,
|
ref_node->string, NULL,
|
||||||
(void **) &new_parent))) {
|
(void **) &new_parent))) {
|
||||||
size_t new_depth = _notmuch_message_get_thread_depth (new_parent);
|
size_t new_depth = _notmuch_message_get_thread_depth (new_parent);
|
||||||
THREAD_DEBUG ("got depth %lu\n", new_depth);
|
THREAD_DEBUG ("got depth %lu", new_depth);
|
||||||
if (new_depth > max_depth || ! parent) {
|
if (new_depth > max_depth || ! parent) {
|
||||||
THREAD_DEBUG ("adding at depth %lu parent=%s\n", new_depth, ref_node->string);
|
THREAD_DEBUG ("adding at depth %lu parent=%s", new_depth, ref_node->string);
|
||||||
max_depth = new_depth;
|
max_depth = new_depth;
|
||||||
parent = new_parent;
|
parent = new_parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (parent) {
|
if (parent) {
|
||||||
THREAD_DEBUG ("adding reply %s to parent=%s\n",
|
THREAD_DEBUG ("adding reply %s to parent=%s",
|
||||||
notmuch_message_get_message_id (message),
|
notmuch_message_get_message_id (message),
|
||||||
notmuch_message_get_message_id (parent));
|
notmuch_message_get_message_id (parent));
|
||||||
_notmuch_message_add_reply (parent, message);
|
_notmuch_message_add_reply (parent, message);
|
||||||
} else {
|
} else {
|
||||||
THREAD_DEBUG ("adding as toplevel %s\n",
|
THREAD_DEBUG ("adding as toplevel %s",
|
||||||
notmuch_message_get_message_id (message));
|
notmuch_message_get_message_id (message));
|
||||||
_notmuch_message_list_add_message (thread->toplevel_list, message);
|
_notmuch_message_list_add_message (thread->toplevel_list, message);
|
||||||
}
|
}
|
||||||
|
@ -482,13 +483,13 @@ _resolve_thread_relationships (notmuch_thread_t *thread)
|
||||||
*/
|
*/
|
||||||
if (first_node) {
|
if (first_node) {
|
||||||
message = first_node->message;
|
message = first_node->message;
|
||||||
THREAD_DEBUG ("checking first message %s\n",
|
THREAD_DEBUG ("checking first message %s",
|
||||||
notmuch_message_get_message_id (message));
|
notmuch_message_get_message_id (message));
|
||||||
|
|
||||||
if (_notmuch_message_list_empty (maybe_toplevel_list) ||
|
if (_notmuch_message_list_empty (maybe_toplevel_list) ||
|
||||||
! _parent_via_in_reply_to (thread, message)) {
|
! _parent_via_in_reply_to (thread, message)) {
|
||||||
|
|
||||||
THREAD_DEBUG ("adding first message as toplevel = %s\n",
|
THREAD_DEBUG ("adding first message as toplevel = %s",
|
||||||
notmuch_message_get_message_id (message));
|
notmuch_message_get_message_id (message));
|
||||||
_notmuch_message_list_add_message (maybe_toplevel_list, message);
|
_notmuch_message_list_add_message (maybe_toplevel_list, message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue