1 Return-Path: <jani@nikula.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 2D1C1431FDA
\r
6 for <notmuch@notmuchmail.org>; Sun, 19 Jan 2014 12:32:55 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
13 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id Ps5hzXYP0CpR for <notmuch@notmuchmail.org>;
\r
17 Sun, 19 Jan 2014 12:32:49 -0800 (PST)
\r
18 Received: from mail-ee0-f41.google.com (mail-ee0-f41.google.com
\r
19 [74.125.83.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
20 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
21 A3E5C431FC3 for <notmuch@notmuchmail.org>; Sun, 19 Jan 2014 12:32:45 -0800
\r
23 Received: by mail-ee0-f41.google.com with SMTP id e49so3129468eek.28
\r
24 for <notmuch@notmuchmail.org>; Sun, 19 Jan 2014 12:32:44 -0800 (PST)
\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=1e100.net; s=20130820;
\r
27 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
28 :references:in-reply-to:references;
\r
29 bh=cGu1awp5zoGgbQDv131j+/NvXXFicBGwWJMMOMjBvus=;
\r
30 b=BUHdDfQtTziEIEi9mDX0AwU1W6st98KO7FnJOQy6pRxOR3q/ovs6aPYWPK/SLzGSVW
\r
31 KqxSqIA0abtET/Wrx0LoTIVT5mvVj5Gn8cC12BYjfnrFLm8YMQHTGwEjVNcXeBwf9Ord
\r
32 3S7AfCzEiaGQuLpq5CpbG7o+C93oWK9TDfN4J4K9ges4C9AVyTjMJGUyRzukVQ9LG8H/
\r
33 hliSv/oW/IQl6teNip4YbP8J7Y46sx4/gcpa772BTv7SBN51fzy1/O1hyt50toU0xLrh
\r
34 mR0njbUPyGBjZNFYOldrzu7uM+T3syHSgy0+TrDgLHWkM6vMdvMNIl1TB4wNH0bLmxhb
\r
37 ALoCoQk5bCdQQJtgzq4V+e4HEyn2yGOkaH7gnLEWXihVeKpkel6WOfZYCboX19ntu1zNd8lMTBG+
\r
38 X-Received: by 10.14.99.66 with SMTP id w42mr1129032eef.63.1390163564378;
\r
39 Sun, 19 Jan 2014 12:32:44 -0800 (PST)
\r
40 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.
\r
42 by mx.google.com with ESMTPSA id n7sm46512417eef.5.2014.01.19.12.32.43
\r
43 for <multiple recipients>
\r
44 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
45 Sun, 19 Jan 2014 12:32:43 -0800 (PST)
\r
46 From: Jani Nikula <jani@nikula.org>
\r
47 To: notmuch@notmuchmail.org
\r
48 Subject: [PATCH 3/7] cli: use dirent_type in count_files too
\r
49 Date: Sun, 19 Jan 2014 22:32:24 +0200
\r
51 <024420e6f583f7e4c76ded29b5c9158608dd8f6c.1390163335.git.jani@nikula.org>
\r
52 X-Mailer: git-send-email 1.8.5.2
\r
53 In-Reply-To: <cover.1390163335.git.jani@nikula.org>
\r
54 References: <cover.1390163335.git.jani@nikula.org>
\r
55 In-Reply-To: <cover.1390163335.git.jani@nikula.org>
\r
56 References: <cover.1390163335.git.jani@nikula.org>
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Sun, 19 Jan 2014 20:32:55 -0000
\r
71 Avoid an extra stat per file, if possible, also when counting the
\r
72 files for initial indexing.
\r
74 notmuch-new.c | 9 ++++-----
\r
75 1 file changed, 4 insertions(+), 5 deletions(-)
\r
77 diff --git a/notmuch-new.c b/notmuch-new.c
\r
78 index 7f3b3b0..e6ca841 100644
\r
81 @@ -702,9 +702,9 @@ count_files (const char *path, int *count, add_files_state_t *state)
\r
83 struct dirent *entry = NULL;
\r
86 struct dirent **fs_entries = NULL;
\r
87 int num_fs_entries = scandir (path, &fs_entries, 0, dirent_sort_inode);
\r
91 if (num_fs_entries == -1) {
\r
92 @@ -742,15 +742,14 @@ count_files (const char *path, int *count, add_files_state_t *state)
\r
98 - if (S_ISREG (st.st_mode)) {
\r
99 + entry_type = dirent_type (path, entry);
\r
100 + if (entry_type == S_IFREG) {
\r
101 *count = *count + 1;
\r
102 if (*count % 1000 == 0) {
\r
103 printf ("Found %d files so far.\r", *count);
\r
106 - } else if (S_ISDIR (st.st_mode)) {
\r
107 + } else if (entry_type == S_IFDIR) {
\r
108 count_files (next, count, state);
\r