From 222551bf93e787d41d91590d427d91386045cc4d Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Fri, 25 May 2012 18:01:13 +2000 Subject: [PATCH] [PATCH v4 4/4] new: Unify add_files and add_files_recursive --- f9/0b04f53d3d0e9d4754409ee6603f804ad21ab9 | 127 ++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 f9/0b04f53d3d0e9d4754409ee6603f804ad21ab9 diff --git a/f9/0b04f53d3d0e9d4754409ee6603f804ad21ab9 b/f9/0b04f53d3d0e9d4754409ee6603f804ad21ab9 new file mode 100644 index 000000000..bbb8734ac --- /dev/null +++ b/f9/0b04f53d3d0e9d4754409ee6603f804ad21ab9 @@ -0,0 +1,127 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id DE3C5429E29 + for ; Thu, 24 May 2012 15:01:30 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id XbRHno5qo8Hi for ; + Thu, 24 May 2012 15:01:29 -0700 (PDT) +Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU + [18.9.25.14]) + by olra.theworths.org (Postfix) with ESMTP id 26340431E84 + for ; Thu, 24 May 2012 15:01:23 -0700 (PDT) +X-AuditID: 1209190e-b7fd86d0000008b4-a3-4fbeafb32bc3 +Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) + by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP + id 74.77.02228.3BFAEBF4; Thu, 24 May 2012 18:01:23 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q4OM1N5B021199; + Thu, 24 May 2012 18:01:23 -0400 +Received: from drake.mit.edu (26-4-163.dynamic.csail.mit.edu [18.26.4.163]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q4OM1MrS009166 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Thu, 24 May 2012 18:01:23 -0400 (EDT) +Received: from amthrax by drake.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1SXg5w-00064c-I9; Thu, 24 May 2012 18:01:20 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v4 4/4] new: Unify add_files and add_files_recursive +Date: Thu, 24 May 2012 18:01:13 -0400 +Message-Id: <1337896873-23253-5-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1337896873-23253-1-git-send-email-amdragon@mit.edu> +References: <1337887922-13163-1-git-send-email-amdragon@mit.edu> + <1337896873-23253-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFtrMIsWRmVeSWpSXmKPExsUixG6nort5/T5/g1uLtCyu35zJ7MDo8WzV + LeYAxigum5TUnMyy1CJ9uwSujAebp7AWPOGruHl7LlsD41PuLkZODgkBE4mGnqXMELaYxIV7 + 69m6GLk4hAT2MUqsPrQQytnAKHH43D5GCOc4k8Scdw/YIZxZjBKnT9xlAelnE9CQ2LZ/OSOI + LSIgLbHz7mzWLkYODmYBNYk/XSogYWEBF4mPa1+ClbMIqEps2tbBBmLzCjhIvPk5jQniDHmJ + p/f7wOKcAo4Sj8/+AhspJFAucfnGXJYJjPwLGBlWMcqm5Fbp5iZm5hSnJusWJyfm5aUW6Rrr + 5WaW6KWmlG5iBIUNpyTfDsavB5UOMQpwMCrx8LJE7/MXYk0sK67MPcQoycGkJMr7YzVQiC8p + P6UyI7E4I76oNCe1+BCjBAezkgivYCRQjjclsbIqtSgfJiXNwaIkzrtKc7e/kEB6Yklqdmpq + QWoRTFaGg0NJgvfgOqBGwaLU9NSKtMycEoQ0EwcnyHAeoOH660GGFxck5hZnpkPkTzEqSonz + PgFpFgBJZJTmwfXC4voVozjQK8K830GqeIApAa77FdBgJqDBWx7vBRlckoiQkmpgnL0+pzH5 + gZbelNaTG0rM9bs/GC63Mvp/VU1/h4jV9H0HZ767FOWl9j+T4dr8jLrAlZfeN2xaHdHisU1N + xna6pPLZDy+1Gaf1J+UwKpmZvX5WHlVpv9tp/8IprE4rLqlITuz+1J/72mN+Kg+LE6tVXMpT + xfCgTmFHwcS4H1/9Zt8rEWubmlusxFKckWioxVxUnAgAdjcpJMYCAAA= +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Thu, 24 May 2012 22:01:31 -0000 + +Since starting at the top of a directory tree and recursing within +that tree are now identical operations, there's no need for both +add_files and add_files_recursive. This eliminates add_files (which +did nothing more than call add_files_recursive after the previous +patch) and renames add_files_recursive to add_files. +--- + notmuch-new.c | 18 ++++-------------- + 1 file changed, 4 insertions(+), 14 deletions(-) + +diff --git a/notmuch-new.c b/notmuch-new.c +index 2b05605..938ae29 100644 +--- a/notmuch-new.c ++++ b/notmuch-new.c +@@ -281,9 +281,9 @@ _entry_in_ignore_list (const char *entry, add_files_state_t *state) + * if fs_mtime isn't the current wall-clock time. + */ + static notmuch_status_t +-add_files_recursive (notmuch_database_t *notmuch, +- const char *path, +- add_files_state_t *state) ++add_files (notmuch_database_t *notmuch, ++ const char *path, ++ add_files_state_t *state) + { + DIR *dir = NULL; + struct dirent *entry = NULL; +@@ -377,7 +377,7 @@ add_files_recursive (notmuch_database_t *notmuch, + } + + next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name); +- status = add_files_recursive (notmuch, next, state); ++ status = add_files (notmuch, next, state); + if (status) { + ret = status; + goto DONE; +@@ -647,16 +647,6 @@ stop_progress_printing_timer (void) + } + + +-/* This is the top-level entry point for add_files. It does a couple +- * of error checks and then calls into the recursive function. */ +-static notmuch_status_t +-add_files (notmuch_database_t *notmuch, +- const char *path, +- add_files_state_t *state) +-{ +- return add_files_recursive (notmuch, path, state); +-} +- + /* XXX: This should be merged with the add_files function since it + * shares a lot of logic with it. */ + /* Recursively count all regular files in path and all sub-directories +-- +1.7.10 + -- 2.26.2