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 20C95431FC3
\r
6 for <notmuch@notmuchmail.org>; Sun, 19 Jan 2014 12:32:58 -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 1Vpaw7i-x+3o for <notmuch@notmuchmail.org>;
\r
17 Sun, 19 Jan 2014 12:32:52 -0800 (PST)
\r
18 Received: from mail-ee0-f52.google.com (mail-ee0-f52.google.com
\r
19 [74.125.83.52]) (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 E9050431FBD for <notmuch@notmuchmail.org>; Sun, 19 Jan 2014 12:32:47 -0800
\r
23 Received: by mail-ee0-f52.google.com with SMTP id e53so3028531eek.25
\r
24 for <notmuch@notmuchmail.org>; Sun, 19 Jan 2014 12:32:46 -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=N4dJMow4RocHa/7ftsQnHaKodfp8IRCU94eEfp8y7XI=;
\r
30 b=cUzVfXWkxbhTV7Uw29NhgETgwWyhav+63cZc4J8+r1pP6oV9RtzFeDNyS2KGXXgDYV
\r
31 yWuTYgu/nQGlVj7hQsN1xmGMWa59k/DrS26vv78V8inxa4D+VQXrnqqL0V5+tTd57cuC
\r
32 q1fQ33Oc9bzZ6KUJ/5aVvHdoGvKTeSUdAAucorM2ZXYwbbQLKYhPK+y9X2YGzECtXh0K
\r
33 7sNEg6QA3x9pI6++U4KfOouPDmI2QEmDmzj+AbgwV54vTY+VZ8OBYF69eJ9x1g51Ge/G
\r
34 VFSMwL3u07kvuTDUqwNGq+y85dhWCf8VlXAQtLi+3mDvjBAdr+arTJC1P1CExgLRg7y8
\r
37 ALoCoQnkMrPceWf74/6fS2A6denev87Qdb5YwnCG6H45kMvflwgQcQekRNTAVJxMf/hKLXdWYAhz
\r
38 X-Received: by 10.14.95.2 with SMTP id o2mr1143545eef.69.1390163566689;
\r
39 Sun, 19 Jan 2014 12:32:46 -0800 (PST)
\r
40 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.
\r
42 by mx.google.com with ESMTPSA id n7sm46526538eef.5.2014.01.19.12.32.45
\r
43 for <multiple recipients>
\r
44 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
45 Sun, 19 Jan 2014 12:32:46 -0800 (PST)
\r
46 From: Jani Nikula <jani@nikula.org>
\r
47 To: notmuch@notmuchmail.org
\r
48 Subject: [PATCH 4/7] cli: for loop is more customary
\r
49 Date: Sun, 19 Jan 2014 22:32:25 +0200
\r
51 <cc172ba32a28363d64018803a5dd98ec5381b2f7.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:58 -0000
\r
71 With the happy day stop condition within the while, it was
\r
72 confusing. Switch to the paradigm for loop. No functional changes.
\r
74 notmuch-new.c | 10 +++-------
\r
75 1 file changed, 3 insertions(+), 7 deletions(-)
\r
77 diff --git a/notmuch-new.c b/notmuch-new.c
\r
78 index e6ca841..f6d9c3a 100644
\r
81 @@ -704,8 +704,7 @@ count_files (const char *path, int *count, add_files_state_t *state)
\r
83 struct dirent **fs_entries = NULL;
\r
84 int num_fs_entries = scandir (path, &fs_entries, 0, dirent_sort_inode);
\r
87 + int entry_type, i;
\r
89 if (num_fs_entries == -1) {
\r
90 fprintf (stderr, "Warning: failed to open directory %s: %s\n",
\r
91 @@ -713,11 +712,8 @@ count_files (const char *path, int *count, add_files_state_t *state)
\r
95 - while (!interrupted) {
\r
96 - if (i == num_fs_entries)
\r
99 - entry = fs_entries[i++];
\r
100 + for (i = 0; i < num_fs_entries && ! interrupted; i++) {
\r
101 + entry = fs_entries[i];
\r
103 /* Ignore special directories to avoid infinite recursion.
\r
104 * Also ignore the .notmuch directory and files/directories
\r