--- /dev/null
+Return-Path: <sascha-ml-email-notmuch-notmuch@silbe.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 4B408431FBC\r
+ for <notmuch@notmuchmail.org>; Sun, 24 Jun 2012 09:29:45 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id Fw9Z9xeLepac for <notmuch@notmuchmail.org>;\r
+ Sun, 24 Jun 2012 09:29:44 -0700 (PDT)\r
+Received: from smtp.chost.de (setoy.chost.de [217.160.209.225])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 3EECF431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 24 Jun 2012 09:29:44 -0700 (PDT)\r
+Received: (qmail 14481 invoked by uid 5015); 24 Jun 2012 16:29:42 -0000\r
+Received: (nullmailer pid 3418 invoked by uid 123);\r
+ Sun, 24 Jun 2012 16:29:39 -0000\r
+Received: from twin.sascha.silbe.org (twin.sascha.silbe.org [192.168.1.2])\r
+ by flatty.sascha.silbe.org ([192.168.1.252])\r
+ with SMTP via TCP; 24 Jun 2012 16:29:39 -0000\r
+Received: (nullmailer pid 25949 invoked by uid 8193);\r
+ Sun, 24 Jun 2012 16:29:39 -0000\r
+From: Sascha Silbe <sascha-pgp@silbe.org>\r
+To: notmuch <notmuch@notmuchmail.org>\r
+Subject: [PATCH 2/3] lib: add support for rewinding a filenames iterator\r
+Date: Sun, 24 Jun 2012 18:29:25 +0200\r
+Message-Id: <1340555366-25891-3-git-send-email-sascha-pgp@silbe.org>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1340555366-25891-1-git-send-email-sascha-pgp@silbe.org>\r
+References: <1340555366-25891-1-git-send-email-sascha-pgp@silbe.org>\r
+Mail-Followup-To: notmuch <notmuch@notmuchmail.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+Reply-To: Sascha Silbe <sascha-ml-reply-to-2012-3@silbe.org>\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 24 Jun 2012 16:29:45 -0000\r
+\r
+This allows the same iterator to be traversed multiple times, instead of\r
+destroying and reconstructing it.\r
+\r
+Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>\r
+---\r
+ lib/filenames.c | 11 +++++++++++\r
+ lib/notmuch.h | 8 ++++++++\r
+ 2 files changed, 19 insertions(+)\r
+\r
+diff --git a/lib/filenames.c b/lib/filenames.c\r
+index 4f7c0d8..62ccb39 100644\r
+--- a/lib/filenames.c\r
++++ b/lib/filenames.c\r
+@@ -21,6 +21,7 @@\r
+ #include "notmuch-private.h"\r
+ \r
+ struct _notmuch_filenames {\r
++ notmuch_string_node_t *first;\r
+ notmuch_string_node_t *iterator;\r
+ };\r
+ \r
+@@ -36,6 +37,7 @@ _notmuch_filenames_create (const void *ctx,\r
+ if (unlikely (filenames == NULL))\r
+ return NULL;\r
+ \r
++ filenames->first = list->head;\r
+ filenames->iterator = list->head;\r
+ (void) talloc_reference (filenames, list);\r
+ \r
+@@ -70,6 +72,15 @@ notmuch_filenames_move_to_next (notmuch_filenames_t *filenames)\r
+ }\r
+ \r
+ void\r
++notmuch_filenames_rewind (notmuch_filenames_t *filenames)\r
++{\r
++ if (filenames == NULL)\r
++ return;\r
++\r
++ filenames->iterator = filenames->first;\r
++}\r
++\r
++void\r
+ notmuch_filenames_destroy (notmuch_filenames_t *filenames)\r
+ {\r
+ talloc_free (filenames);\r
+diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+index 3633bed..e99e2a3 100644\r
+--- a/lib/notmuch.h\r
++++ b/lib/notmuch.h\r
+@@ -1382,6 +1382,14 @@ notmuch_filenames_get (notmuch_filenames_t *filenames);\r
+ void\r
+ notmuch_filenames_move_to_next (notmuch_filenames_t *filenames);\r
+ \r
++/* Move the 'filenames' iterator back to the first filename.\r
++ *\r
++ * It is acceptable to pass NULL for 'filenames', in which case this\r
++ * function will do nothing.\r
++ */\r
++void\r
++notmuch_filenames_rewind (notmuch_filenames_t *filenames);\r
++\r
+ /* Destroy a notmuch_filenames_t object.\r
+ *\r
+ * It's not strictly necessary to call this function. All memory from\r
+-- \r
+1.7.10\r
+\r