X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=message.cc;h=ee0e8e1f80502f81aa74c7cfc3994866e852ef41;hp=281da4f55c34388c3ac54a6cea2a7f8707a75e38;hb=c9fbe6b58b8bff56b4c6774625b8c21846fe027d;hpb=1b5d8984c678add2ab5d1353b94a8229421269df diff --git a/message.cc b/message.cc index 281da4f5..ee0e8e1f 100644 --- a/message.cc +++ b/message.cc @@ -41,6 +41,13 @@ struct _notmuch_thread_ids { char *next; }; +/* "128 bits of thread-id ought to be enough for anybody" */ +#define NOTMUCH_THREAD_ID_BITS 128 +#define NOTMUCH_THREAD_ID_DIGITS (NOTMUCH_THREAD_ID_BITS / 4) +typedef struct _thread_id { + char str[NOTMUCH_THREAD_ID_DIGITS + 1]; +} thread_id_t; + #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0])) /* These prefix values are specifically chosen to be compatible @@ -208,10 +215,11 @@ notmuch_message_get_message_id (notmuch_message_t *message) i = message->doc.termlist_begin (); i.skip_to (_find_prefix ("msgid")); - /* XXX: This should really be an internal error, but we'll need to - * fix the add_message side of things first. */ - if (i == message->doc.termlist_end ()) - return NULL; + if (i == message->doc.termlist_end ()) { + fprintf (stderr, "Internal error: Message with document ID of %d has no message ID.\n", + message->doc_id); + exit (1); + } message->message_id = talloc_strdup (message, (*i).c_str () + 1); return message->message_id; @@ -514,7 +522,7 @@ notmuch_tags_has_more (notmuch_tags_t *tags) return FALSE; s = *tags->iterator; - if (s.size () && s[0] == 'L') + if (! s.empty () && s[0] == 'L') return TRUE; else return FALSE;