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