1 Return-Path: <sascha-ml-email-notmuch-notmuch@silbe.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 4B408431FBC
\r
6 for <notmuch@notmuchmail.org>; Sun, 24 Jun 2012 09:29:45 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id Fw9Z9xeLepac for <notmuch@notmuchmail.org>;
\r
16 Sun, 24 Jun 2012 09:29:44 -0700 (PDT)
\r
17 Received: from smtp.chost.de (setoy.chost.de [217.160.209.225])
\r
18 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 3EECF431FAE
\r
21 for <notmuch@notmuchmail.org>; Sun, 24 Jun 2012 09:29:44 -0700 (PDT)
\r
22 Received: (qmail 14481 invoked by uid 5015); 24 Jun 2012 16:29:42 -0000
\r
23 Received: (nullmailer pid 3418 invoked by uid 123);
\r
24 Sun, 24 Jun 2012 16:29:39 -0000
\r
25 Received: from twin.sascha.silbe.org (twin.sascha.silbe.org [192.168.1.2])
\r
26 by flatty.sascha.silbe.org ([192.168.1.252])
\r
27 with SMTP via TCP; 24 Jun 2012 16:29:39 -0000
\r
28 Received: (nullmailer pid 25949 invoked by uid 8193);
\r
29 Sun, 24 Jun 2012 16:29:39 -0000
\r
30 From: Sascha Silbe <sascha-pgp@silbe.org>
\r
31 To: notmuch <notmuch@notmuchmail.org>
\r
32 Subject: [PATCH 2/3] lib: add support for rewinding a filenames iterator
\r
33 Date: Sun, 24 Jun 2012 18:29:25 +0200
\r
34 Message-Id: <1340555366-25891-3-git-send-email-sascha-pgp@silbe.org>
\r
35 X-Mailer: git-send-email 1.7.10
\r
36 In-Reply-To: <1340555366-25891-1-git-send-email-sascha-pgp@silbe.org>
\r
37 References: <1340555366-25891-1-git-send-email-sascha-pgp@silbe.org>
\r
38 Mail-Followup-To: notmuch <notmuch@notmuchmail.org>
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 Reply-To: Sascha Silbe <sascha-ml-reply-to-2012-3@silbe.org>
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Sun, 24 Jun 2012 16:29:45 -0000
\r
54 This allows the same iterator to be traversed multiple times, instead of
\r
55 destroying and reconstructing it.
\r
57 Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
\r
59 lib/filenames.c | 11 +++++++++++
\r
60 lib/notmuch.h | 8 ++++++++
\r
61 2 files changed, 19 insertions(+)
\r
63 diff --git a/lib/filenames.c b/lib/filenames.c
\r
64 index 4f7c0d8..62ccb39 100644
\r
65 --- a/lib/filenames.c
\r
66 +++ b/lib/filenames.c
\r
68 #include "notmuch-private.h"
\r
70 struct _notmuch_filenames {
\r
71 + notmuch_string_node_t *first;
\r
72 notmuch_string_node_t *iterator;
\r
75 @@ -36,6 +37,7 @@ _notmuch_filenames_create (const void *ctx,
\r
76 if (unlikely (filenames == NULL))
\r
79 + filenames->first = list->head;
\r
80 filenames->iterator = list->head;
\r
81 (void) talloc_reference (filenames, list);
\r
83 @@ -70,6 +72,15 @@ notmuch_filenames_move_to_next (notmuch_filenames_t *filenames)
\r
87 +notmuch_filenames_rewind (notmuch_filenames_t *filenames)
\r
89 + if (filenames == NULL)
\r
92 + filenames->iterator = filenames->first;
\r
96 notmuch_filenames_destroy (notmuch_filenames_t *filenames)
\r
98 talloc_free (filenames);
\r
99 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
100 index 3633bed..e99e2a3 100644
\r
101 --- a/lib/notmuch.h
\r
102 +++ b/lib/notmuch.h
\r
103 @@ -1382,6 +1382,14 @@ notmuch_filenames_get (notmuch_filenames_t *filenames);
\r
105 notmuch_filenames_move_to_next (notmuch_filenames_t *filenames);
\r
107 +/* Move the 'filenames' iterator back to the first filename.
\r
109 + * It is acceptable to pass NULL for 'filenames', in which case this
\r
110 + * function will do nothing.
\r
113 +notmuch_filenames_rewind (notmuch_filenames_t *filenames);
\r
115 /* Destroy a notmuch_filenames_t object.
\r
117 * It's not strictly necessary to call this function. All memory from
\r