1 Return-Path: <too@guru-group.fi>
\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 DFEEC431FC7
\r
6 for <notmuch@notmuchmail.org>; Wed, 13 Nov 2013 09:03:14 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id kQDGE-eCXsEI for <notmuch@notmuchmail.org>;
\r
16 Wed, 13 Nov 2013 09:03:09 -0800 (PST)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 8578A431E62
\r
19 for <notmuch@notmuchmail.org>; Wed, 13 Nov 2013 09:02:59 -0800 (PST)
\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
21 id AAB2F1000E5; Wed, 13 Nov 2013 19:02:50 +0200 (EET)
\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
23 To: notmuch@notmuchmail.org
\r
24 Subject: [PATCH v2 1/5] compact: tidy formatting
\r
25 Date: Wed, 13 Nov 2013 19:02:43 +0200
\r
26 Message-Id: <1384362167-12740-2-git-send-email-tomi.ollila@iki.fi>
\r
27 X-Mailer: git-send-email 1.8.0
\r
28 In-Reply-To: <1384362167-12740-1-git-send-email-tomi.ollila@iki.fi>
\r
29 References: <1384362167-12740-1-git-send-email-tomi.ollila@iki.fi>
\r
30 Cc: tomi.ollila@iki.fi
\r
31 X-BeenThere: notmuch@notmuchmail.org
\r
32 X-Mailman-Version: 2.1.13
\r
34 List-Id: "Use and development of the notmuch mail system."
\r
35 <notmuch.notmuchmail.org>
\r
36 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
37 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
38 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
39 List-Post: <mailto:notmuch@notmuchmail.org>
\r
40 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
41 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
43 X-List-Received-Date: Wed, 13 Nov 2013 17:03:15 -0000
\r
45 Notmuch compact code whitespace changes to match devel/STYLE.
\r
47 lib/database.cc | 62 ++++++++++++++++++++++++++++---------------------------
\r
48 notmuch-compact.c | 4 ++--
\r
49 2 files changed, 34 insertions(+), 32 deletions(-)
\r
51 diff --git a/lib/database.cc b/lib/database.cc
\r
52 index a021bf1..3c008d6 100644
\r
53 --- a/lib/database.cc
\r
54 +++ b/lib/database.cc
\r
55 @@ -805,17 +805,19 @@ notmuch_database_close (notmuch_database_t *notmuch)
\r
58 #if HAVE_XAPIAN_COMPACT
\r
59 -static int unlink_cb (const char *path,
\r
60 - unused (const struct stat *sb),
\r
61 - unused (int type),
\r
62 - unused (struct FTW *ftw))
\r
64 +unlink_cb (const char *path,
\r
65 + unused (const struct stat *sb),
\r
66 + unused (int type),
\r
67 + unused (struct FTW *ftw))
\r
69 - return remove(path);
\r
70 + return remove (path);
\r
73 -static int rmtree (const char *path)
\r
75 +rmtree (const char *path)
\r
77 - return nftw(path, unlink_cb, 64, FTW_DEPTH | FTW_PHYS);
\r
78 + return nftw (path, unlink_cb, 64, FTW_DEPTH | FTW_PHYS);
\r
81 class NotmuchCompactor : public Xapian::Compactor
\r
82 @@ -825,17 +827,17 @@ class NotmuchCompactor : public Xapian::Compactor
\r
85 NotmuchCompactor(notmuch_compact_status_cb_t cb, void *closure) :
\r
86 - status_cb(cb), status_closure(closure) { }
\r
87 + status_cb (cb), status_closure (closure) { }
\r
90 set_status (const std::string &table, const std::string &status)
\r
95 if (status_cb == NULL)
\r
98 - if (status.length() == 0)
\r
99 + if (status.length () == 0)
\r
100 msg = talloc_asprintf (NULL, "compacting table %s", table.c_str());
\r
102 msg = talloc_asprintf (NULL, " %s", status.c_str());
\r
103 @@ -844,8 +846,8 @@ public:
\r
107 - status_cb(msg, status_closure);
\r
108 - talloc_free(msg);
\r
109 + status_cb (msg, status_closure);
\r
110 + talloc_free (msg);
\r
114 @@ -861,8 +863,8 @@ public:
\r
115 * compaction process to protect data integrity.
\r
118 -notmuch_database_compact (const char* path,
\r
119 - const char* backup_path,
\r
120 +notmuch_database_compact (const char *path,
\r
121 + const char *backup_path,
\r
122 notmuch_compact_status_cb_t status_cb,
\r
125 @@ -876,7 +878,7 @@ notmuch_database_compact (const char* path,
\r
127 return NOTMUCH_STATUS_OUT_OF_MEMORY;
\r
129 - ret = notmuch_database_open(path, NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much);
\r
130 + ret = notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much);
\r
134 @@ -897,25 +899,25 @@ notmuch_database_compact (const char* path,
\r
137 if (backup_path != NULL) {
\r
138 - if (stat(backup_path, &statbuf) != -1) {
\r
139 + if (stat (backup_path, &statbuf) != -1) {
\r
140 fprintf (stderr, "Backup path already exists: %s\n", backup_path);
\r
141 ret = NOTMUCH_STATUS_FILE_ERROR;
\r
144 if (errno != ENOENT) {
\r
145 fprintf (stderr, "Unknown error while stat()ing backup path: %s\n",
\r
146 - strerror(errno));
\r
147 + strerror (errno));
\r
153 - NotmuchCompactor compactor(status_cb, closure);
\r
154 + NotmuchCompactor compactor (status_cb, closure);
\r
156 - compactor.set_renumber(false);
\r
157 - compactor.add_source(xapian_path);
\r
158 - compactor.set_destdir(compact_xapian_path);
\r
159 - compactor.compact();
\r
160 + compactor.set_renumber (false);
\r
161 + compactor.add_source (xapian_path);
\r
162 + compactor.set_destdir (compact_xapian_path);
\r
163 + compactor.compact ();
\r
164 } catch (Xapian::InvalidArgumentError e) {
\r
165 fprintf (stderr, "Error while compacting: %s\n", e.get_msg().c_str());
\r
166 ret = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
\r
167 @@ -923,33 +925,33 @@ notmuch_database_compact (const char* path,
\r
171 - if (rename(xapian_path, backup_path)) {
\r
172 + if (rename (xapian_path, backup_path)) {
\r
173 fprintf (stderr, "Error moving old database out of the way\n");
\r
174 ret = NOTMUCH_STATUS_FILE_ERROR;
\r
178 - rmtree(xapian_path);
\r
179 + rmtree (xapian_path);
\r
182 - if (rename(compact_xapian_path, xapian_path)) {
\r
183 + if (rename (compact_xapian_path, xapian_path)) {
\r
184 fprintf (stderr, "Error moving compacted database\n");
\r
185 ret = NOTMUCH_STATUS_FILE_ERROR;
\r
192 notmuch_database_destroy (notmuch);
\r
194 - talloc_free(local);
\r
195 + talloc_free (local);
\r
201 -notmuch_database_compact (unused (const char* path),
\r
202 - unused (const char* backup_path),
\r
203 +notmuch_database_compact (unused (const char *path),
\r
204 + unused (const char *backup_path),
\r
205 unused (notmuch_compact_status_cb_t status_cb),
\r
206 unused (void *closure))
\r
208 @@ -1538,7 +1540,7 @@ _notmuch_database_generate_doc_id (notmuch_database_t *notmuch)
\r
209 notmuch->last_doc_id++;
\r
211 if (notmuch->last_doc_id == 0)
\r
212 - INTERNAL_ERROR ("Xapian document IDs are exhausted.\n");
\r
213 + INTERNAL_ERROR ("Xapian document IDs are exhausted.\n");
\r
215 return notmuch->last_doc_id;
\r
217 diff --git a/notmuch-compact.c b/notmuch-compact.c
\r
218 index 8022dfe..8b820c0 100644
\r
219 --- a/notmuch-compact.c
\r
220 +++ b/notmuch-compact.c
\r
223 status_update_cb (const char *msg, unused (void *closure))
\r
225 - printf("%s\n", msg);
\r
226 + printf ("%s\n", msg);
\r
230 @@ -49,7 +49,7 @@ notmuch_compact_command (notmuch_config_t *config, int argc, char *argv[])
\r
231 ret = notmuch_database_compact (path, backup_path,
\r
232 quiet ? NULL : status_update_cb, NULL);
\r
234 - fprintf (stderr, "Compaction failed: %s\n", notmuch_status_to_string(ret));
\r
235 + fprintf (stderr, "Compaction failed: %s\n", notmuch_status_to_string (ret));
\r