Re: [PATCH 2/2] lib: convert notmuch_bool_t to stdbool internally

2017-10-09 Thread David Bremner
Jani Nikula  writes:

> C99 stdbool turned 18 this year. There really is no reason to use our
> own, except in the library interface for backward
> compatibility. Convert the lib internally to stdbool.

series pushed,

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] lib: convert notmuch_bool_t to stdbool internally

2017-10-07 Thread Jani Nikula
C99 stdbool turned 18 this year. There really is no reason to use our
own, except in the library interface for backward
compatibility. Convert the lib internally to stdbool.
---
 lib/add-message.cc  | 12 +-
 lib/built-with.c|  2 +-
 lib/config.cc   | 10 
 lib/database-private.h  |  6 ++---
 lib/database.cc | 30 
 lib/directory.cc|  8 +++
 lib/filenames.c |  2 +-
 lib/index.cc|  6 ++---
 lib/message-file.c  | 10 
 lib/message-private.h   |  2 +-
 lib/message-property.cc |  6 ++---
 lib/message.cc  | 62 -
 lib/messages.c  |  4 ++--
 lib/notmuch-private.h   | 13 ++-
 lib/query.cc| 42 -
 lib/string-map.c| 26 ++---
 lib/thread.cc   | 14 +--
 17 files changed, 128 insertions(+), 127 deletions(-)

diff --git a/lib/add-message.cc b/lib/add-message.cc
index 73bde7faf049..bce10a0f614c 100644
--- a/lib/add-message.cc
+++ b/lib/add-message.cc
@@ -404,7 +404,7 @@ static notmuch_status_t
 _notmuch_database_link_message (notmuch_database_t *notmuch,
notmuch_message_t *message,
notmuch_message_file_t *message_file,
-   notmuch_bool_t is_ghost)
+   bool is_ghost)
 {
 void *local = talloc_new (NULL);
 notmuch_status_t status;
@@ -467,7 +467,7 @@ notmuch_database_index_file (notmuch_database_t *notmuch,
 notmuch_message_t *message = NULL;
 notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS, ret2;
 notmuch_private_status_t private_status;
-notmuch_bool_t is_ghost = FALSE, is_new = FALSE;
+bool is_ghost = false, is_new = false;
 
 const char *date;
 const char *from, *to, *subject;
@@ -510,12 +510,12 @@ notmuch_database_index_file (notmuch_database_t *notmuch,
/* We cannot call notmuch_message_get_flag for a new message */
switch (private_status) {
case NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND:
-   is_ghost = FALSE;
-   is_new = TRUE;
+   is_ghost = false;
+   is_new = true;
break;
case NOTMUCH_PRIVATE_STATUS_SUCCESS:
is_ghost = notmuch_message_get_flag (message, 
NOTMUCH_MESSAGE_FLAG_GHOST);
-   is_new = FALSE;
+   is_new = false;
break;
default:
ret = COERCE_STATUS (private_status,
@@ -551,7 +551,7 @@ notmuch_database_index_file (notmuch_database_t *notmuch,
 } catch (const Xapian::Error ) {
_notmuch_database_log (notmuch, "A Xapian exception occurred adding 
message: %s.\n",
 error.get_msg().c_str());
-   notmuch->exception_reported = TRUE;
+   notmuch->exception_reported = true;
ret = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
goto DONE;
 }
diff --git a/lib/built-with.c b/lib/built-with.c
index 2f1f0b5c1bf3..27384bd044bc 100644
--- a/lib/built-with.c
+++ b/lib/built-with.c
@@ -31,6 +31,6 @@ notmuch_built_with (const char *name)
 } else if (STRNCMP_LITERAL (name, "retry_lock") == 0) {
return HAVE_XAPIAN_DB_RETRY_LOCK;
 } else {
-   return FALSE;
+   return false;
 }
 }
diff --git a/lib/config.cc b/lib/config.cc
index 0703b9bb8fde..da71c16e5adc 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -56,7 +56,7 @@ notmuch_database_set_config (notmuch_database_t *notmuch,
db->set_metadata (CONFIG_PREFIX + key, value);
 } catch (const Xapian::Error ) {
status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
-   notmuch->exception_reported = TRUE;
+   notmuch->exception_reported = true;
_notmuch_database_log (notmuch, "Error: A Xapian exception occurred 
setting metadata: %s\n",
   error.get_msg().c_str());
 }
@@ -74,7 +74,7 @@ _metadata_value (notmuch_database_t *notmuch,
value = notmuch->xapian_db->get_metadata (CONFIG_PREFIX + key);
 } catch (const Xapian::Error ) {
status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
-   notmuch->exception_reported = TRUE;
+   notmuch->exception_reported = true;
_notmuch_database_log (notmuch, "Error: A Xapian exception occurred 
getting metadata: %s\n",
   error.get_msg().c_str());
 }
@@ -128,7 +128,7 @@ notmuch_database_get_config_list (notmuch_database_t 
*notmuch,
 } catch (const Xapian::Error ) {
_notmuch_database_log (notmuch, "A Xapian exception occurred getting 
metadata iterator: %s.\n",
   error.get_msg().c_str());
-   notmuch->exception_reported = TRUE;
+   notmuch->exception_reported = true;
status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
 }
 
@@ -145,9 +145,9 @@ notmuch_bool_t
 notmuch_config_list_valid (notmuch_config_list_t *metadata)
 {
 if (metadata->iterator ==