[PATCH v3 4/4] new: Unify add_files and add_files_recursive
authorAustin Clements <amdragon@MIT.EDU>
Thu, 24 May 2012 19:32:02 +0000 (15:32 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:20 +0000 (09:47 -0800)
3e/e8a12fe98526f51863273b1cde6de5be2acd51 [new file with mode: 0644]

diff --git a/3e/e8a12fe98526f51863273b1cde6de5be2acd51 b/3e/e8a12fe98526f51863273b1cde6de5be2acd51
new file mode 100644 (file)
index 0000000..a83d13a
--- /dev/null
@@ -0,0 +1,127 @@
+Return-Path: <amdragon@mit.edu>\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 8D144431E82\r
+       for <notmuch@notmuchmail.org>; Thu, 24 May 2012 12:32:09 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 71QeKjPngqmW for <notmuch@notmuchmail.org>;\r
+       Thu, 24 May 2012 12:32:08 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
+       [18.9.25.15])\r
+       by olra.theworths.org (Postfix) with ESMTP id B4E98431FCF\r
+       for <notmuch@notmuchmail.org>; Thu, 24 May 2012 12:32:08 -0700 (PDT)\r
+X-AuditID: 1209190f-b7f4f6d00000092b-a6-4fbe8cb82a3f\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id EC.22.02347.8BC8EBF4; Thu, 24 May 2012 15:32:08 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q4OJW7N6028224; \r
+       Thu, 24 May 2012 15:32:07 -0400\r
+Received: from drake.mit.edu (26-4-163.dynamic.csail.mit.edu [18.26.4.163])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q4OJW5hI014462\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Thu, 24 May 2012 15:32:07 -0400 (EDT)\r
+Received: from amthrax by drake.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1SXdlT-0003Rf-UY; Thu, 24 May 2012 15:32:03 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 4/4] new: Unify add_files and add_files_recursive\r
+Date: Thu, 24 May 2012 15:32:02 -0400\r
+Message-Id: <1337887922-13163-5-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1337887922-13163-1-git-send-email-amdragon@mit.edu>\r
+References: <1336429240-1114-1-git-send-email-amdragon@mit.edu>\r
+       <1337887922-13163-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrEIsWRmVeSWpSXmKPExsUixG6norujZ5+/Qd8FYYvrN2cyOzB6PFt1\r
+       izmAMYrLJiU1J7MstUjfLoEr48HmKawFT/gqbt6ey9bA+JS7i5GTQ0LAROL0it1MELaYxIV7\r
+       69m6GLk4hAT2MUo0zu5lAUkICWxglJhwyh0icZxJYt78U4wQzixGiW+HNzKDVLEJaEhs27+c\r
+       EcQWEZCW2Hl3NmsXIwcHs4CaxJ8uFZCwsICLxJy7P8CGsgioSjQ0HwOzeQUcJM5cP8AIcYW8\r
+       xNP7fWwgNqeAo8SFJ5OZII4okzj+eBfTBEb+BYwMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3RN\r
+       9HIzS/RSU0o3MYKChlOSfwfjt4NKhxgFOBiVeHhZo/f5C7EmlhVX5h5ilORgUhLl5esGCvEl\r
+       5adUZiQWZ8QXleakFh9ilOBgVhLhFYwEyvGmJFZWpRblw6SkOViUxHlXa+72FxJITyxJzU5N\r
+       LUgtgsnKcHAoSfDaAKNDSLAoNT21Ii0zpwQhzcTBCTKcB2j4PpDFvMUFibnFmekQ+VOMilLi\r
+       vIIgzQIgiYzSPLheWFS/YhQHekWY1wKkigeYEOC6XwENZgIavOXxXpDBJYkIKakGRtMlygWz\r
+       +xX95jL4y1rtYtnskHr7UpO+bmrS2dhmK2n+M1/33Jsnzbz54tXC5gm2Ht8WqD0rzbD1Xbtu\r
+       d5hnaqNobqFVvEWRqdmbtwtjeqXbk1wmME0Lbnzum1evlyjj/7VeYZVijBNT0tEPPKd8Pyyp\r
+       8G0TcPQUVpupqljk+uvzrW1zo92UWIozEg21mIuKEwHJfwqFxQIAAA==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\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: Thu, 24 May 2012 19:32:09 -0000\r
+\r
+Since starting at the top of a directory tree and recursing within\r
+that tree are now identical operations, there's no need for both\r
+add_files and add_files_recursive.  This eliminates add_files (which\r
+did nothing more than call add_files_recursive after the previous\r
+patch) and renames add_files_recursive to add_files.\r
+---\r
+ notmuch-new.c |   18 ++++--------------\r
+ 1 file changed, 4 insertions(+), 14 deletions(-)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index 2b05605..938ae29 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -281,9 +281,9 @@ _entry_in_ignore_list (const char *entry, add_files_state_t *state)\r
+  *     if fs_mtime isn't the current wall-clock time.\r
+  */\r
+ static notmuch_status_t\r
+-add_files_recursive (notmuch_database_t *notmuch,\r
+-                   const char *path,\r
+-                   add_files_state_t *state)\r
++add_files (notmuch_database_t *notmuch,\r
++         const char *path,\r
++         add_files_state_t *state)\r
+ {\r
+     DIR *dir = NULL;\r
+     struct dirent *entry = NULL;\r
+@@ -377,7 +377,7 @@ add_files_recursive (notmuch_database_t *notmuch,\r
+       }\r
\r
+       next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);\r
+-      status = add_files_recursive (notmuch, next, state);\r
++      status = add_files (notmuch, next, state);\r
+       if (status) {\r
+           ret = status;\r
+           goto DONE;\r
+@@ -647,16 +647,6 @@ stop_progress_printing_timer (void)\r
+ }\r
\r
\r
+-/* This is the top-level entry point for add_files. It does a couple\r
+- * of error checks and then calls into the recursive function. */\r
+-static notmuch_status_t\r
+-add_files (notmuch_database_t *notmuch,\r
+-         const char *path,\r
+-         add_files_state_t *state)\r
+-{\r
+-    return add_files_recursive (notmuch, path, state);\r
+-}\r
+-\r
+ /* XXX: This should be merged with the add_files function since it\r
+  * shares a lot of logic with it. */\r
+ /* Recursively count all regular files in path and all sub-directories\r
+-- \r
+1.7.10\r
+\r