From d5cb5971757f760d9743ec55e32050fb77d48825 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Fri, 2 Jan 2015 17:20:52 +0100 Subject: [PATCH] [PATCH] lib: convert two "iterator copy strings" into references. --- fd/4533d4059060c8906e6d6bd79e7da630c67b50 | 84 +++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 fd/4533d4059060c8906e6d6bd79e7da630c67b50 diff --git a/fd/4533d4059060c8906e6d6bd79e7da630c67b50 b/fd/4533d4059060c8906e6d6bd79e7da630c67b50 new file mode 100644 index 000000000..291976f3a --- /dev/null +++ b/fd/4533d4059060c8906e6d6bd79e7da630c67b50 @@ -0,0 +1,84 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 4BC61431FAF + for ; Fri, 2 Jan 2015 08:21:08 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id DiY9hNMJjNdg for ; + Fri, 2 Jan 2015 08:21:05 -0800 (PST) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 210C8431FAE + for ; Fri, 2 Jan 2015 08:21:05 -0800 (PST) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1Y74yD-0007Rv-62; Fri, 02 Jan 2015 12:21:01 -0400 +Received: (nullmailer pid 4224 invoked by uid 1000); Fri, 02 Jan 2015 + 16:20:55 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH] lib: convert two "iterator copy strings" into references. +Date: Fri, 2 Jan 2015 17:20:52 +0100 +Message-Id: <1420215652-4131-1-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.1.3 +In-Reply-To: <1419763508-11902-1-git-send-email-david@tethera.net> +References: <1419763508-11902-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 02 Jan 2015 16:21:08 -0000 + +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 + -- 2.26.2