X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fmessage.cc;h=b84e5e1c8895deae3d7c88d62e3235341120053b;hb=9b73a8bcc9cb381fc1a15013f4baa3ec9fdb97a7;hp=a7a13cc26aa181ec94f336048385403b903d4d37;hpb=bc9c50602d20ce712188ea2cc3c5d30647d4d3f5;p=notmuch diff --git a/lib/message.cc b/lib/message.cc index a7a13cc2..b84e5e1c 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -283,7 +283,7 @@ _notmuch_message_get_term (notmuch_message_t *message, if (i == end) return NULL; - std::string term = *i; + const std::string &term = *i; if (strncmp (term.c_str(), prefix, prefix_len)) return NULL; @@ -641,15 +641,16 @@ _notmuch_message_add_directory_terms (void *ctx, notmuch_message_t *message) unsigned int directory_id; const char *direntry, *directory; char *colon; + const std::string &term = *i; /* Terminate loop at first term without desired prefix. */ - if (strncmp ((*i).c_str (), direntry_prefix, direntry_prefix_len)) + if (strncmp (term.c_str (), direntry_prefix, direntry_prefix_len)) break; /* Indicate that there are filenames remaining. */ status = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID; - direntry = (*i).c_str (); + direntry = term.c_str (); direntry += direntry_prefix_len; directory_id = strtol (direntry, &colon, 10); @@ -1625,3 +1626,9 @@ notmuch_message_destroy (notmuch_message_t *message) { talloc_free (message); } + +notmuch_database_t * +_notmuch_message_database (notmuch_message_t *message) +{ + return message->notmuch; +}