[PATCH] lib: convert two "iterator copy strings" into references.
David Bremner
david at tethera.net
Fri Jan 2 08:20:52 PST 2015
Apparently this is a supported and even idiomatic way of keeping a
temporary object (e.g. like that returned from an operator
dereference) alive.
---
I decided it was better to do both of these "keepalive" strings the
same way, so I applied the parent patch as is.
lib/message.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/message.cc b/lib/message.cc
index bacb4d4..956a70a 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,7 +641,7 @@ _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;
+ const std::string &term = *i;
/* Terminate loop at first term without desired prefix. */
if (strncmp (term.c_str (), direntry_prefix, direntry_prefix_len))
--
2.1.3
More information about the notmuch
mailing list