From: Carl Worth <cworth@cworth.org>
Date: Mon, 19 Oct 2009 20:48:13 +0000 (-0700)
Subject: Don't hash headers we won't end up using.
X-Git-Tag: 0.1~827
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=45f0d7bcab72ff6b8375804d3e518f961bd9a96f;p=notmuch-old

Don't hash headers we won't end up using.

Just saving a little work here.
---

diff --git a/database.cc b/database.cc
index 2f3959fa..efc38762 100644
--- a/database.cc
+++ b/database.cc
@@ -486,6 +486,13 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 
     message = notmuch_message_open (filename);
 
+    notmuch_message_restrict_headers (message,
+				      "references",
+				      "in-reply-to",
+				      "message-id",
+				      "date",
+				      (char *) NULL);
+
     try {
 	doc = Xapian::Document ();
 
diff --git a/message.c b/message.c
index 646403fb..97df4b27 100644
--- a/message.c
+++ b/message.c
@@ -241,7 +241,7 @@ notmuch_message_get_header (notmuch_message_t *message,
     contains = g_hash_table_lookup_extended (message->headers,
 					     header_desired, NULL,
 					     (gpointer *) &value);
-    if (contains)
+    if (contains && value)
 	return value;
 
     if (message->parsing_finished)