[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / 65 / dc5f5e42b0cb972643a37f909210866dd2590b
1 Return-Path: <bremner@tesseract.cs.unb.ca>\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 29A06429E39\r
6         for <notmuch@notmuchmail.org>; Sat, 27 Dec 2014 14:06:09 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\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 8oInZSVO7RtA for <notmuch@notmuchmail.org>;\r
16         Sat, 27 Dec 2014 14:06:03 -0800 (PST)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 54F35431FBC\r
21         for <notmuch@notmuchmail.org>; Sat, 27 Dec 2014 14:05:59 -0800 (PST)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tesseract.cs.unb.ca>)\r
24         id 1Y4zUl-0000Dk-1V; Sat, 27 Dec 2014 18:05:59 -0400\r
25 Received: (nullmailer pid 1481 invoked by uid 1000); Sat, 27 Dec 2014\r
26         22:05:48 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [PATCH v2 5/6] lib: replace almost all fprintfs in library with\r
30         _n_d_log\r
31 Date: Sat, 27 Dec 2014 23:05:36 +0100\r
32 Message-Id: <1419717937-1108-6-git-send-email-david@tethera.net>\r
33 X-Mailer: git-send-email 2.1.3\r
34 In-Reply-To: <1419717937-1108-1-git-send-email-david@tethera.net>\r
35 References: <1419717937-1108-1-git-send-email-david@tethera.net>\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Sat, 27 Dec 2014 22:06:09 -0000\r
49 \r
50 This is not supposed to change any functionality from an end user\r
51 point of view. Note that it will eliminate some output to stderr. The\r
52 remaining fprintf will need an internal API change.\r
53 ---\r
54  lib/database.cc  | 34 +++++++++++++++++-----------------\r
55  lib/directory.cc |  4 ++--\r
56  lib/index.cc     | 11 +++++++----\r
57  lib/message.cc   |  6 +++---\r
58  lib/query.cc     | 18 +++++++++---------\r
59  5 files changed, 38 insertions(+), 35 deletions(-)\r
60 \r
61 diff --git a/lib/database.cc b/lib/database.cc\r
62 index ee1c982..6906750 100644\r
63 --- a/lib/database.cc\r
64 +++ b/lib/database.cc\r
65 @@ -494,7 +494,7 @@ notmuch_database_find_message (notmuch_database_t *notmuch,\r
66  \r
67         return NOTMUCH_STATUS_SUCCESS;\r
68      } catch (const Xapian::Error &error) {\r
69 -       fprintf (stderr, "A Xapian exception occurred finding message: %s.\n",\r
70 +       _notmuch_database_log (notmuch, "A Xapian exception occurred finding message: %s.\n",\r
71                  error.get_msg().c_str());\r
72         notmuch->exception_reported = TRUE;\r
73         *message_ret = NULL;\r
74 @@ -726,7 +726,7 @@ notmuch_status_t\r
75  _notmuch_database_ensure_writable (notmuch_database_t *notmuch)\r
76  {\r
77      if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY) {\r
78 -       fprintf (stderr, "Cannot write to a read-only database.\n");\r
79 +       _notmuch_database_log (notmuch, "Cannot write to a read-only database.\n");\r
80         return NOTMUCH_STATUS_READ_ONLY_DATABASE;\r
81      }\r
82  \r
83 @@ -1011,7 +1011,7 @@ notmuch_database_close (notmuch_database_t *notmuch)\r
84         } catch (const Xapian::Error &error) {\r
85             status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;\r
86             if (! notmuch->exception_reported) {\r
87 -               fprintf (stderr, "Error: A Xapian exception occurred closing database: %s\n",\r
88 +               _notmuch_database_log (notmuch, "Error: A Xapian exception occurred closing database: %s\n",\r
89                          error.get_msg().c_str());\r
90             }\r
91         }\r
92 @@ -1138,12 +1138,12 @@ notmuch_database_compact (const char *path,\r
93      }\r
94  \r
95      if (stat (backup_path, &statbuf) != -1) {\r
96 -       fprintf (stderr, "Path already exists: %s\n", backup_path);\r
97 +       _notmuch_database_log (notmuch, "Path already exists: %s\n", backup_path);\r
98         ret = NOTMUCH_STATUS_FILE_ERROR;\r
99         goto DONE;\r
100      }\r
101      if (errno != ENOENT) {\r
102 -       fprintf (stderr, "Unknown error while stat()ing path: %s\n",\r
103 +       _notmuch_database_log (notmuch, "Unknown error while stat()ing path: %s\n",\r
104                  strerror (errno));\r
105         ret = NOTMUCH_STATUS_FILE_ERROR;\r
106         goto DONE;\r
107 @@ -1163,20 +1163,20 @@ notmuch_database_compact (const char *path,\r
108         compactor.set_destdir (compact_xapian_path);\r
109         compactor.compact ();\r
110      } catch (const Xapian::Error &error) {\r
111 -       fprintf (stderr, "Error while compacting: %s\n", error.get_msg().c_str());\r
112 +       _notmuch_database_log (notmuch, "Error while compacting: %s\n", error.get_msg().c_str());\r
113         ret = NOTMUCH_STATUS_XAPIAN_EXCEPTION;\r
114         goto DONE;\r
115      }\r
116  \r
117      if (rename (xapian_path, backup_path)) {\r
118 -       fprintf (stderr, "Error moving %s to %s: %s\n",\r
119 +       _notmuch_database_log (notmuch, "Error moving %s to %s: %s\n",\r
120                  xapian_path, backup_path, strerror (errno));\r
121         ret = NOTMUCH_STATUS_FILE_ERROR;\r
122         goto DONE;\r
123      }\r
124  \r
125      if (rename (compact_xapian_path, xapian_path)) {\r
126 -       fprintf (stderr, "Error moving %s to %s: %s\n",\r
127 +       _notmuch_database_log (notmuch, "Error moving %s to %s: %s\n",\r
128                  compact_xapian_path, xapian_path, strerror (errno));\r
129         ret = NOTMUCH_STATUS_FILE_ERROR;\r
130         goto DONE;\r
131 @@ -1184,7 +1184,7 @@ notmuch_database_compact (const char *path,\r
132  \r
133      if (! keep_backup) {\r
134         if (rmtree (backup_path)) {\r
135 -           fprintf (stderr, "Error removing old database %s: %s\n",\r
136 +           _notmuch_database_log (notmuch, "Error removing old database %s: %s\n",\r
137                      backup_path, strerror (errno));\r
138             ret = NOTMUCH_STATUS_FILE_ERROR;\r
139             goto DONE;\r
140 @@ -1213,7 +1213,7 @@ notmuch_database_compact (unused (const char *path),\r
141                           unused (notmuch_compact_status_cb_t status_cb),\r
142                           unused (void *closure))\r
143  {\r
144 -    fprintf (stderr, "notmuch was compiled against a xapian version lacking compaction support.\n");\r
145 +    _notmuch_database_log (notmuch, "notmuch was compiled against a xapian version lacking compaction support.\n");\r
146      return NOTMUCH_STATUS_UNSUPPORTED_OPERATION;\r
147  }\r
148  #endif\r
149 @@ -1491,7 +1491,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,\r
150             }\r
151  \r
152             if (private_status) {\r
153 -               fprintf (stderr,\r
154 +               _notmuch_database_log (notmuch,\r
155                          "Upgrade failed while creating ghost messages.\n");\r
156                 status = COERCE_STATUS (private_status, "Unexpected status from _notmuch_message_initialize_ghost");\r
157                 goto DONE;\r
158 @@ -1541,7 +1541,7 @@ notmuch_database_begin_atomic (notmuch_database_t *notmuch)\r
159      try {\r
160         (static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db))->begin_transaction (false);\r
161      } catch (const Xapian::Error &error) {\r
162 -       fprintf (stderr, "A Xapian exception occurred beginning transaction: %s.\n",\r
163 +       _notmuch_database_log (notmuch, "A Xapian exception occurred beginning transaction: %s.\n",\r
164                  error.get_msg().c_str());\r
165         notmuch->exception_reported = TRUE;\r
166         return NOTMUCH_STATUS_XAPIAN_EXCEPTION;\r
167 @@ -1575,7 +1575,7 @@ notmuch_database_end_atomic (notmuch_database_t *notmuch)\r
168         if (thresh && atoi (thresh) == 1)\r
169             db->flush ();\r
170      } catch (const Xapian::Error &error) {\r
171 -       fprintf (stderr, "A Xapian exception occurred committing transaction: %s.\n",\r
172 +       _notmuch_database_log (notmuch, "A Xapian exception occurred committing transaction: %s.\n",\r
173                  error.get_msg().c_str());\r
174         notmuch->exception_reported = TRUE;\r
175         return NOTMUCH_STATUS_XAPIAN_EXCEPTION;\r
176 @@ -1821,7 +1821,7 @@ notmuch_database_get_directory (notmuch_database_t *notmuch,\r
177         *directory = _notmuch_directory_create (notmuch, path,\r
178                                                 NOTMUCH_FIND_LOOKUP, &status);\r
179      } catch (const Xapian::Error &error) {\r
180 -       fprintf (stderr, "A Xapian exception occurred getting directory: %s.\n",\r
181 +       _notmuch_database_log (notmuch, "A Xapian exception occurred getting directory: %s.\n",\r
182                  error.get_msg().c_str());\r
183         notmuch->exception_reported = TRUE;\r
184         status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;\r
185 @@ -2403,7 +2403,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,\r
186  \r
187         _notmuch_message_sync (message);\r
188      } catch (const Xapian::Error &error) {\r
189 -       fprintf (stderr, "A Xapian exception occurred adding message: %s.\n",\r
190 +       _notmuch_database_log (notmuch, "A Xapian exception occurred adding message: %s.\n",\r
191                  error.get_msg().c_str());\r
192         notmuch->exception_reported = TRUE;\r
193         ret = NOTMUCH_STATUS_XAPIAN_EXCEPTION;\r
194 @@ -2495,7 +2495,7 @@ notmuch_database_find_message_by_filename (notmuch_database_t *notmuch,\r
195                 status = NOTMUCH_STATUS_OUT_OF_MEMORY;\r
196         }\r
197      } catch (const Xapian::Error &error) {\r
198 -       fprintf (stderr, "Error: A Xapian exception occurred finding message by filename: %s\n",\r
199 +       _notmuch_database_log (notmuch, "Error: A Xapian exception occurred finding message by filename: %s\n",\r
200                  error.get_msg().c_str());\r
201         notmuch->exception_reported = TRUE;\r
202         status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;\r
203 @@ -2548,7 +2548,7 @@ notmuch_database_get_all_tags (notmuch_database_t *db)\r
204         _notmuch_string_list_sort (tags);\r
205         return _notmuch_tags_create (db, tags);\r
206      } catch (const Xapian::Error &error) {\r
207 -       fprintf (stderr, "A Xapian exception occurred getting tags: %s.\n",\r
208 +       _notmuch_database_log (db, "A Xapian exception occurred getting tags: %s.\n",\r
209                  error.get_msg().c_str());\r
210         db->exception_reported = TRUE;\r
211         return NULL;\r
212 diff --git a/lib/directory.cc b/lib/directory.cc\r
213 index 8daaec8..b836ea2 100644\r
214 --- a/lib/directory.cc\r
215 +++ b/lib/directory.cc\r
216 @@ -186,7 +186,7 @@ _notmuch_directory_create (notmuch_database_t *notmuch,\r
217         directory->mtime = Xapian::sortable_unserialise (\r
218             directory->doc.get_value (NOTMUCH_VALUE_TIMESTAMP));\r
219      } catch (const Xapian::Error &error) {\r
220 -       fprintf (stderr,\r
221 +       _notmuch_database_log (notmuch,\r
222                  "A Xapian exception occurred creating a directory: %s.\n",\r
223                  error.get_msg().c_str());\r
224         notmuch->exception_reported = TRUE;\r
225 @@ -228,7 +228,7 @@ notmuch_directory_set_mtime (notmuch_directory_t *directory,\r
226  \r
227         db->replace_document (directory->document_id, directory->doc);\r
228      } catch (const Xapian::Error &error) {\r
229 -       fprintf (stderr,\r
230 +       _notmuch_database_log (notmuch,\r
231                  "A Xapian exception occurred setting directory mtime: %s.\n",\r
232                  error.get_msg().c_str());\r
233         notmuch->exception_reported = TRUE;\r
234 diff --git a/lib/index.cc b/lib/index.cc\r
235 index 1a2e63d..9493549 100644\r
236 --- a/lib/index.cc\r
237 +++ b/lib/index.cc\r
238 @@ -314,7 +314,8 @@ _index_mime_part (notmuch_message_t *message,\r
239      const char *charset;\r
240  \r
241      if (! part) {\r
242 -       fprintf (stderr, "Warning: Not indexing empty mime part.\n");\r
243 +       _notmuch_database_log (_notmuch_message_database (message),\r
244 +                             "Warning: Not indexing empty mime part.\n");\r
245         return;\r
246      }\r
247  \r
248 @@ -334,7 +335,8 @@ _index_mime_part (notmuch_message_t *message,\r
249                 if (i == 1)\r
250                     continue;\r
251                 if (i > 1)\r
252 -                   fprintf (stderr, "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n");\r
253 +                   _notmuch_database_log (_notmuch_message_database (message),\r
254 +                                         "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n");\r
255             }\r
256             if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) {\r
257                 /* Don't index encrypted parts. */\r
258 @@ -357,8 +359,9 @@ _index_mime_part (notmuch_message_t *message,\r
259      }\r
260  \r
261      if (! (GMIME_IS_PART (part))) {\r
262 -       fprintf (stderr, "Warning: Not indexing unknown mime part: %s.\n",\r
263 -                g_type_name (G_OBJECT_TYPE (part)));\r
264 +       _notmuch_database_log (_notmuch_message_database (message),\r
265 +                             "Warning: Not indexing unknown mime part: %s.\n",\r
266 +                             g_type_name (G_OBJECT_TYPE (part)));\r
267         return;\r
268      }\r
269  \r
270 diff --git a/lib/message.cc b/lib/message.cc\r
271 index 43cc078..541eabc 100644\r
272 --- a/lib/message.cc\r
273 +++ b/lib/message.cc\r
274 @@ -252,7 +252,7 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch,\r
275  \r
276         doc_id = _notmuch_database_generate_doc_id (notmuch);\r
277      } catch (const Xapian::Error &error) {\r
278 -       fprintf (stderr, "A Xapian exception occurred creating message: %s\n",\r
279 +       _notmuch_database_log(_notmuch_message_database (message), "A Xapian exception occurred creating message: %s\n",\r
280                  error.get_msg().c_str());\r
281         notmuch->exception_reported = TRUE;\r
282         *status_ret = NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION;\r
283 @@ -467,7 +467,7 @@ notmuch_message_get_header (notmuch_message_t *message, const char *header)\r
284                 return talloc_strdup (message, value.c_str ());\r
285  \r
286         } catch (Xapian::Error &error) {\r
287 -           fprintf (stderr, "A Xapian exception occurred when reading header: %s\n",\r
288 +           _notmuch_database_log(_notmuch_message_database (message), "A Xapian exception occurred when reading header: %s\n",\r
289                      error.get_msg().c_str());\r
290             message->notmuch->exception_reported = TRUE;\r
291             return NULL;\r
292 @@ -920,7 +920,7 @@ notmuch_message_get_date (notmuch_message_t *message)\r
293      try {\r
294         value = message->doc.get_value (NOTMUCH_VALUE_TIMESTAMP);\r
295      } catch (Xapian::Error &error) {\r
296 -       fprintf (stderr, "A Xapian exception occurred when reading date: %s\n",\r
297 +       _notmuch_database_log(_notmuch_message_database (message), "A Xapian exception occurred when reading date: %s\n",\r
298                  error.get_msg().c_str());\r
299         message->notmuch->exception_reported = TRUE;\r
300         return 0;\r
301 diff --git a/lib/query.cc b/lib/query.cc\r
302 index 60ff8bd..2e20ab2 100644\r
303 --- a/lib/query.cc\r
304 +++ b/lib/query.cc\r
305 @@ -78,7 +78,7 @@ notmuch_query_create (notmuch_database_t *notmuch,\r
306      notmuch_query_t *query;\r
307  \r
308      if (_debug_query ())\r
309 -       fprintf (stderr, "Query string is:\n%s\n", query_string);\r
310 +       _notmuch_database_log (notmuch, "Query string is:\n%s\n", query_string);\r
311  \r
312      query = talloc (notmuch, notmuch_query_t);\r
313      if (unlikely (query == NULL))\r
314 @@ -266,9 +266,9 @@ notmuch_query_search_messages (notmuch_query_t *query)\r
315         }\r
316  \r
317         if (_debug_query ()) {\r
318 -           fprintf (stderr, "Exclude query is:\n%s\n",\r
319 +           _notmuch_database_log (notmuch, "Exclude query is:\n%s\n",\r
320                      exclude_query.get_description ().c_str ());\r
321 -           fprintf (stderr, "Final query is:\n%s\n",\r
322 +           _notmuch_database_log (notmuch, "Final query is:\n%s\n",\r
323                      final_query.get_description ().c_str ());\r
324         }\r
325  \r
326 @@ -282,9 +282,9 @@ notmuch_query_search_messages (notmuch_query_t *query)\r
327         return &messages->base;\r
328  \r
329      } catch (const Xapian::Error &error) {\r
330 -       fprintf (stderr, "A Xapian exception occurred performing query: %s\n",\r
331 +       _notmuch_database_log (notmuch, "A Xapian exception occurred performing query: %s\n",\r
332                  error.get_msg().c_str());\r
333 -       fprintf (stderr, "Query string was: %s\n", query->query_string);\r
334 +       _notmuch_database_log (notmuch, "Query string was: %s\n", query->query_string);\r
335         notmuch->exception_reported = TRUE;\r
336         talloc_free (messages);\r
337         return NULL;\r
338 @@ -549,9 +549,9 @@ notmuch_query_count_messages (notmuch_query_t *query)\r
339         enquire.set_docid_order(Xapian::Enquire::ASCENDING);\r
340  \r
341         if (_debug_query ()) {\r
342 -           fprintf (stderr, "Exclude query is:\n%s\n",\r
343 +           _notmuch_database_log (notmuch, "Exclude query is:\n%s\n",\r
344                      exclude_query.get_description ().c_str ());\r
345 -           fprintf (stderr, "Final query is:\n%s\n",\r
346 +           _notmuch_database_log (notmuch, "Final query is:\n%s\n",\r
347                      final_query.get_description ().c_str ());\r
348         }\r
349  \r
350 @@ -562,9 +562,9 @@ notmuch_query_count_messages (notmuch_query_t *query)\r
351         count = mset.get_matches_estimated();\r
352  \r
353      } catch (const Xapian::Error &error) {\r
354 -       fprintf (stderr, "A Xapian exception occurred: %s\n",\r
355 +       _notmuch_database_log (notmuch, "A Xapian exception occurred: %s\n",\r
356                  error.get_msg().c_str());\r
357 -       fprintf (stderr, "Query string was: %s\n", query->query_string);\r
358 +       _notmuch_database_log (notmuch, "Query string was: %s\n", query->query_string);\r
359      }\r
360  \r
361      return count;\r
362 -- \r
363 2.1.3\r
364 \r