From: Carl Worth Date: Fri, 23 Oct 2009 21:06:24 +0000 (-0700) Subject: database: Rename internal find_messages_by_term to find_doc_ids X-Git-Tag: 0.1~757 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9fc4a365d6cf478563caa012862c58a9b3945f76;p=notmuch.git database: Rename internal find_messages_by_term to find_doc_ids This name is a more accurate description of what it does, and the more general naming will make sense as we start storing non-message documents in the database (such as directory timestamps). Also, don't pass around a Xapian::Database where it's more our style to pass a notmuch_database_t*. --- diff --git a/database.cc b/database.cc index e315f8dc..15d159ff 100644 --- a/database.cc +++ b/database.cc @@ -74,21 +74,20 @@ add_term (Xapian::Document doc, } static void -find_messages_by_term (Xapian::Database *db, - const char *prefix_name, - const char *value, - Xapian::PostingIterator *begin, - Xapian::PostingIterator *end) +find_doc_ids (notmuch_database_t *notmuch, + const char *prefix_name, + const char *value, + Xapian::PostingIterator *begin, + Xapian::PostingIterator *end) { Xapian::PostingIterator i; char *term; term = g_strdup_printf ("%s%s", _find_prefix (prefix_name), value); - *begin = db->postlist_begin (term); + *begin = notmuch->xapian_db->postlist_begin (term); - if (end) - *end = db->postlist_end (term); + *end = notmuch->xapian_db->postlist_end (term); free (term); } @@ -128,8 +127,7 @@ notmuch_database_find_message (notmuch_database_t *notmuch, { Xapian::PostingIterator i, end; - find_messages_by_term (notmuch->xapian_db, - "msgid", message_id, &i, &end); + find_doc_ids (notmuch, "msgid", message_id, &i, &end); if (i == end) return NULL; @@ -161,7 +159,7 @@ find_thread_ids (notmuch_database_t *notmuch, thread_ids = g_hash_table_new_full (g_str_hash, g_str_equal, free, NULL); - find_messages_by_term (db, "ref", message_id, &child, &children_end); + find_doc_ids (notmuch, "ref", message_id, &child, &children_end); for ( ; child != children_end; child++) { doc = find_message_by_docid (db, *child); insert_thread_id (thread_ids, doc);