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