need to call notmuch_threads_get (..) to actually move iterator
authorGaute Hope <eg@gaute.vetsj.com>
Wed, 24 Feb 2016 12:08:36 +0000 (12:08 +0000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:21:11 +0000 (16:21 -0700)
f4/cf1be39922d3b6bf2189f99665f314dda62c60 [new file with mode: 0644]

diff --git a/f4/cf1be39922d3b6bf2189f99665f314dda62c60 b/f4/cf1be39922d3b6bf2189f99665f314dda62c60
new file mode 100644 (file)
index 0000000..757bcfb
--- /dev/null
@@ -0,0 +1,138 @@
+Return-Path: <eg@gaute.vetsj.com>\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 C966F6DE0B29\r
+ for <notmuch@notmuchmail.org>; Wed, 24 Feb 2016 04:08:44 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.394\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.394 tagged_above=-999 required=5 tests=[AWL=0.326,\r
+  DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] 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 Q2Q8RjK4RmHb for <notmuch@notmuchmail.org>;\r
+ Wed, 24 Feb 2016 04:08:42 -0800 (PST)\r
+Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com\r
+ [209.85.215.41])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 602F46DE0AC2\r
+ for <notmuch@notmuchmail.org>; Wed, 24 Feb 2016 04:08:42 -0800 (PST)\r
+Received: by mail-lf0-f41.google.com with SMTP id 78so10297940lfy.3\r
+ for <notmuch@notmuchmail.org>; Wed, 24 Feb 2016 04:08:42 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=gaute-vetsj-com.20150623.gappssmtp.com; s=20150623;\r
+ h=date:from:subject:to:references:in-reply-to:user-agent:message-id\r
+ :mime-version:content-type:content-transfer-encoding;\r
+ bh=Es2wOQOpzlcfMm4LtNnGKLLR6jR45tOuPb6dKiyQr3I=;\r
+ b=y4ikgu9e3A5x5JuRrWiAVmmuZLCvnSWJ0sA0hemDbkeVgBj7eLNuse8SVny8JK0epR\r
+ Hui6nnJAfDSLE3XpZu0sN9+zbdDSg+OqI0FW9ncX7H7zriQwrKFSbr2n2Nwydncs46r+\r
+ Qs8ZCi08LDtAZZMSUjcC6Gg/JGgyz/ufz3+WF9ctfhf6/5vMwWaH0bLtWpGUuQ0GvteG\r
+ iqlMQCen4sCddZrElJ6z4SbnBqd87AFeYjR7f0WRrirh9Lw7JCgw2WF7EYo0EMHboHGD\r
+ ID0vhVckQCxqlUmFNQ3jm9omlsHzw2U47Rgo/lQGYJyfpnGf6iy6Im2cf72A7hwFJUZy\r
+ P2BQ==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:date:from:subject:to:references:in-reply-to\r
+ :user-agent:message-id:mime-version:content-type\r
+ :content-transfer-encoding;\r
+ bh=Es2wOQOpzlcfMm4LtNnGKLLR6jR45tOuPb6dKiyQr3I=;\r
+ b=OXv2A2dxnQFfmJbhkScAmBbxZkXsmB4IG1r4S0vhcBb7Cb75gmwTJ/Z12WwrB665cp\r
+ sD/Vo/FWAiLIFJhQuGr9JCKOjF33/TZI5o2KDbP8YwFrAY3IS/cPtLYCoSSs9l7e2Blw\r
+ Jt5aSRp1wU0hl5v5oReTS81QsXXqYh1Rvmj/pFArlX+G4tO78qpU8+nsCCTTaV55TmFj\r
+ 5qsOBHrtrH93sqBf6+zTBYTr2VJIAaWhdphLn17yAMuGClSzURE6uilmjME2LMLWlvas\r
+ TAm+Q8ZEb6L0O747fu9fE94VZW3PSd5uEtTxrWaN3XQClJwsOATX7utlYoTRO+RKYsJc\r
+ hM1Q==\r
+X-Gm-Message-State:\r
+ AG10YOQJ6Mzkkv+B+HSwsBwRJ44Mw6zE8pZbfKFKXxUH/TjNLu14GtfZ7PPYccl8j4QoMQ==\r
+X-Received: by 10.25.42.13 with SMTP id q13mr14398710lfq.96.1456315718910;\r
+ Wed, 24 Feb 2016 04:08:38 -0800 (PST)\r
+Received: from localhost (c6878BF51.dhcp.as2116.net. [81.191.120.104])\r
+ by smtp.gmail.com with ESMTPSA id pm9sm329869lbb.25.2016.02.24.04.08.37\r
+ for <notmuch@notmuchmail.org>\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Wed, 24 Feb 2016 04:08:37 -0800 (PST)\r
+Date: Wed, 24 Feb 2016 12:08:36 +0000\r
+From: Gaute Hope <eg@gaute.vetsj.com>\r
+Subject: need to call notmuch_threads_get (..) to actually move iterator\r
+To: notmuch@notmuchmail.org\r
+References: \r
+In-Reply-To: \r
+User-Agent: astroid/v0.5-40-g7eeed380 (https://github.com/gauteh/astroid)\r
+Message-Id: <1456315381-astroid-1-8aih8mdal8-11676@strange>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8; format=flowed\r
+Content-Transfer-Encoding: quoted-printable\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: Wed, 24 Feb 2016 12:08:45 -0000\r
+\r
+Hi,\r
+\r
+it seems to be necessary to actually call notmuch_threads_get (threads)\r
+to move the thread iterator from a query object, just calling\r
+notmuch_threads_move_to_next (..) is not enough:\r
+\r
+```\r
+\r
+notmuch_query_t *query;\r
+notmuch_threads_t *threads;\r
+notmuch_thread_t *thread;\r
+\r
+query =3D notmuch_query_create (database, query_string);\r
+threads =3D notmuch_query_search_threads (query);\r
+\r
+int i =3D 0;\r
+\r
+for (;\r
+     notmuch_threads_valid (threads);\r
+     notmuch_threads_move_to_next (threads))\r
+{\r
+    /*\r
+     * with this line commented out the iterator seems to remain in\r
+     * place, and if I below do another loop it will start from the\r
+     * beginning.\r
+\r
+    thread =3D notmuch_threads_get (threads);\r
+    ....\r
+    notmuch_thread_destroy (thread);\r
+    */\r
+\r
+    i++;\r
+    if (i > 100) break;\r
+}\r
+\r
+for (;\r
+     notmuch_threads_valid (threads);\r
+     notmuch_threads_move_to_next (threads))\r
+{\r
+    /* the thread acquired here will be the first thread in the query.\r
+     * it should be the 101th. */\r
+\r
+    thread =3D notmuch_threads_get (threads);\r
+    ....\r
+    notmuch_thread_destroy (thread);\r
+\r
+}\r
+\r
+\r
+notmuch_query_destroy (query);\r
+```\r
+\r
+It is quite slow to skip the threads in this way, might it be faster if\r
+move_to_next works correctly?\r
+\r
+Regards, Gaute\r
+\r
+=\r