Re: [Patch v5 06/11] lib: config list iterators
authorDavid Bremner <david@tethera.net>
Tue, 24 May 2016 11:54:55 +0000 (08:54 +2100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:21:52 +0000 (16:21 -0700)
9d/28889e8ed89b21a27a97a22b636d75456b5b11 [new file with mode: 0644]

diff --git a/9d/28889e8ed89b21a27a97a22b636d75456b5b11 b/9d/28889e8ed89b21a27a97a22b636d75456b5b11
new file mode 100644 (file)
index 0000000..34ec495
--- /dev/null
@@ -0,0 +1,77 @@
+Return-Path: <david@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 4C0806DE01F7\r
+ for <notmuch@notmuchmail.org>; Tue, 24 May 2016 04:55:06 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.012\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.012 tagged_above=-999 required=5\r
+ tests=[AWL=-0.001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id zl1L6mOjJ4Wf for <notmuch@notmuchmail.org>;\r
+ Tue, 24 May 2016 04:54:58 -0700 (PDT)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id E5EEA6DE00C6\r
+ for <notmuch@notmuchmail.org>; Tue, 24 May 2016 04:54:57 -0700 (PDT)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <david@tethera.net>)\r
+ id 1b5AvA-0004Ix-Tt; Tue, 24 May 2016 07:54:48 -0400\r
+Received: (nullmailer pid 22619 invoked by uid 1000);\r
+ Tue, 24 May 2016 11:54:55 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: Re: [Patch v5 06/11] lib: config list iterators\r
+In-Reply-To: <1463135893-7471-7-git-send-email-david@tethera.net>\r
+References: <1463135893-7471-1-git-send-email-david@tethera.net>\r
+ <1463135893-7471-7-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.22+15~g1aa6f90 (http://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 24 May 2016 08:54:55 -0300\r
+Message-ID: <87fut7n01c.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 24 May 2016 11:55:06 -0000\r
+\r
+David Bremner <david@tethera.net> writes:\r
+\r
+\r
+> +    talloc_set_destructor (list, _notmuch_config_list_destroy);\r
+> +    list->iterator = new Xapian::TermIterator;\r
+> +    list->notmuch = notmuch;\r
+> +    list->current_key = NULL;\r
+> +    list->current_val = NULL;\r
+> +\r
+> +    try {\r
+> +\r
+> +    *list->iterator = notmuch->xapian_db->metadata_keys_begin (CONFIG_PREFIX + (prefix ? prefix : ""));\r
+> +\r
+\r
+minimally these two assignments to list->iterator should be right next\r
+to each other, with a comment explaining what the heck. But I think the\r
+following is more idiomatic\r
+\r
+-      /* force copying onto the heap */\r
+-      list->iterator = new Xapian::TermIterator;\r
+-      *list->iterator = notmuch->xapian_db->metadata_keys_begin (CONFIG_PREFIX + (prefix ? prefix : ""));\r
++      list->iterator = new Xapian::TermIterator(notmuch->xapian_db->metadata_keys_begin\r
++                                                (CONFIG_PREFIX + (prefix ? prefix : "")));\r
+\r
+so that's what I've done in git\r
+\r