unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] cli: convert notmuch_bool_t to stdbool
@ 2017-10-07  8:44 Jani Nikula
  2017-10-07  8:44 ` [PATCH 2/2] lib: convert notmuch_bool_t to stdbool internally Jani Nikula
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jani Nikula @ 2017-10-07  8:44 UTC (permalink / raw)
  To: notmuch

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 cli and test binaries to stdbool.
---
 command-line-arguments.c | 58 +++++++++++++++++++--------------------
 command-line-arguments.h | 10 ++++---
 crypto.c                 |  6 ++---
 debugger.c               |  8 +++---
 gmime-filter-reply.c     | 32 +++++++++++-----------
 mime-node.c              | 10 +++----
 notmuch-client.h         | 35 ++++++++++++------------
 notmuch-compact.c        |  2 +-
 notmuch-config.c         | 28 +++++++++----------
 notmuch-count.c          | 18 ++++++-------
 notmuch-dump.c           | 10 +++----
 notmuch-insert.c         | 70 ++++++++++++++++++++++++------------------------
 notmuch-new.c            | 30 ++++++++++-----------
 notmuch-reply.c          | 30 ++++++++++-----------
 notmuch-restore.c        |  4 +--
 notmuch-search.c         | 24 ++++++++---------
 notmuch-setup.c          |  6 ++---
 notmuch-show.c           | 52 +++++++++++++++++------------------
 notmuch-tag.c            |  6 ++---
 notmuch.c                | 12 ++++-----
 sprinter-json.c          | 18 ++++++-------
 sprinter-sexp.c          | 16 +++++------
 sprinter-text.c          |  6 ++---
 sprinter.h               |  6 ++---
 tag-util.c               | 24 ++++++++---------
 tag-util.h               |  8 +++---
 test/arg-test.c          |  6 ++---
 test/hex-xcode.c         |  8 +++---
 test/random-corpus.c     |  2 +-
 29 files changed, 275 insertions(+), 270 deletions(-)

diff --git a/command-line-arguments.c b/command-line-arguments.c
index 3fa8d9044966..1ff5aae578c6 100644
--- a/command-line-arguments.c
+++ b/command-line-arguments.c
@@ -6,11 +6,11 @@
 
 /*
   Search the array of keywords for a given argument, assigning the
-  output variable to the corresponding value.  Return FALSE if nothing
+  output variable to the corresponding value.  Return false if nothing
   matches.
 */
 
-static notmuch_bool_t
+static bool
 _process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
 
     const notmuch_keyword_t *keywords;
@@ -29,64 +29,64 @@ _process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next, const char
 	else
 	    *arg_desc->opt_keyword = keywords->value;
 
-	return TRUE;
+	return true;
     }
     if (next != '\0')
 	fprintf (stderr, "Unknown keyword argument \"%s\" for option \"%s\".\n", arg_str, arg_desc->name);
     else
 	fprintf (stderr, "Option \"%s\" needs a keyword argument.\n", arg_desc->name);
-    return FALSE;
+    return false;
 }
 
-static notmuch_bool_t
+static bool
 _process_boolean_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
-    notmuch_bool_t value;
+    bool value;
 
     if (next == '\0' || strcmp (arg_str, "true") == 0) {
-	value = TRUE;
+	value = true;
     } else if (strcmp (arg_str, "false") == 0) {
-	value = FALSE;
+	value = false;
     } else {
 	fprintf (stderr, "Unknown argument \"%s\" for (boolean) option \"%s\".\n", arg_str, arg_desc->name);
-	return FALSE;
+	return false;
     }
 
     *arg_desc->opt_bool = value;
 
-    return TRUE;
+    return true;
 }
 
-static notmuch_bool_t
+static bool
 _process_int_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
 
     char *endptr;
     if (next == '\0' || arg_str[0] == '\0') {
 	fprintf (stderr, "Option \"%s\" needs an integer argument.\n", arg_desc->name);
-	return FALSE;
+	return false;
     }
 
     *arg_desc->opt_int = strtol (arg_str, &endptr, 10);
     if (*endptr == '\0')
-	return TRUE;
+	return true;
 
     fprintf (stderr, "Unable to parse argument \"%s\" for option \"%s\" as an integer.\n",
 	     arg_str, arg_desc->name);
-    return FALSE;
+    return false;
 }
 
-static notmuch_bool_t
+static bool
 _process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
 
     if (next == '\0') {
 	fprintf (stderr, "Option \"%s\" needs a string argument.\n", arg_desc->name);
-	return FALSE;
+	return false;
     }
     if (arg_str[0] == '\0') {
 	fprintf (stderr, "String argument for option \"%s\" must be non-empty.\n", arg_desc->name);
-	return FALSE;
+	return false;
     }
     *arg_desc->opt_string = arg_str;
-    return TRUE;
+    return true;
 }
 
 /* Return number of non-NULL opt_* fields in opt_desc. */
@@ -102,8 +102,8 @@ static int _opt_set_count (const notmuch_opt_desc_t *opt_desc)
 	!!opt_desc->opt_position;
 }
 
-/* Return TRUE if opt_desc is valid. */
-static notmuch_bool_t _opt_valid (const notmuch_opt_desc_t *opt_desc)
+/* Return true if opt_desc is valid. */
+static bool _opt_valid (const notmuch_opt_desc_t *opt_desc)
 {
     int n = _opt_set_count (opt_desc);
 
@@ -115,11 +115,11 @@ static notmuch_bool_t _opt_valid (const notmuch_opt_desc_t *opt_desc)
 }
 
 /*
-   Search for the {pos_arg_index}th position argument, return FALSE if
+   Search for the {pos_arg_index}th position argument, return false if
    that does not exist.
 */
 
-notmuch_bool_t
+bool
 parse_position_arg (const char *arg_str, int pos_arg_index,
 		    const notmuch_opt_desc_t *arg_desc) {
 
@@ -129,14 +129,14 @@ parse_position_arg (const char *arg_str, int pos_arg_index,
 	    if (pos_arg_counter == pos_arg_index) {
 		*arg_desc->opt_position = arg_str;
 		if (arg_desc->present)
-		    *arg_desc->present = TRUE;
-		return TRUE;
+		    *arg_desc->present = true;
+		return true;
 	    }
 	    pos_arg_counter++;
 	}
 	arg_desc++;
     }
-    return FALSE;
+    return false;
 }
 
 /*
@@ -192,7 +192,7 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
 	    opt_index ++;
 	}
 
-	notmuch_bool_t opt_status = FALSE;
+	bool opt_status = false;
 	if (try->opt_keyword || try->opt_flags)
 	    opt_status = _process_keyword_arg (try, next, value);
 	else if (try->opt_bool)
@@ -208,7 +208,7 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
 	    return -1;
 
 	if (try->present)
-	    *try->present = TRUE;
+	    *try->present = true;
 
 	return opt_index+1;
     }
@@ -221,7 +221,7 @@ parse_arguments (int argc, char **argv,
 		 const notmuch_opt_desc_t *options, int opt_index) {
 
     int pos_arg_index = 0;
-    notmuch_bool_t more_args = TRUE;
+    bool more_args = true;
 
     while (more_args && opt_index < argc) {
 	if (strncmp (argv[opt_index],"--",2) != 0) {
@@ -242,7 +242,7 @@ parse_arguments (int argc, char **argv,
 	    opt_index = parse_option (argc, argv, options, opt_index);
 	    if (opt_index < 0) {
 		fprintf (stderr, "Unrecognized option: %s\n", argv[prev_opt_index]);
-		more_args = FALSE;
+		more_args = false;
 	    }
 	}
     }
diff --git a/command-line-arguments.h b/command-line-arguments.h
index dfc808bdab78..76ca4dcbb276 100644
--- a/command-line-arguments.h
+++ b/command-line-arguments.h
@@ -1,6 +1,8 @@
 #ifndef NOTMUCH_OPTS_H
 #define NOTMUCH_OPTS_H
 
+#include <stdbool.h>
+
 #include "notmuch.h"
 
 /*
@@ -17,7 +19,7 @@ typedef struct notmuch_keyword {
 typedef struct notmuch_opt_desc {
     /* One and only one of opt_* must be set. */
     const struct notmuch_opt_desc *opt_inherit;
-    notmuch_bool_t *opt_bool;
+    bool *opt_bool;
     int *opt_int;
     int *opt_keyword;
     int *opt_flags;
@@ -27,8 +29,8 @@ typedef struct notmuch_opt_desc {
     /* Must be set except for opt_inherit and opt_position. */
     const char *name;
 
-    /* Optional, if non-NULL, set to TRUE if the option is present. */
-    notmuch_bool_t *present;
+    /* Optional, if non-NULL, set to true if the option is present. */
+    bool *present;
 
     /* Must be set for opt_keyword and opt_flags. */
     const struct notmuch_keyword *keywords;
@@ -64,7 +66,7 @@ parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int o
 int
 parse_option (int argc, char **argv, const notmuch_opt_desc_t* options, int opt_index);
 
-notmuch_bool_t
+bool
 parse_position_arg (const char *arg,
 		    int position_arg_index,
 		    const notmuch_opt_desc_t* options);
diff --git a/crypto.c b/crypto.c
index cc45b88521ec..9c557d6e0640 100644
--- a/crypto.c
+++ b/crypto.c
@@ -37,8 +37,8 @@ create_gpg_context (notmuch_crypto_t *crypto)
     }
     crypto->gpgctx = gpgctx;
 
-    g_mime_gpg_context_set_use_agent ((GMimeGpgContext *) gpgctx, TRUE);
-    g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) gpgctx, FALSE);
+    g_mime_gpg_context_set_use_agent ((GMimeGpgContext *) gpgctx, true);
+    g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) gpgctx, false);
 
     return gpgctx;
 }
@@ -61,7 +61,7 @@ create_pkcs7_context (notmuch_crypto_t *crypto)
     crypto->pkcs7ctx = pkcs7ctx;
 
     g_mime_pkcs7_context_set_always_trust ((GMimePkcs7Context *) pkcs7ctx,
-					   FALSE);
+					   false);
 
     return pkcs7ctx;
 }
diff --git a/debugger.c b/debugger.c
index 0fa0fb6bda23..5cb38ac444e3 100644
--- a/debugger.c
+++ b/debugger.c
@@ -28,20 +28,20 @@
 #define RUNNING_ON_VALGRIND 0
 #endif
 
-notmuch_bool_t
+bool
 debugger_is_active (void)
 {
     char buf[1024];
 
     if (RUNNING_ON_VALGRIND)
-	return TRUE;
+	return true;
 
     sprintf (buf, "/proc/%d/exe", getppid ());
     if (readlink (buf, buf, sizeof (buf)) != -1 &&
 	strncmp (basename (buf), "gdb", 3) == 0)
     {
-	return TRUE;
+	return true;
     }
 
-    return FALSE;
+    return false;
 }
diff --git a/gmime-filter-reply.c b/gmime-filter-reply.c
index 847426bfe663..a1ba4b45411b 100644
--- a/gmime-filter-reply.c
+++ b/gmime-filter-reply.c
@@ -16,6 +16,8 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
+#include <stdbool.h>
+
 #include "gmime-filter-reply.h"
 
 /**
@@ -87,8 +89,8 @@ static void
 g_mime_filter_reply_init (GMimeFilterReply *filter, GMimeFilterReplyClass *klass)
 {
 	(void) klass;
-	filter->saw_nl = TRUE;
-	filter->saw_angle = FALSE;
+	filter->saw_nl = true;
+	filter->saw_angle = false;
 }
 
 static void
@@ -117,43 +119,43 @@ filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
 
 	(void) prespace;
 	if (reply->encode) {
-		g_mime_filter_set_size (filter, 3 * inlen, FALSE);
+		g_mime_filter_set_size (filter, 3 * inlen, false);
 
 		outptr = filter->outbuf;
 		while (inptr < inend) {
 			if (reply->saw_nl) {
 				*outptr++ = '>';
 				*outptr++ = ' ';
-				reply->saw_nl = FALSE;
+				reply->saw_nl = false;
 			}
 			if (*inptr == '\n')
-				reply->saw_nl = TRUE;
+				reply->saw_nl = true;
 			else
-				reply->saw_nl = FALSE;
+				reply->saw_nl = false;
 			if (*inptr != '\r')
 				*outptr++ = *inptr;
 			inptr++;
 		}
 	} else {
-		g_mime_filter_set_size (filter, inlen + 1, FALSE);
+		g_mime_filter_set_size (filter, inlen + 1, false);
 
 		outptr = filter->outbuf;
 		while (inptr < inend) {
 			if (reply->saw_nl) {
 				if (*inptr == '>')
-					reply->saw_angle = TRUE;
+					reply->saw_angle = true;
 				else
 					*outptr++ = *inptr;
-				reply->saw_nl = FALSE;
+				reply->saw_nl = false;
 			} else if (reply->saw_angle) {
 				if (*inptr == ' ')
 					;
 				else
 					*outptr++ = *inptr;
-				reply->saw_angle = FALSE;
+				reply->saw_angle = false;
 			} else if (*inptr != '\r') {
 				if (*inptr == '\n')
-					reply->saw_nl = TRUE;
+					reply->saw_nl = true;
 				*outptr++ = *inptr;
 			}
 
@@ -179,19 +181,19 @@ filter_reset (GMimeFilter *filter)
 {
 	GMimeFilterReply *reply = (GMimeFilterReply *) filter;
 
-	reply->saw_nl = TRUE;
-	reply->saw_angle = FALSE;
+	reply->saw_nl = true;
+	reply->saw_angle = false;
 }
 
 
 /**
  * g_mime_filter_reply_new:
- * @encode: %TRUE if the filter should encode or %FALSE otherwise
+ * @encode: %true if the filter should encode or %false otherwise
  * @dots: encode/decode dots (as for SMTP)
  *
  * Creates a new #GMimeFilterReply filter.
  *
- * If @encode is %TRUE, then all lines will be prefixed by "> ",
+ * If @encode is %true, then all lines will be prefixed by "> ",
  * otherwise any lines starting with "> " will have that removed
  *
  * Returns: a new #GMimeFilterReply filter.
diff --git a/mime-node.c b/mime-node.c
index 24d73afa8458..8b767d783117 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -112,7 +112,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
 	status = NOTMUCH_STATUS_OUT_OF_MEMORY;
 	goto DONE;
     }
-    g_mime_stream_file_set_owner (GMIME_STREAM_FILE (mctx->stream), FALSE);
+    g_mime_stream_file_set_owner (GMIME_STREAM_FILE (mctx->stream), false);
 
     mctx->parser = g_mime_parser_new_with_stream (mctx->stream);
     if (!mctx->parser) {
@@ -175,7 +175,7 @@ node_verify (mime_node_t *node, GMimeObject *part,
 {
     GError *err = NULL;
 
-    node->verify_attempted = TRUE;
+    node->verify_attempted = true;
     node->sig_list = g_mime_multipart_signed_verify
 	(GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);
 
@@ -198,7 +198,7 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
     GMimeDecryptResult *decrypt_result = NULL;
     GMimeMultipartEncrypted *encrypteddata = GMIME_MULTIPART_ENCRYPTED (part);
 
-    node->decrypt_attempted = TRUE;
+    node->decrypt_attempted = true;
     node->decrypted_child = g_mime_multipart_encrypted_decrypt
 	(encrypteddata, cryptoctx, &decrypt_result, &err);
     if (! node->decrypted_child) {
@@ -207,8 +207,8 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
 	goto DONE;
     }
 
-    node->decrypt_success = TRUE;
-    node->verify_attempted = TRUE;
+    node->decrypt_success = true;
+    node->verify_attempted = true;
 
     /* This may be NULL if the part is not signed. */
     node->sig_list = g_mime_decrypt_result_get_signatures (decrypt_result);
diff --git a/notmuch-client.h b/notmuch-client.h
index c68538fcc0a2..0365baae4b89 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -24,6 +24,7 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE /* for getline */
 #endif
+#include <stdbool.h>
 #include <stdio.h>
 #include <sysexits.h>
 
@@ -72,8 +73,8 @@ typedef struct notmuch_show_format {
 } notmuch_show_format_t;
 
 typedef struct notmuch_crypto {
-    notmuch_bool_t verify;
-    notmuch_bool_t decrypt;
+    bool verify;
+    bool decrypt;
 #if (GMIME_MAJOR_VERSION < 3)
     notmuch_crypto_context_t* gpgctx;
     notmuch_crypto_context_t* pkcs7ctx;
@@ -82,12 +83,12 @@ typedef struct notmuch_crypto {
 } notmuch_crypto_t;
 
 typedef struct notmuch_show_params {
-    notmuch_bool_t entire_thread;
-    notmuch_bool_t omit_excluded;
-    notmuch_bool_t output_body;
+    bool entire_thread;
+    bool omit_excluded;
+    bool output_body;
     int part;
     notmuch_crypto_t crypto;
-    notmuch_bool_t include_html;
+    bool include_html;
     GMimeStream *out_stream;
 } notmuch_show_params_t;
 
@@ -247,12 +248,12 @@ show_one_part (const char *filename, int part);
 
 void
 format_part_sprinter (const void *ctx, struct sprinter *sp, mime_node_t *node,
-		      notmuch_bool_t output_body,
-		      notmuch_bool_t include_html);
+		      bool output_body,
+		      bool include_html);
 
 void
 format_headers_sprinter (struct sprinter *sp, GMimeMessage *message,
-			 notmuch_bool_t reply);
+			 bool reply);
 
 typedef enum {
     NOTMUCH_SHOW_TEXT_PART_REPLY = 1 << 0,
@@ -286,7 +287,7 @@ notmuch_config_close (notmuch_config_t *config);
 int
 notmuch_config_save (notmuch_config_t *config);
 
-notmuch_bool_t
+bool
 notmuch_config_is_new (notmuch_config_t *config);
 
 const char *
@@ -345,12 +346,12 @@ notmuch_config_set_new_ignore (notmuch_config_t *config,
 			       const char *new_ignore[],
 			       size_t length);
 
-notmuch_bool_t
+bool
 notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config);
 
 void
 notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,
-					      notmuch_bool_t synchronize_flags);
+					      bool synchronize_flags);
 
 const char **
 notmuch_config_get_search_exclude_tags (notmuch_config_t *config, size_t *length);
@@ -363,7 +364,7 @@ notmuch_config_set_search_exclude_tags (notmuch_config_t *config,
 int
 notmuch_run_hook (const char *db_path, const char *hook);
 
-notmuch_bool_t
+bool
 debugger_is_active (void);
 
 /* mime-node.c */
@@ -406,14 +407,14 @@ struct mime_node {
     int part_num;
 
     /* True if decryption of this part was attempted. */
-    notmuch_bool_t decrypt_attempted;
+    bool decrypt_attempted;
     /* True if decryption of this part's child succeeded.  In this
      * case, the decrypted part is substituted for the second child of
      * this part (which would usually be the encrypted data). */
-    notmuch_bool_t decrypt_success;
+    bool decrypt_success;
 
     /* True if signature verification on this part was attempted. */
-    notmuch_bool_t verify_attempted;
+    bool verify_attempted;
 
     /* The list of signatures for signed or encrypted containers. If
      * there are no signatures, this will be NULL. */
@@ -487,7 +488,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 		       const char *query_str,
 		       dump_format_t output_format,
 		       dump_include_t include,
-		       notmuch_bool_t gzip_output);
+		       bool gzip_output);
 
 /* If status is non-zero (i.e. error) print appropriate
    messages to stderr.
diff --git a/notmuch-compact.c b/notmuch-compact.c
index ae464e4805cb..f8996cf46039 100644
--- a/notmuch-compact.c
+++ b/notmuch-compact.c
@@ -32,7 +32,7 @@ notmuch_compact_command (notmuch_config_t *config, int argc, char *argv[])
     const char *path = notmuch_config_get_database_path (config);
     const char *backup_path = NULL;
     notmuch_status_t ret;
-    notmuch_bool_t quiet = FALSE;
+    bool quiet = false;
     int opt_index;
 
     notmuch_opt_desc_t options[] = {
diff --git a/notmuch-config.c b/notmuch-config.c
index cb9529b90912..8fb59f96eb6d 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -122,7 +122,7 @@ static const char crypto_config_comment[] =
 struct _notmuch_config {
     char *filename;
     GKeyFile *key_file;
-    notmuch_bool_t is_new;
+    bool is_new;
 
     char *database_path;
     char *crypto_gpg_path;
@@ -134,7 +134,7 @@ struct _notmuch_config {
     size_t new_tags_length;
     const char **new_ignore;
     size_t new_ignore_length;
-    notmuch_bool_t maildir_synchronize_flags;
+    bool maildir_synchronize_flags;
     const char **search_exclude_tags;
     size_t search_exclude_tags_length;
 };
@@ -212,8 +212,8 @@ get_username_from_passwd_file (void *ctx)
     return name;
 }
 
-static notmuch_bool_t
-get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
+static bool
+get_config_from_file (notmuch_config_t *config, bool create_new)
 {
     #define BUF_SIZE 4096
     char *config_str = NULL;
@@ -221,7 +221,7 @@ get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
     int config_bufsize = BUF_SIZE;
     size_t len;
     GError *error = NULL;
-    notmuch_bool_t ret = FALSE;
+    bool ret = false;
 
     FILE *fp = fopen(config->filename, "r");
     if (fp == NULL) {
@@ -230,8 +230,8 @@ get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
 	     * default configuration file in the case of FILE NOT FOUND.
 	     */
 	    if (create_new) {
-		config->is_new = TRUE;
-		ret = TRUE;
+		config->is_new = true;
+		ret = true;
 	    } else {
 		fprintf (stderr, "Configuration file %s not found.\n"
 			 "Try running 'notmuch setup' to create a configuration.\n",
@@ -271,7 +271,7 @@ get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
 
     if (g_key_file_load_from_data (config->key_file, config_str, config_len,
 				   G_KEY_FILE_KEEP_COMMENTS, &error)) {
-	ret = TRUE;
+	ret = true;
 	goto out;
     }
 
@@ -352,7 +352,7 @@ notmuch_config_open (void *ctx,
     talloc_set_destructor (config, notmuch_config_destructor);
 
     /* non-zero defaults */
-    config->maildir_synchronize_flags = TRUE;
+    config->maildir_synchronize_flags = true;
 
     if (filename) {
 	config->filename = talloc_strdup (config, filename);
@@ -366,7 +366,7 @@ notmuch_config_open (void *ctx,
     config->key_file = g_key_file_new ();
 
     if (config_mode & NOTMUCH_CONFIG_OPEN) {
-	notmuch_bool_t create_new = (config_mode & NOTMUCH_CONFIG_CREATE) != 0;
+	bool create_new = (config_mode & NOTMUCH_CONFIG_CREATE) != 0;
 
 	if (! get_config_from_file (config, create_new)) {
 	    talloc_free (config);
@@ -466,7 +466,7 @@ notmuch_config_open (void *ctx,
 	g_key_file_get_boolean (config->key_file,
 				"maildir", "synchronize_flags", &error);
     if (error) {
-	notmuch_config_set_maildir_synchronize_flags (config, TRUE);
+	notmuch_config_set_maildir_synchronize_flags (config, true);
 	g_error_free (error);
     }
 
@@ -579,7 +579,7 @@ notmuch_config_save (notmuch_config_t *config)
     return 0;
 }
 
-notmuch_bool_t
+bool
 notmuch_config_is_new (notmuch_config_t *config)
 {
     return config->is_new;
@@ -1086,7 +1086,7 @@ notmuch_config_command (notmuch_config_t *config, int argc, char *argv[])
 
 }
 
-notmuch_bool_t
+bool
 notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config)
 {
     return config->maildir_synchronize_flags;
@@ -1094,7 +1094,7 @@ notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config)
 
 void
 notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,
-					      notmuch_bool_t synchronize_flags)
+					      bool synchronize_flags)
 {
     g_key_file_set_boolean (config->key_file,
 			    "maildir", "synchronize_flags", synchronize_flags);
diff --git a/notmuch-count.c b/notmuch-count.c
index b8b03cdbc0d4..1ae7d5146d92 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -29,8 +29,8 @@ enum {
 
 /* The following is to allow future options to be added more easily */
 enum {
-    EXCLUDE_TRUE,
-    EXCLUDE_FALSE,
+    EXCLUDE_true,
+    EXCLUDE_false,
 };
 
 /* Return the number of files matching the query, or -1 for an error */
@@ -160,11 +160,11 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
     char *query_str;
     int opt_index;
     int output = OUTPUT_MESSAGES;
-    int exclude = EXCLUDE_TRUE;
+    int exclude = EXCLUDE_true;
     const char **search_exclude_tags = NULL;
     size_t search_exclude_tags_length = 0;
-    notmuch_bool_t batch = FALSE;
-    notmuch_bool_t print_lastmod = FALSE;
+    bool batch = false;
+    bool print_lastmod = false;
     FILE *input = stdin;
     const char *input_file_name = NULL;
     int ret;
@@ -176,8 +176,8 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
 				  { "files", OUTPUT_FILES },
 				  { 0, 0 } } },
 	{ .opt_keyword = &exclude, .name = "exclude", .keywords =
-	  (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },
-				  { "false", EXCLUDE_FALSE },
+	  (notmuch_keyword_t []){ { "true", EXCLUDE_true },
+				  { "false", EXCLUDE_false },
 				  { 0, 0 } } },
 	{ .opt_bool = &print_lastmod, .name = "lastmod" },
 	{ .opt_bool = &batch, .name = "batch" },
@@ -193,7 +193,7 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
     notmuch_process_shared_options (argv[0]);
 
     if (input_file_name) {
-	batch = TRUE;
+	batch = true;
 	input = fopen (input_file_name, "r");
 	if (input == NULL) {
 	    fprintf (stderr, "Error opening %s for reading: %s\n",
@@ -221,7 +221,7 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
 	return EXIT_FAILURE;
     }
 
-    if (exclude == EXCLUDE_TRUE) {
+    if (exclude == EXCLUDE_true) {
 	search_exclude_tags = notmuch_config_get_search_exclude_tags
 	    (config, &search_exclude_tags_length);
     }
diff --git a/notmuch-dump.c b/notmuch-dump.c
index 03e64d608c85..ef2f02dfeb5c 100644
--- a/notmuch-dump.c
+++ b/notmuch-dump.c
@@ -97,7 +97,7 @@ dump_properties_message (void *ctx,
 {
     const char *message_id;
     notmuch_message_properties_t *list;
-    notmuch_bool_t first = TRUE;
+    bool first = true;
 
     message_id = notmuch_message_get_message_id (message);
 
@@ -106,7 +106,7 @@ dump_properties_message (void *ctx,
 	return 0;
     }
 
-    for (list = notmuch_message_get_properties (message, "", FALSE);
+    for (list = notmuch_message_get_properties (message, "", false);
 	 notmuch_message_properties_valid (list); notmuch_message_properties_move_to_next (list)) {
 	const char *key, *val;
 
@@ -116,7 +116,7 @@ dump_properties_message (void *ctx,
 		return 1;
 	    }
 	    gzprintf (output, "#= %s", *buffer_p);
-	    first = FALSE;
+	    first = false;
 	}
 
 	key = notmuch_message_properties_key (list);
@@ -277,7 +277,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 		       const char *query_str,
 		       dump_format_t output_format,
 		       dump_include_t include,
-		       notmuch_bool_t gzip_output)
+		       bool gzip_output)
 {
     gzFile output = NULL;
     const char *mode = gzip_output ? "w9" : "wT";
@@ -374,7 +374,7 @@ notmuch_dump_command (notmuch_config_t *config, int argc, char *argv[])
 
     int output_format = DUMP_FORMAT_BATCH_TAG;
     int include = 0;
-    notmuch_bool_t gzip_output = 0;
+    bool gzip_output = 0;
 
     notmuch_opt_desc_t options[] = {
 	{ .opt_keyword = &output_format, .name = "format", .keywords =
diff --git a/notmuch-insert.c b/notmuch-insert.c
index bbbc29ea103d..32be74193472 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -65,7 +65,7 @@ safe_gethostname (char *hostname, size_t len)
 }
 
 /* Call fsync() on a directory path. */
-static notmuch_bool_t
+static bool
 sync_dir (const char *dir)
 {
     int fd, r;
@@ -73,7 +73,7 @@ sync_dir (const char *dir)
     fd = open (dir, O_RDONLY);
     if (fd == -1) {
 	fprintf (stderr, "Error: open %s: %s\n", dir, strerror (errno));
-	return FALSE;
+	return false;
     }
 
     r = fsync (fd);
@@ -88,29 +88,29 @@ sync_dir (const char *dir)
 /*
  * Check the specified folder name does not contain a directory
  * component ".." to prevent writes outside of the Maildir
- * hierarchy. Return TRUE on valid folder name, FALSE otherwise.
+ * hierarchy. Return true on valid folder name, false otherwise.
  */
-static notmuch_bool_t
+static bool
 is_valid_folder_name (const char *folder)
 {
     const char *p = folder;
 
     for (;;) {
 	if ((p[0] == '.') && (p[1] == '.') && (p[2] == '\0' || p[2] == '/'))
-	    return FALSE;
+	    return false;
 	p = strchr (p, '/');
 	if (!p)
-	    return TRUE;
+	    return true;
 	p++;
     }
 }
 
 /*
  * Make the given directory and its parents as necessary, using the
- * given mode. Return TRUE on success, FALSE otherwise. Partial
+ * given mode. Return true on success, false otherwise. Partial
  * results are not cleaned up on errors.
  */
-static notmuch_bool_t
+static bool
 mkdir_recursive (const void *ctx, const char *path, int mode)
 {
     struct stat st;
@@ -123,13 +123,13 @@ mkdir_recursive (const void *ctx, const char *path, int mode)
         if (! S_ISDIR (st.st_mode)) {
 	    fprintf (stderr, "Error: '%s' is not a directory: %s\n",
 		     path, strerror (EEXIST));
-	    return FALSE;
+	    return false;
 	}
 
-	return TRUE;
+	return true;
     } else if (errno != ENOENT) {
 	fprintf (stderr, "Error: stat '%s': %s\n", path, strerror (errno));
-	return FALSE;
+	return false;
     }
 
     /* mkdir parents, if any */
@@ -138,27 +138,27 @@ mkdir_recursive (const void *ctx, const char *path, int mode)
 	parent = talloc_strndup (ctx, path, slash - path);
 	if (! parent) {
 	    fprintf (stderr, "Error: %s\n", strerror (ENOMEM));
-	    return FALSE;
+	    return false;
 	}
 
 	if (! mkdir_recursive (ctx, parent, mode))
-	    return FALSE;
+	    return false;
     }
 
     if (mkdir (path, mode)) {
 	fprintf (stderr, "Error: mkdir '%s': %s\n", path, strerror (errno));
-	return FALSE;
+	return false;
     }
 
-    return parent ? sync_dir (parent) : TRUE;
+    return parent ? sync_dir (parent) : true;
 }
 
 /*
  * Create the given maildir folder, i.e. maildir and its
- * subdirectories cur/new/tmp. Return TRUE on success, FALSE
+ * subdirectories cur/new/tmp. Return true on success, false
  * otherwise. Partial results are not cleaned up on errors.
  */
-static notmuch_bool_t
+static bool
 maildir_create_folder (const void *ctx, const char *maildir)
 {
     const char *subdirs[] = { "cur", "new", "tmp" };
@@ -170,14 +170,14 @@ maildir_create_folder (const void *ctx, const char *maildir)
 	subdir = talloc_asprintf (ctx, "%s/%s", maildir, subdirs[i]);
 	if (! subdir) {
 	    fprintf (stderr, "Error: %s\n", strerror (ENOMEM));
-	    return FALSE;
+	    return false;
 	}
 
 	if (! mkdir_recursive (ctx, subdir, mode))
-	    return FALSE;
+	    return false;
     }
 
-    return TRUE;
+    return true;
 }
 
 /*
@@ -241,13 +241,13 @@ maildir_mktemp (const void *ctx, const char *maildir, char **path_out)
 }
 
 /*
- * Copy fdin to fdout, return TRUE on success, and FALSE on errors and
+ * Copy fdin to fdout, return true on success, and false on errors and
  * empty input.
  */
-static notmuch_bool_t
+static bool
 copy_fd (int fdout, int fdin)
 {
-    notmuch_bool_t empty = TRUE;
+    bool empty = true;
 
     while (! interrupted) {
 	ssize_t remain;
@@ -262,7 +262,7 @@ copy_fd (int fdout, int fdin)
 		continue;
 	    fprintf (stderr, "Error: reading from standard input: %s\n",
 		     strerror (errno));
-	    return FALSE;
+	    return false;
 	}
 
 	p = buf;
@@ -273,11 +273,11 @@ copy_fd (int fdout, int fdin)
 	    if (written <= 0) {
 		fprintf (stderr, "Error: writing to temporary file: %s",
 			 strerror (errno));
-		return FALSE;
+		return false;
 	    }
 	    p += written;
 	    remain -= written;
-	    empty = FALSE;
+	    empty = false;
 	} while (remain > 0);
     }
 
@@ -367,19 +367,19 @@ FAIL:
 
 /*
  * Add the specified message file to the notmuch database, applying
- * tags in tag_ops. If synchronize_flags is TRUE, the tags are
+ * tags in tag_ops. If synchronize_flags is true, the tags are
  * synchronized to maildir flags (which may result in message file
  * rename).
  *
  * Return NOTMUCH_STATUS_SUCCESS on success, errors otherwise. If keep
- * is TRUE, errors in tag changes and flag syncing are ignored and
+ * is true, errors in tag changes and flag syncing are ignored and
  * success status is returned; otherwise such errors cause the message
  * to be removed from the database. Failure to add the message to the
  * database results in error status regardless of keep.
  */
 static notmuch_status_t
 add_file (notmuch_database_t *notmuch, const char *path, tag_op_list_t *tag_ops,
-	  notmuch_bool_t synchronize_flags, notmuch_bool_t keep)
+	  bool synchronize_flags, bool keep)
 {
     notmuch_message_t *message;
     notmuch_status_t status;
@@ -453,10 +453,10 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
     tag_op_list_t *tag_ops;
     char *query_string = NULL;
     const char *folder = "";
-    notmuch_bool_t create_folder = FALSE;
-    notmuch_bool_t keep = FALSE;
-    notmuch_bool_t no_hooks = FALSE;
-    notmuch_bool_t synchronize_flags;
+    bool create_folder = false;
+    bool keep = false;
+    bool no_hooks = false;
+    bool synchronize_flags;
     char *maildir;
     char *newpath;
     int opt_index;
@@ -489,14 +489,14 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
     for (i = 0; i < new_tags_length; i++) {
 	const char *error_msg;
 
-	error_msg = illegal_tag (new_tags[i], FALSE);
+	error_msg = illegal_tag (new_tags[i], false);
 	if (error_msg) {
 	    fprintf (stderr, "Error: tag '%s' in new.tags: %s\n",
 		     new_tags[i],  error_msg);
 	    return EXIT_FAILURE;
 	}
 
-	if (tag_op_list_append (tag_ops, new_tags[i], FALSE))
+	if (tag_op_list_append (tag_ops, new_tags[i], false))
 	    return EXIT_FAILURE;
     }
 
diff --git a/notmuch-new.c b/notmuch-new.c
index 50597b75c07e..0f50457eb894 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -44,7 +44,7 @@ enum verbosity {
 typedef struct {
     int output_is_a_tty;
     enum verbosity verbosity;
-    notmuch_bool_t debug;
+    bool debug;
     const char **new_tags;
     size_t new_tags_length;
     const char **new_ignore;
@@ -60,7 +60,7 @@ typedef struct {
     _filename_list_t *removed_directories;
     _filename_list_t *directory_mtimes;
 
-    notmuch_bool_t synchronize_flags;
+    bool synchronize_flags;
 } add_files_state_t;
 
 static volatile sig_atomic_t do_print_progress = 0;
@@ -234,7 +234,7 @@ _entries_resemble_maildir (const char *path, struct dirent **entries, int count)
     return 0;
 }
 
-static notmuch_bool_t
+static bool
 _special_directory (const char *entry)
 {
     return strcmp (entry, ".") == 0 || strcmp (entry, "..") == 0;
@@ -242,16 +242,16 @@ _special_directory (const char *entry)
 
 /* Test if the file/directory is to be ignored.
  */
-static notmuch_bool_t
+static bool
 _entry_in_ignore_list (const char *entry, add_files_state_t *state)
 {
     size_t i;
 
     for (i = 0; i < state->new_ignore_length; i++)
 	if (strcmp (entry, state->new_ignore[i]) == 0)
-	    return TRUE;
+	    return true;
 
-    return FALSE;
+    return false;
 }
 
 /* Add a single file to the database. */
@@ -376,7 +376,7 @@ add_files (notmuch_database_t *notmuch,
     notmuch_filenames_t *db_subdirs = NULL;
     time_t stat_time;
     struct stat st;
-    notmuch_bool_t is_maildir;
+    bool is_maildir;
 
     if (stat (path, &st)) {
 	fprintf (stderr, "Error reading directory %s: %s\n",
@@ -837,7 +837,7 @@ remove_filename (notmuch_database_t *notmuch,
     status = notmuch_database_remove_message (notmuch, path);
     if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {
 	add_files_state->renamed_messages++;
-	if (add_files_state->synchronize_flags == TRUE)
+	if (add_files_state->synchronize_flags == true)
 	    notmuch_message_maildir_flags_to_tags (message);
 	status = NOTMUCH_STATUS_SUCCESS;
     } else if (status == NOTMUCH_STATUS_SUCCESS) {
@@ -941,7 +941,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
     notmuch_database_t *notmuch;
     add_files_state_t add_files_state = {
 	.verbosity = VERBOSITY_NORMAL,
-	.debug = FALSE,
+	.debug = false,
 	.output_is_a_tty = isatty (fileno (stdout)),
     };
     struct timeval tv_start;
@@ -953,9 +953,9 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
     _filename_node_t *f;
     int opt_index;
     unsigned int i;
-    notmuch_bool_t timer_is_active = FALSE;
-    notmuch_bool_t no_hooks = FALSE;
-    notmuch_bool_t quiet = FALSE, verbose = FALSE;
+    bool timer_is_active = false;
+    bool no_hooks = false;
+    bool quiet = false, verbose = false;
     notmuch_status_t status;
 
     notmuch_opt_desc_t options[] = {
@@ -987,7 +987,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
     for (i = 0; i < add_files_state.new_tags_length; i++) {
 	const char *error_msg;
 
-	error_msg = illegal_tag (add_files_state.new_tags[i], FALSE);
+	error_msg = illegal_tag (add_files_state.new_tags[i], false);
 	if (error_msg) {
 	    fprintf (stderr, "Error: tag '%s' in new.tags: %s\n",
 		     add_files_state.new_tags[i], error_msg);
@@ -1054,7 +1054,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
 	    }
 
 	    if (notmuch_database_dump (notmuch, backup_name, "",
-				       DUMP_FORMAT_BATCH_TAG, DUMP_INCLUDE_DEFAULT, TRUE)) {
+				       DUMP_FORMAT_BATCH_TAG, DUMP_INCLUDE_DEFAULT, true)) {
 		fprintf (stderr, "Backup failed. Aborting upgrade.");
 		return EXIT_FAILURE;
 	    }
@@ -1101,7 +1101,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
     if (add_files_state.verbosity == VERBOSITY_NORMAL &&
 	add_files_state.output_is_a_tty && ! debugger_is_active ()) {
 	setup_progress_printing_timer ();
-	timer_is_active = TRUE;
+	timer_is_active = true;
     }
 
     ret = add_files (notmuch, db_path, &add_files_state);
diff --git a/notmuch-reply.c b/notmuch-reply.c
index e7ead79d755d..3e5a1443719a 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -93,7 +93,7 @@ typedef enum {
 } address_match_t;
 
 /* Match given string against given address according to mode. */
-static notmuch_bool_t
+static bool
 match_address (const char *str, const char *address, address_match_t mode)
 {
     switch (mode) {
@@ -105,7 +105,7 @@ match_address (const char *str, const char *address, address_match_t mode)
 	return strcasecmp (address, str) == 0;
     }
 
-    return FALSE;
+    return false;
 }
 
 /* Match given string against user's configured "primary" and "other"
@@ -153,7 +153,7 @@ string_in_user_address (const char *str, notmuch_config_t *config)
 
 /* Is the given address configured as one of the user's "primary" or
  * "other" addresses. */
-static notmuch_bool_t
+static bool
 address_is_users (const char *address, notmuch_config_t *config)
 {
     return address_match (address, config, STRING_IS_USER_ADDRESS) != NULL;
@@ -221,7 +221,7 @@ scan_address_list (InternetAddressList *list,
 /* Does the address in the Reply-To header of 'message' already appear
  * in either the 'To' or 'Cc' header of the message?
  */
-static notmuch_bool_t
+static bool
 reply_to_header_is_redundant (GMimeMessage *message,
 			      InternetAddressList *reply_to_list)
 {
@@ -229,7 +229,7 @@ reply_to_header_is_redundant (GMimeMessage *message,
     InternetAddress *address;
     InternetAddressMailbox *mailbox;
     InternetAddressList *recipients;
-    notmuch_bool_t ret = FALSE;
+    bool ret = false;
     int i;
 
     if (reply_to_list == NULL ||
@@ -253,7 +253,7 @@ reply_to_header_is_redundant (GMimeMessage *message,
 	mailbox = INTERNET_ADDRESS_MAILBOX (address);
 	addr = internet_address_mailbox_get_addr (mailbox);
 	if (strcmp (addr, reply_to) == 0) {
-	    ret = TRUE;
+	    ret = true;
 	    break;
 	}
     }
@@ -323,7 +323,7 @@ static const char *
 add_recipients_from_message (GMimeMessage *reply,
 			     notmuch_config_t *config,
 			     GMimeMessage *message,
-			     notmuch_bool_t reply_all)
+			     bool reply_all)
 {
 
     /* There is a memory leak here with gmime-2.6 because get_sender
@@ -522,8 +522,8 @@ create_reply_message(void *ctx,
 		     notmuch_config_t *config,
 		     notmuch_message_t *message,
 		     GMimeMessage *mime_message,
-		     notmuch_bool_t reply_all,
-		     notmuch_bool_t limited)
+		     bool reply_all,
+		     bool limited)
 {
     const char *subject, *from_addr = NULL;
     const char *in_reply_to, *orig_references, *references;
@@ -612,7 +612,7 @@ static int do_reply(notmuch_config_t *config,
 		    notmuch_query_t *query,
 		    notmuch_show_params_t *params,
 		    int format,
-		    notmuch_bool_t reply_all)
+		    bool reply_all)
 {
     GMimeMessage *reply;
     mime_node_t *node;
@@ -663,11 +663,11 @@ static int do_reply(notmuch_config_t *config,
 
 	    /* The headers of the reply message we've created */
 	    sp->map_key (sp, "reply-headers");
-	    format_headers_sprinter (sp, reply, TRUE);
+	    format_headers_sprinter (sp, reply, true);
 
 	    /* Start the original */
 	    sp->map_key (sp, "original");
-	    format_part_sprinter (config, sp, node, TRUE, FALSE);
+	    format_part_sprinter (config, sp, node, true, false);
 
 	    /* End */
 	    sp->end (sp);
@@ -702,7 +702,7 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
 	.part = -1,
     };
     int format = FORMAT_DEFAULT;
-    int reply_all = TRUE;
+    int reply_all = true;
 
     notmuch_opt_desc_t options[] = {
 	{ .opt_keyword = &format, .name = "format", .keywords =
@@ -713,8 +713,8 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
 				  { 0, 0 } } },
 	{ .opt_int = &notmuch_format_version, .name = "format-version" },
 	{ .opt_keyword = &reply_all, .name = "reply-to", .keywords =
-	  (notmuch_keyword_t []){ { "all", TRUE },
-				  { "sender", FALSE },
+	  (notmuch_keyword_t []){ { "all", true },
+				  { "sender", false },
 				  { 0, 0 } } },
 	{ .opt_bool = &params.crypto.decrypt, .name = "decrypt" },
 	{ .opt_inherit = notmuch_shared_options },
diff --git a/notmuch-restore.c b/notmuch-restore.c
index 0025e2c316be..dee19c206d13 100644
--- a/notmuch-restore.c
+++ b/notmuch-restore.c
@@ -211,7 +211,7 @@ parse_sup_line (void *ctx, char *line,
 	    tok_len++;
 	}
 
-	if (tag_op_list_append (tag_ops, tok, FALSE))
+	if (tag_op_list_append (tag_ops, tok, false))
 	    return -1;
     }
 
@@ -223,7 +223,7 @@ int
 notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[])
 {
     notmuch_database_t *notmuch;
-    notmuch_bool_t accumulate = FALSE;
+    bool accumulate = false;
     tag_op_flag_t flags = 0;
     tag_op_list_t *tag_ops;
 
diff --git a/notmuch-search.c b/notmuch-search.c
index 2ea658d325d6..0abac08eb7ab 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -163,7 +163,7 @@ do_search_threads (search_context_t *ctx)
 	    int files = notmuch_thread_get_total_files (thread);
 	    int total = notmuch_thread_get_total_messages (thread);
 	    const char *relative_date = NULL;
-	    notmuch_bool_t first_tag = TRUE;
+	    bool first_tag = true;
 
 	    format->begin_map (format);
 
@@ -243,7 +243,7 @@ do_search_threads (search_context_t *ctx)
 		if (format->is_text_printer) {
                   /* Special case for the text formatter */
 		    if (first_tag)
-			first_tag = FALSE;
+			first_tag = false;
 		    else
 			fputc (' ', stdout);
 		    fputs (tag, stdout);
@@ -295,9 +295,9 @@ static int mailbox_compare (const void *v1, const void *v2)
     return ret;
 }
 
-/* Returns TRUE iff name and addr is duplicate. If not, stores the
+/* Returns true iff name and addr is duplicate. If not, stores the
  * name/addr pair in order to detect subsequent duplicates. */
-static notmuch_bool_t
+static bool
 is_duplicate (const search_context_t *ctx, const char *name, const char *addr)
 {
     char *key;
@@ -315,12 +315,12 @@ is_duplicate (const search_context_t *ctx, const char *name, const char *addr)
 	if (l) {
 	    mailbox = l->data;
 	    mailbox->count++;
-	    return TRUE;
+	    return true;
 	}
 
 	mailbox = new_mailbox (ctx->format, name, addr);
 	if (! mailbox)
-	    return FALSE;
+	    return false;
 
 	/*
 	 * XXX: It would be more efficient to prepend to the list, but
@@ -331,24 +331,24 @@ is_duplicate (const search_context_t *ctx, const char *name, const char *addr)
 	if (list != g_list_append (list, mailbox))
 	    INTERNAL_ERROR ("appending to list changed list head\n");
 
-	return FALSE;
+	return false;
     }
 
     key = talloc_strdup (ctx->format, addr);
     if (! key)
-	return FALSE;
+	return false;
 
     mailbox = new_mailbox (ctx->format, name, addr);
     if (! mailbox)
-	return FALSE;
+	return false;
 
     list = g_list_append (NULL, mailbox);
     if (! list)
-	return FALSE;
+	return false;
 
     g_hash_table_insert (ctx->addresses, key, list);
 
-    return FALSE;
+    return false;
 }
 
 static void
@@ -363,7 +363,7 @@ print_mailbox (const search_context_t *ctx, const mailbox_t *mailbox)
 
     /* name_addr has the name part quoted if necessary. Compare
      * 'John Doe <john@doe.com>' vs. '"Doe, John" <john@doe.com>' */
-    name_addr = internet_address_to_string (ia, FALSE);
+    name_addr = internet_address_to_string (ia, false);
 
     if (format->is_text_printer) {
 	if (ctx->output & OUTPUT_COUNT) {
diff --git a/notmuch-setup.c b/notmuch-setup.c
index 9a66810db385..5304800553cf 100644
--- a/notmuch-setup.c
+++ b/notmuch-setup.c
@@ -187,7 +187,7 @@ notmuch_setup_command (notmuch_config_t *config,
 					     (const char **)
 					     other_emails->pdata,
 					     other_emails->len);
-    g_ptr_array_free (other_emails, TRUE);
+    g_ptr_array_free (other_emails, true);
 
     prompt ("Top-level directory of your email archive [%s]: ",
 	    notmuch_config_get_database_path (config));
@@ -210,7 +210,7 @@ notmuch_setup_command (notmuch_config_t *config,
 	notmuch_config_set_new_tags (config, (const char **) tags->pdata,
 				     tags->len);
 
-	g_ptr_array_free (tags, TRUE);
+	g_ptr_array_free (tags, true);
     }
 
 
@@ -227,7 +227,7 @@ notmuch_setup_command (notmuch_config_t *config,
 						(const char **) tags->pdata,
 						tags->len);
 
-	g_ptr_array_free (tags, TRUE);
+	g_ptr_array_free (tags, true);
     }
 
     if (notmuch_config_save (config))
diff --git a/notmuch-show.c b/notmuch-show.c
index 3d11a40c6a59..1cfc74652aca 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -196,7 +196,7 @@ _is_from_line (const char *line)
 
 void
 format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
-			 notmuch_bool_t reply)
+			 bool reply)
 {
     /* Any changes to the JSON or S-Expression format should be
      * reflected in the file devel/schemata. */
@@ -283,7 +283,7 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
 	return;
 
     stream_filter = g_mime_stream_filter_new (stream_out);
-    crlf_filter = g_mime_filter_crlf_new (FALSE, FALSE);
+    crlf_filter = g_mime_filter_crlf_new (false, false);
     g_mime_stream_filter_add(GMIME_STREAM_FILTER (stream_filter),
 			     crlf_filter);
     g_object_unref (crlf_filter);
@@ -305,7 +305,7 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
 
     if (flags & NOTMUCH_SHOW_TEXT_PART_REPLY) {
 	GMimeFilter *reply_filter;
-	reply_filter = g_mime_filter_reply_new (TRUE);
+	reply_filter = g_mime_filter_reply_new (true);
 	if (reply_filter) {
 	    g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter),
 				      reply_filter);
@@ -350,7 +350,7 @@ do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
     for (unsigned int i = 0; i < array_map_len; i++) {
 	if (errors & key_map[i].bit) {
 	    sp->map_key (sp, key_map[i].string);
-	    sp->boolean (sp, TRUE);
+	    sp->boolean (sp, true);
 	}
     }
 
@@ -490,7 +490,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
     GMimeObject *meta = node->envelope_part ?
 	GMIME_OBJECT (node->envelope_part) : node->part;
     GMimeContentType *content_type = g_mime_object_get_content_type (meta);
-    const notmuch_bool_t leaf = GMIME_IS_PART (node->part);
+    const bool leaf = GMIME_IS_PART (node->part);
     GMimeStream *stream = params->out_stream;
     const char *part_type;
     int i;
@@ -603,8 +603,8 @@ format_omitted_part_meta_sprinter (sprinter_t *sp, GMimeObject *meta, GMimePart
 
 void
 format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
-		      notmuch_bool_t output_body,
-		      notmuch_bool_t include_html)
+		      bool output_body,
+		      bool include_html)
 {
     /* Any changes to the JSON or S-Expression format should be
      * reflected in the file devel/schemata. */
@@ -614,12 +614,12 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
 	format_message_sprinter (sp, node->envelope_file);
 
 	sp->map_key (sp, "headers");
-	format_headers_sprinter (sp, GMIME_MESSAGE (node->part), FALSE);
+	format_headers_sprinter (sp, GMIME_MESSAGE (node->part), false);
 
 	if (output_body) {
 	    sp->map_key (sp, "body");
 	    sp->begin_list (sp);
-	    format_part_sprinter (ctx, sp, mime_node_child (node, 0), TRUE, include_html);
+	    format_part_sprinter (ctx, sp, mime_node_child (node, 0), true, include_html);
 	    sp->end (sp);
 	}
 	sp->end (sp);
@@ -713,7 +713,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
 	sp->begin_map (sp);
 
 	sp->map_key (sp, "headers");
-	format_headers_sprinter (sp, GMIME_MESSAGE (node->part), FALSE);
+	format_headers_sprinter (sp, GMIME_MESSAGE (node->part), false);
 
 	sp->map_key (sp, "body");
 	sp->begin_list (sp);
@@ -721,7 +721,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
     }
 
     for (i = 0; i < node->nchildren; i++)
-	format_part_sprinter (ctx, sp, mime_node_child (node, i), TRUE, include_html);
+	format_part_sprinter (ctx, sp, mime_node_child (node, i), true, include_html);
 
     /* Close content structures */
     for (i = 0; i < nclose; i++)
@@ -898,8 +898,8 @@ show_messages (void *ctx,
 	       notmuch_show_params_t *params)
 {
     notmuch_message_t *message;
-    notmuch_bool_t match;
-    notmuch_bool_t excluded;
+    bool match;
+    bool excluded;
     int next_indent;
     notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
 
@@ -1081,13 +1081,13 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
     sprinter_t *sprinter;
     notmuch_show_params_t params = {
 	.part = -1,
-	.omit_excluded = TRUE,
-	.output_body = TRUE,
+	.omit_excluded = true,
+	.output_body = true,
     };
     int format = NOTMUCH_FORMAT_NOT_SPECIFIED;
-    notmuch_bool_t exclude = TRUE;
-    notmuch_bool_t entire_thread_set = FALSE;
-    notmuch_bool_t single_message;
+    bool exclude = true;
+    bool entire_thread_set = false;
+    bool single_message;
 
     notmuch_opt_desc_t options[] = {
 	{ .opt_keyword = &format, .name = "format", .keywords =
@@ -1118,7 +1118,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
 
     /* decryption implies verification */
     if (params.crypto.decrypt)
-	params.crypto.verify = TRUE;
+	params.crypto.verify = true;
 
     /* specifying a part implies single message display */
     single_message = params.part >= 0;
@@ -1138,21 +1138,21 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
 	}
     } else if (format == NOTMUCH_FORMAT_RAW) {
 	/* raw format only supports single message display */
-	single_message = TRUE;
+	single_message = true;
     }
 
     notmuch_exit_if_unsupported_format ();
 
-    /* Default is entire-thread = FALSE except for format=json and
+    /* Default is entire-thread = false except for format=json and
      * format=sexp. */
     if (! entire_thread_set &&
 	(format == NOTMUCH_FORMAT_JSON || format == NOTMUCH_FORMAT_SEXP))
-	params.entire_thread = TRUE;
+	params.entire_thread = true;
 
     if (!params.output_body) {
 	if (params.part > 0) {
 	    fprintf (stderr, "Warning: --body=false is incompatible with --part > 0. Disabling.\n");
-	    params.output_body = TRUE;
+	    params.output_body = true;
 	} else {
 	    if (format != NOTMUCH_FORMAT_JSON && format != NOTMUCH_FORMAT_SEXP)
 		fprintf (stderr,
@@ -1222,9 +1222,9 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
 	    }
 	}
 
-	if (exclude == FALSE) {
-	    notmuch_query_set_omit_excluded (query, FALSE);
-	    params.omit_excluded = FALSE;
+	if (exclude == false) {
+	    notmuch_query_set_omit_excluded (query, false);
+	    params.omit_excluded = false;
 	}
 
 	ret = do_show (config, query, formatter, sprinter, &params);
diff --git a/notmuch-tag.c b/notmuch-tag.c
index 630efa65399c..05b1837d7c50 100644
--- a/notmuch-tag.c
+++ b/notmuch-tag.c
@@ -194,8 +194,8 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[])
     notmuch_database_t *notmuch;
     struct sigaction action;
     tag_op_flag_t tag_flags = TAG_FLAG_NONE;
-    notmuch_bool_t batch = FALSE;
-    notmuch_bool_t remove_all = FALSE;
+    bool batch = false;
+    bool remove_all = false;
     FILE *input = stdin;
     const char *input_file_name = NULL;
     int opt_index;
@@ -223,7 +223,7 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[])
     notmuch_process_shared_options (argv[0]);
 
     if (input_file_name) {
-	batch = TRUE;
+	batch = true;
 	input = fopen (input_file_name, "r");
 	if (input == NULL) {
 	    fprintf (stderr, "Error opening %s for reading: %s\n",
diff --git a/notmuch.c b/notmuch.c
index cc9c34aefb30..02148f2e3bf6 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -46,7 +46,7 @@ notmuch_command (notmuch_config_t *config, int argc, char *argv[]);
 static int
 _help_for (const char *topic);
 
-static notmuch_bool_t print_version = FALSE, print_help = FALSE;
+static bool print_version = false, print_help = false;
 const char *notmuch_requested_db_uuid = NULL;
 
 const notmuch_opt_desc_t notmuch_shared_options [] = {
@@ -371,13 +371,13 @@ notmuch_command (notmuch_config_t *config,
  * is).
  *
  * Does not return if the external command is found and
- * executed. Return TRUE if external command is not found. Return
- * FALSE on errors.
+ * executed. Return true if external command is not found. Return
+ * false on errors.
  */
-static notmuch_bool_t try_external_command(char *argv[])
+static bool try_external_command(char *argv[])
 {
     char *old_argv0 = argv[0];
-    notmuch_bool_t ret = TRUE;
+    bool ret = true;
 
     argv[0] = talloc_asprintf (NULL, "notmuch-%s", old_argv0);
 
@@ -389,7 +389,7 @@ static notmuch_bool_t try_external_command(char *argv[])
     if (errno != ENOENT) {
 	fprintf (stderr, "Error: Running external command '%s' failed: %s\n",
 		 argv[0], strerror(errno));
-	ret = FALSE;
+	ret = false;
     }
 
     talloc_free (argv[0]);
diff --git a/sprinter-json.c b/sprinter-json.c
index 0a077907cd83..c6ec857720d9 100644
--- a/sprinter-json.c
+++ b/sprinter-json.c
@@ -13,14 +13,14 @@ struct sprinter_json {
     /* A flag to signify that a separator should be inserted in the
      * output as soon as possible.
      */
-    notmuch_bool_t insert_separator;
+    bool insert_separator;
 };
 
 struct json_state {
     struct json_state *parent;
     /* True if nothing has been printed in this aggregate yet.
      * Suppresses the comma before a value. */
-    notmuch_bool_t first;
+    bool first;
     /* The character that closes the current aggregate. */
     char close;
 };
@@ -37,12 +37,12 @@ json_begin_value (struct sprinter *sp)
 	    fputc (',', spj->stream);
 	    if (spj->insert_separator) {
 		fputc ('\n', spj->stream);
-		spj->insert_separator = FALSE;
+		spj->insert_separator = false;
 	    } else {
 		fputc (' ', spj->stream);
 	    }
 	} else {
-	    spj->state->first = FALSE;
+	    spj->state->first = false;
 	}
     }
     return spj;
@@ -58,7 +58,7 @@ json_begin_aggregate (struct sprinter *sp, char open, char close)
 
     fputc (open, spj->stream);
     state->parent = spj->state;
-    state->first = TRUE;
+    state->first = true;
     state->close = close;
     spj->state = state;
 }
@@ -132,7 +132,7 @@ json_integer (struct sprinter *sp, int val)
 }
 
 static void
-json_boolean (struct sprinter *sp, notmuch_bool_t val)
+json_boolean (struct sprinter *sp, bool val)
 {
     struct sprinter_json *spj = json_begin_value (sp);
 
@@ -154,7 +154,7 @@ json_map_key (struct sprinter *sp, const char *key)
 
     json_string (sp, key);
     fputs (": ", spj->stream);
-    spj->state->first = TRUE;
+    spj->state->first = true;
 }
 
 static void
@@ -167,7 +167,7 @@ json_separator (struct sprinter *sp)
 {
     struct sprinter_json *spj = (struct sprinter_json *) sp;
 
-    spj->insert_separator = TRUE;
+    spj->insert_separator = true;
 }
 
 struct sprinter *
@@ -186,7 +186,7 @@ sprinter_json_create (const void *ctx, FILE *stream)
 	    .map_key = json_map_key,
 	    .separator = json_separator,
 	    .set_prefix = json_set_prefix,
-	    .is_text_printer = FALSE,
+	    .is_text_printer = false,
 	}
     };
     struct sprinter_json *res;
diff --git a/sprinter-sexp.c b/sprinter-sexp.c
index 08783e11d3bd..6891ea4254f8 100644
--- a/sprinter-sexp.c
+++ b/sprinter-sexp.c
@@ -33,7 +33,7 @@ struct sprinter_sexp {
 
     /* A flag to signify that a separator should be inserted in the
      * output as soon as possible. */
-    notmuch_bool_t insert_separator;
+    bool insert_separator;
 };
 
 struct sexp_state {
@@ -41,7 +41,7 @@ struct sexp_state {
 
     /* True if nothing has been printed in this aggregate yet.
      * Suppresses the space before a value. */
-    notmuch_bool_t first;
+    bool first;
 };
 
 /* Helper function to set up the stream to print a value.  If this
@@ -55,12 +55,12 @@ sexp_begin_value (struct sprinter *sp)
 	if (! sps->state->first) {
 	    if (sps->insert_separator) {
 		fputc ('\n', sps->stream);
-		sps->insert_separator = FALSE;
+		sps->insert_separator = false;
 	    } else {
 		fputc (' ', sps->stream);
 	    }
 	} else {
-	    sps->state->first = FALSE;
+	    sps->state->first = false;
 	}
     }
     return sps;
@@ -76,7 +76,7 @@ sexp_begin_aggregate (struct sprinter *sp)
 
     fputc ('(', sps->stream);
     state->parent = sps->state;
-    state->first = TRUE;
+    state->first = true;
     sps->state = state;
 }
 
@@ -169,7 +169,7 @@ sexp_integer (struct sprinter *sp, int val)
 }
 
 static void
-sexp_boolean (struct sprinter *sp, notmuch_bool_t val)
+sexp_boolean (struct sprinter *sp, bool val)
 {
     struct sprinter_sexp *sps = sexp_begin_value (sp);
 
@@ -202,7 +202,7 @@ sexp_separator (struct sprinter *sp)
 {
     struct sprinter_sexp *sps = (struct sprinter_sexp *) sp;
 
-    sps->insert_separator = TRUE;
+    sps->insert_separator = true;
 }
 
 struct sprinter *
@@ -221,7 +221,7 @@ sprinter_sexp_create (const void *ctx, FILE *stream)
 	    .map_key = sexp_map_key,
 	    .separator = sexp_separator,
 	    .set_prefix = sexp_set_prefix,
-	    .is_text_printer = FALSE,
+	    .is_text_printer = false,
 	}
     };
     struct sprinter_sexp *res;
diff --git a/sprinter-text.c b/sprinter-text.c
index 7779488f99a3..648b54b1e886 100644
--- a/sprinter-text.c
+++ b/sprinter-text.c
@@ -21,7 +21,7 @@ struct sprinter_text {
     /* A flag to indicate if this is the first tag. Used in list of tags
      * for summary.
      */
-    notmuch_bool_t first_tag;
+    bool first_tag;
 };
 
 static void
@@ -52,7 +52,7 @@ text_integer (struct sprinter *sp, int val)
 }
 
 static void
-text_boolean (struct sprinter *sp, notmuch_bool_t val)
+text_boolean (struct sprinter *sp, bool val)
 {
     struct sprinter_text *sptxt = (struct sprinter_text *) sp;
 
@@ -128,7 +128,7 @@ sprinter_text_create (const void *ctx, FILE *stream)
 	    .map_key = text_map_key,
 	    .separator = text_separator,
 	    .set_prefix = text_set_prefix,
-	    .is_text_printer = TRUE,
+	    .is_text_printer = true,
 	},
     };
     struct sprinter_text *res;
diff --git a/sprinter.h b/sprinter.h
index f859672f8b3f..9d2e9b6f7140 100644
--- a/sprinter.h
+++ b/sprinter.h
@@ -1,7 +1,7 @@
 #ifndef NOTMUCH_SPRINTER_H
 #define NOTMUCH_SPRINTER_H
 
-/* Necessary for notmuch_bool_t */
+/* Necessary for bool */
 #include "notmuch-client.h"
 
 /* Structure printer interface. This is used to create output
@@ -34,7 +34,7 @@ typedef struct sprinter {
     void (*string) (struct sprinter *, const char *);
     void (*string_len) (struct sprinter *, const char *, size_t);
     void (*integer) (struct sprinter *, int);
-    void (*boolean) (struct sprinter *, notmuch_bool_t);
+    void (*boolean) (struct sprinter *, bool);
     void (*null) (struct sprinter *);
 
     /* Print the key of a map's key/value pair. The char * must be UTF-8
@@ -58,7 +58,7 @@ typedef struct sprinter {
 
     /* True if this is the special-cased plain text printer.
      */
-    notmuch_bool_t is_text_printer;
+    bool is_text_printer;
 } sprinter_t;
 
 
diff --git a/tag-util.c b/tag-util.c
index d9fca7b832fd..1837b1aeafa3 100644
--- a/tag-util.c
+++ b/tag-util.c
@@ -7,7 +7,7 @@
 
 struct _tag_operation_t {
     const char *tag;
-    notmuch_bool_t remove;
+    bool remove;
 };
 
 struct _tag_op_list_t {
@@ -35,7 +35,7 @@ line_error (tag_parse_status_t status,
 }
 
 const char *
-illegal_tag (const char *tag, notmuch_bool_t remove)
+illegal_tag (const char *tag, bool remove)
 {
     if (*tag == '\0' && ! remove)
 	return "empty tag forbidden";
@@ -84,7 +84,7 @@ parse_tag_line (void *ctx, char *line,
 
     /* Parse tags. */
     while ((tok = strtok_len (tok + tok_len, " ", &tok_len)) != NULL) {
-	notmuch_bool_t remove;
+	bool remove;
 	char *tag;
 
 	/* Optional explicit end of tags marker. */
@@ -168,7 +168,7 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
 	if (argv[i][0] != '+' && argv[i][0] != '-')
 	    break;
 
-	notmuch_bool_t is_remove = argv[i][0] == '-';
+	bool is_remove = argv[i][0] == '-';
 	const char *msg;
 
 	msg = illegal_tag (argv[i] + 1, is_remove);
@@ -215,7 +215,7 @@ makes_changes (notmuch_message_t *message,
     size_t i;
 
     notmuch_tags_t *tags;
-    notmuch_bool_t changes = FALSE;
+    bool changes = false;
 
     /* First, do we delete an existing tag? */
     for (tags = notmuch_message_get_tags (message);
@@ -239,11 +239,11 @@ makes_changes (notmuch_message_t *message,
     notmuch_tags_destroy (tags);
 
     if (changes)
-	return TRUE;
+	return true;
 
     /* Now check for adding new tags */
     for (i = 0; i < list->count; i++) {
-	notmuch_bool_t exists = FALSE;
+	bool exists = false;
 
 	if (list->ops[i].remove)
 	    continue;
@@ -253,7 +253,7 @@ makes_changes (notmuch_message_t *message,
 	     notmuch_tags_move_to_next (tags)) {
 	    const char *cur_tag = notmuch_tags_get (tags);
 	    if (strcmp (cur_tag, list->ops[i].tag) == 0) {
-		exists = TRUE;
+		exists = true;
 		break;
 	    }
 	}
@@ -264,9 +264,9 @@ makes_changes (notmuch_message_t *message,
 	 * but this is OK from a correctness point of view
 	 */
 	if (! exists)
-	    return TRUE;
+	    return true;
     }
-    return FALSE;
+    return false;
 
 }
 
@@ -359,7 +359,7 @@ tag_op_list_create (void *ctx)
 int
 tag_op_list_append (tag_op_list_t *list,
 		    const char *tag,
-		    notmuch_bool_t remove)
+		    bool remove)
 {
     /* Make room if current array is full.  This should be a fairly
      * rare case, considering the initial array size.
@@ -387,7 +387,7 @@ tag_op_list_append (tag_op_list_t *list,
  *   Is the i'th tag operation a remove?
  */
 
-notmuch_bool_t
+bool
 tag_op_list_isremove (const tag_op_list_t *list, size_t i)
 {
     assert (i < list->count);
diff --git a/tag-util.h b/tag-util.h
index 8a4074ce168f..a2f0ddfaa280 100644
--- a/tag-util.h
+++ b/tag-util.h
@@ -99,7 +99,7 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
  *	   explanatory message otherwise.
  */
 const char *
-illegal_tag (const char *tag, notmuch_bool_t remove);
+illegal_tag (const char *tag, bool remove);
 
 /*
  * Create an empty list of tag operations
@@ -111,14 +111,14 @@ tag_op_list_t *
 tag_op_list_create (void *ctx);
 
 /*
- * Add a tag operation (delete iff remove == TRUE) to a list.
+ * Add a tag operation (delete iff remove == true) to a list.
  * The list is expanded as necessary.
  */
 
 int
 tag_op_list_append (tag_op_list_t *list,
 		    const char *tag,
-		    notmuch_bool_t remove);
+		    bool remove);
 
 /*
  * Apply a list of tag operations, in order, to a given message.
@@ -157,7 +157,7 @@ tag_op_list_tag (const tag_op_list_t *list, size_t i);
  *   Is the i'th tag operation a remove?
  */
 
-notmuch_bool_t
+bool
 tag_op_list_isremove (const tag_op_list_t *list, size_t i);
 
 #endif
diff --git a/test/arg-test.c b/test/arg-test.c
index 64751df4ada1..7aff825507a5 100644
--- a/test/arg-test.c
+++ b/test/arg-test.c
@@ -12,9 +12,9 @@ int main(int argc, char **argv){
     const char *pos_arg1=NULL;
     const char *pos_arg2=NULL;
     const char *string_val=NULL;
-    notmuch_bool_t bool_val = FALSE;
-    notmuch_bool_t fl_set = FALSE, int_set = FALSE, bool_set = FALSE,
-	kw_set = FALSE, string_set = FALSE, pos1_set = FALSE, pos2_set = FALSE;
+    bool bool_val = false;
+    bool fl_set = false, int_set = false, bool_set = false,
+	kw_set = false, string_set = false, pos1_set = false, pos2_set = false;
 
     notmuch_opt_desc_t parent_options[] = {
 	{ .opt_flags = &fl_val, .name = "flag", .present = &fl_set, .keywords =
diff --git a/test/hex-xcode.c b/test/hex-xcode.c
index 221ccdb90843..33046e9a5178 100644
--- a/test/hex-xcode.c
+++ b/test/hex-xcode.c
@@ -16,7 +16,7 @@ enum direction {
     DECODE
 };
 
-static int inplace = FALSE;
+static bool inplace = false;
 
 static int
 xcode (void *ctx, enum direction dir, char *in, char **buf_p, size_t *size_p)
@@ -45,7 +45,7 @@ main (int argc, char **argv)
 {
 
     int dir = DECODE;
-    notmuch_bool_t omit_newline = FALSE;
+    bool omit_newline = false;
 
     notmuch_opt_desc_t options[] = {
 	{ .opt_keyword = &dir, .name = "direction", .keywords =
@@ -71,7 +71,7 @@ main (int argc, char **argv)
     char *buffer = NULL;
     size_t buf_size = 0;
 
-    notmuch_bool_t read_stdin = TRUE;
+    bool read_stdin = true;
 
     for (; opt_index < argc; opt_index++) {
 
@@ -82,7 +82,7 @@ main (int argc, char **argv)
 	if (! omit_newline)
 	    putchar ('\n');
 
-	read_stdin = FALSE;
+	read_stdin = false;
     }
 
     if (! read_stdin)
diff --git a/test/random-corpus.c b/test/random-corpus.c
index e3b855e1efd8..9272afda8bed 100644
--- a/test/random-corpus.c
+++ b/test/random-corpus.c
@@ -179,7 +179,7 @@ main (int argc, char **argv)
 	exit (1);
     }
 
-    config = notmuch_config_open (ctx, config_path, FALSE);
+    config = notmuch_config_open (ctx, config_path, false);
     if (config == NULL)
 	return 1;
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] lib: convert notmuch_bool_t to stdbool internally
  2017-10-07  8:44 [PATCH 1/2] cli: convert notmuch_bool_t to stdbool Jani Nikula
@ 2017-10-07  8:44 ` Jani Nikula
  2017-10-10  1:43   ` David Bremner
  2017-10-07 17:05 ` [PATCH 1/2] cli: convert notmuch_bool_t to stdbool Tomi Ollila
  2017-10-09 22:24 ` Daniel Kahn Gillmor
  2 siblings, 1 reply; 5+ messages in thread
From: Jani Nikula @ 2017-10-07  8:44 UTC (permalink / raw)
  To: notmuch

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 &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 &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 &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 &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 == metadata->notmuch->xapian_db->metadata_keys_end ())
-	return FALSE;
+	return false;
 
-    return TRUE;
+    return true;
 }
 
 const char *
diff --git a/lib/database-private.h b/lib/database-private.h
index 5555554bf27c..a499b2594be4 100644
--- a/lib/database-private.h
+++ b/lib/database-private.h
@@ -179,14 +179,14 @@ operator&(notmuch_field_flag_t a, notmuch_field_flag_t b)
 				    Xapian::QueryParser::FLAG_PURE_NOT)
 
 struct _notmuch_database {
-    notmuch_bool_t exception_reported;
+    bool exception_reported;
 
     char *path;
 
     notmuch_database_mode_t mode;
     int atomic_nesting;
-    /* TRUE if changes have been made in this atomic section */
-    notmuch_bool_t atomic_dirty;
+    /* true if changes have been made in this atomic section */
+    bool atomic_dirty;
     Xapian::Database *xapian_db;
 
     /* Bit mask of features used by this database.  This is a
diff --git a/lib/database.cc b/lib/database.cc
index 79eb3d697734..35c66939bdcf 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -562,7 +562,7 @@ notmuch_database_find_message (notmuch_database_t *notmuch,
     } catch (const Xapian::Error &error) {
 	_notmuch_database_log (notmuch, "A Xapian exception occurred finding message: %s.\n",
 		 error.get_msg().c_str());
-	notmuch->exception_reported = TRUE;
+	notmuch->exception_reported = true;
 	*message_ret = NULL;
 	return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
     }
@@ -691,7 +691,7 @@ _notmuch_database_new_revision (notmuch_database_t *notmuch)
      * committed revision number until we commit the atomic section.
      */
     if (notmuch->atomic_nesting)
-	notmuch->atomic_dirty = TRUE;
+	notmuch->atomic_dirty = true;
     else
 	notmuch->revision = new_revision;
 
@@ -854,7 +854,7 @@ notmuch_database_open_verbose (const char *path,
     }
 
     notmuch = talloc_zero (NULL, notmuch_database_t);
-    notmuch->exception_reported = FALSE;
+    notmuch->exception_reported = false;
     notmuch->status_string = NULL;
     notmuch->path = talloc_strdup (notmuch, path);
 
@@ -1040,7 +1040,7 @@ _notmuch_database_reopen (notmuch_database_t *notmuch)
 	if (! notmuch->exception_reported) {
 	    _notmuch_database_log (notmuch, "Error: A Xapian exception reopening database: %s\n",
 				   error.get_msg ().c_str ());
-	    notmuch->exception_reported = TRUE;
+	    notmuch->exception_reported = true;
 	}
 	return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
     }
@@ -1118,7 +1118,7 @@ notmuch_database_compact (const char *path,
     notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
     notmuch_database_t *notmuch = NULL;
     struct stat statbuf;
-    notmuch_bool_t keep_backup;
+    bool keep_backup;
     char *message = NULL;
 
     local = talloc_new (NULL);
@@ -1154,10 +1154,10 @@ notmuch_database_compact (const char *path,
 	    ret = NOTMUCH_STATUS_OUT_OF_MEMORY;
 	    goto DONE;
 	}
-	keep_backup = FALSE;
+	keep_backup = false;
     }
     else {
-	keep_backup = TRUE;
+	keep_backup = true;
     }
 
     if (stat (backup_path, &statbuf) != -1) {
@@ -1313,7 +1313,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
     Xapian::WritableDatabase *db;
     struct sigaction action;
     struct itimerval timerval;
-    notmuch_bool_t timer_is_active = FALSE;
+    bool timer_is_active = false;
     enum _notmuch_features target_features, new_features;
     notmuch_status_t status;
     notmuch_private_status_t private_status;
@@ -1347,7 +1347,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
 	timerval.it_value.tv_usec = 0;
 	setitimer (ITIMER_REAL, &timerval, NULL);
 
-	timer_is_active = TRUE;
+	timer_is_active = true;
     }
 
     /* Figure out how much total work we need to do. */
@@ -1588,7 +1588,7 @@ notmuch_database_begin_atomic (notmuch_database_t *notmuch)
     } catch (const Xapian::Error &error) {
 	_notmuch_database_log (notmuch, "A Xapian exception occurred beginning transaction: %s.\n",
 		 error.get_msg().c_str());
-	notmuch->exception_reported = TRUE;
+	notmuch->exception_reported = true;
 	return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
     }
 
@@ -1622,13 +1622,13 @@ notmuch_database_end_atomic (notmuch_database_t *notmuch)
     } catch (const Xapian::Error &error) {
 	_notmuch_database_log (notmuch, "A Xapian exception occurred committing transaction: %s.\n",
 		 error.get_msg().c_str());
-	notmuch->exception_reported = TRUE;
+	notmuch->exception_reported = true;
 	return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
     }
 
     if (notmuch->atomic_dirty) {
 	++notmuch->revision;
-	notmuch->atomic_dirty = FALSE;
+	notmuch->atomic_dirty = false;
     }
 
 DONE:
@@ -1871,7 +1871,7 @@ notmuch_database_get_directory (notmuch_database_t *notmuch,
     } catch (const Xapian::Error &error) {
 	_notmuch_database_log (notmuch, "A Xapian exception occurred getting directory: %s.\n",
 		 error.get_msg().c_str());
-	notmuch->exception_reported = TRUE;
+	notmuch->exception_reported = true;
 	status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
     }
     return status;
@@ -1968,7 +1968,7 @@ notmuch_database_find_message_by_filename (notmuch_database_t *notmuch,
     } catch (const Xapian::Error &error) {
 	_notmuch_database_log (notmuch, "Error: A Xapian exception occurred finding message by filename: %s\n",
 		 error.get_msg().c_str());
-	notmuch->exception_reported = TRUE;
+	notmuch->exception_reported = true;
 	status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
     }
 
@@ -2021,7 +2021,7 @@ notmuch_database_get_all_tags (notmuch_database_t *db)
     } catch (const Xapian::Error &error) {
 	_notmuch_database_log (db, "A Xapian exception occurred getting tags: %s.\n",
 		 error.get_msg().c_str());
-	db->exception_reported = TRUE;
+	db->exception_reported = true;
 	return NULL;
     }
 }
diff --git a/lib/directory.cc b/lib/directory.cc
index 5de3319c47d1..4fcb017712f6 100644
--- a/lib/directory.cc
+++ b/lib/directory.cc
@@ -103,7 +103,7 @@ _notmuch_directory_create (notmuch_database_t *notmuch,
     notmuch_directory_t *directory;
     notmuch_private_status_t private_status;
     const char *db_path;
-    notmuch_bool_t create = (flags & NOTMUCH_FIND_CREATE);
+    bool create = (flags & NOTMUCH_FIND_CREATE);
 
     if (! (notmuch->features & NOTMUCH_FEATURE_DIRECTORY_DOCS)) {
 	*status_ret = NOTMUCH_STATUS_UPGRADE_REQUIRED;
@@ -189,7 +189,7 @@ _notmuch_directory_create (notmuch_database_t *notmuch,
 	_notmuch_database_log (notmuch,
 		 "A Xapian exception occurred creating a directory: %s.\n",
 		 error.get_msg().c_str());
-	notmuch->exception_reported = TRUE;
+	notmuch->exception_reported = true;
 	notmuch_directory_destroy (directory);
 	directory = NULL;
 	*status_ret = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
@@ -234,7 +234,7 @@ notmuch_directory_set_mtime (notmuch_directory_t *directory,
 	_notmuch_database_log (notmuch,
 		 "A Xapian exception occurred setting directory mtime: %s.\n",
 		 error.get_msg().c_str());
-	notmuch->exception_reported = TRUE;
+	notmuch->exception_reported = true;
 	return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
     }
 
@@ -301,7 +301,7 @@ notmuch_directory_delete (notmuch_directory_t *directory)
 	_notmuch_database_log (directory->notmuch,
 			       "A Xapian exception occurred deleting directory entry: %s.\n",
 			       error.get_msg().c_str());
-	directory->notmuch->exception_reported = TRUE;
+	directory->notmuch->exception_reported = true;
 	status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
     }
     notmuch_directory_destroy (directory);
diff --git a/lib/filenames.c b/lib/filenames.c
index 63e737dd4edc..37d631d6ff31 100644
--- a/lib/filenames.c
+++ b/lib/filenames.c
@@ -46,7 +46,7 @@ notmuch_bool_t
 notmuch_filenames_valid (notmuch_filenames_t *filenames)
 {
     if (filenames == NULL)
-	return FALSE;
+	return false;
 
     return (filenames->iterator != NULL);
 }
diff --git a/lib/index.cc b/lib/index.cc
index ceb444df60bf..e5ae2ba73d56 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -184,7 +184,7 @@ filter_filter (GMimeFilter *gmime_filter, char *inbuf, size_t inlen, size_t pres
 
     int next;
 
-    g_mime_filter_set_size (gmime_filter, inlen, FALSE);
+    g_mime_filter_set_size (gmime_filter, inlen, false);
     outptr = gmime_filter->outbuf;
 
     next = filter->state;
@@ -460,7 +460,7 @@ _index_mime_part (notmuch_message_t *message,
     byte_array = g_byte_array_new ();
 
     stream = g_mime_stream_mem_new_with_byte_array (byte_array);
-    g_mime_stream_mem_set_owner (GMIME_STREAM_MEM (stream), FALSE);
+    g_mime_stream_mem_set_owner (GMIME_STREAM_MEM (stream), false);
 
     filter = g_mime_stream_filter_new (stream);
 
@@ -493,7 +493,7 @@ _index_mime_part (notmuch_message_t *message,
     g_object_unref (discard_non_term_filter);
 
     g_byte_array_append (byte_array, (guint8 *) "\0", 1);
-    body = (char *) g_byte_array_free (byte_array, FALSE);
+    body = (char *) g_byte_array_free (byte_array, false);
 
     if (body) {
 	_notmuch_message_gen_terms (message, NULL, body);
diff --git a/lib/message-file.c b/lib/message-file.c
index b90df305b630..8f0dbbda8725 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -104,16 +104,16 @@ _notmuch_message_file_close (notmuch_message_file_t *message)
     talloc_free (message);
 }
 
-static notmuch_bool_t
+static bool
 _is_mbox (FILE *file)
 {
     char from_buf[5];
-    notmuch_bool_t ret = FALSE;
+    bool ret = false;
 
     /* Is this mbox? */
     if (fread (from_buf, sizeof (from_buf), 1, file) == 1 &&
 	strncmp (from_buf, "From ", 5) == 0)
-	ret = TRUE;
+	ret = true;
 
     rewind (file);
 
@@ -127,7 +127,7 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
     GMimeParser *parser;
     notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
     static int initialized = 0;
-    notmuch_bool_t is_mbox;
+    bool is_mbox;
 
     if (message->message)
 	return NOTMUCH_STATUS_SUCCESS;
@@ -147,7 +147,7 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
     stream = g_mime_stream_file_new (message->file);
 
     /* We'll own and fclose the FILE* ourselves. */
-    g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream), FALSE);
+    g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream), false);
 
     parser = g_mime_parser_new_with_stream (stream);
     g_mime_parser_set_scan_from (parser, is_mbox);
diff --git a/lib/message-private.h b/lib/message-private.h
index 74199256cc5d..73b080e4843b 100644
--- a/lib/message-private.h
+++ b/lib/message-private.h
@@ -4,7 +4,7 @@
 notmuch_string_map_t *
 _notmuch_message_property_map (notmuch_message_t *message);
 
-notmuch_bool_t
+bool
 _notmuch_message_frozen (notmuch_message_t *message);
 
 void
diff --git a/lib/message-property.cc b/lib/message-property.cc
index f32d555062d2..d72c74c34ebc 100644
--- a/lib/message-property.cc
+++ b/lib/message-property.cc
@@ -38,7 +38,7 @@ notmuch_message_get_property (notmuch_message_t *message, const char *key, const
 
 static notmuch_status_t
 _notmuch_message_modify_property (notmuch_message_t *message, const char *key, const char *value,
-				  notmuch_bool_t delete_it)
+				  bool delete_it)
 {
     notmuch_private_status_t private_status;
     notmuch_status_t status;
@@ -76,13 +76,13 @@ _notmuch_message_modify_property (notmuch_message_t *message, const char *key, c
 notmuch_status_t
 notmuch_message_add_property (notmuch_message_t *message, const char *key, const char *value)
 {
-    return _notmuch_message_modify_property (message, key, value, FALSE);
+    return _notmuch_message_modify_property (message, key, value, false);
 }
 
 notmuch_status_t
 notmuch_message_remove_property (notmuch_message_t *message, const char *key, const char *value)
 {
-    return _notmuch_message_modify_property (message, key, value, TRUE);
+    return _notmuch_message_modify_property (message, key, value, true);
 }
 
 notmuch_status_t
diff --git a/lib/message.cc b/lib/message.cc
index 0e3b5a4f1510..4ab0ed269fd0 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -48,7 +48,7 @@ struct _notmuch_message {
     unsigned long lazy_flags;
 
     /* Message document modified since last sync */
-    notmuch_bool_t modified;
+    bool modified;
 
     /* last view of database the struct is synced with */
     unsigned long last_view;
@@ -62,16 +62,16 @@ struct _notmuch_message {
 struct maildir_flag_tag {
     char flag;
     const char *tag;
-    notmuch_bool_t inverse;
+    bool inverse;
 };
 
 /* ASCII ordered table of Maildir flags and associated tags */
 static struct maildir_flag_tag flag2tag[] = {
-    { 'D', "draft",   FALSE},
-    { 'F', "flagged", FALSE},
-    { 'P', "passed",  FALSE},
-    { 'R', "replied", FALSE},
-    { 'S', "unread",  TRUE }
+    { 'D', "draft",   false},
+    { 'F', "flagged", false},
+    { 'P', "passed",  false},
+    { 'R', "replied", false},
+    { 'S', "unread",  true }
 };
 
 /* We end up having to call the destructor explicitly because we had
@@ -270,7 +270,7 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch,
     } catch (const Xapian::Error &error) {
 	_notmuch_database_log(_notmuch_message_database (message), "A Xapian exception occurred creating message: %s\n",
 		 error.get_msg().c_str());
-	notmuch->exception_reported = TRUE;
+	notmuch->exception_reported = true;
 	*status_ret = NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION;
 	return NULL;
     }
@@ -527,7 +527,7 @@ notmuch_message_get_header (notmuch_message_t *message, const char *header)
 	} catch (Xapian::Error &error) {
 	    _notmuch_database_log(_notmuch_message_database (message), "A Xapian exception occurred when reading header: %s\n",
 		     error.get_msg().c_str());
-	    message->notmuch->exception_reported = TRUE;
+	    message->notmuch->exception_reported = true;
 	    return NULL;
 	}
     }
@@ -596,7 +596,7 @@ _notmuch_message_remove_terms (notmuch_message_t *message, const char *prefix)
 
 	try {
 	    message->doc.remove_term ((*i));
-	    message->modified = TRUE;
+	    message->modified = true;
 	} catch (const Xapian::InvalidArgumentError) {
 	    /* Ignore failure to remove non-existent term. */
 	}
@@ -639,7 +639,7 @@ _notmuch_message_remove_indexed_terms (notmuch_message_t *message)
 
 	try {
 	    message->doc.remove_term ((*i));
-	    message->modified = TRUE;
+	    message->modified = true;
 	} catch (const Xapian::InvalidArgumentError) {
 	    /* Ignore failure to remove non-existent term. */
 	} catch (const Xapian::Error &error) {
@@ -648,7 +648,7 @@ _notmuch_message_remove_indexed_terms (notmuch_message_t *message)
 	    if (!notmuch->exception_reported) {
 		_notmuch_database_log(_notmuch_message_database (message), "A Xapian exception occurred creating message: %s\n",
 				      error.get_msg().c_str());
-		notmuch->exception_reported = TRUE;
+		notmuch->exception_reported = true;
 	    }
 	    return NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION;
 	}
@@ -703,7 +703,7 @@ _notmuch_message_add_folder_terms (notmuch_message_t *message,
 
     talloc_free (folder);
 
-    message->modified = TRUE;
+    message->modified = true;
     return NOTMUCH_STATUS_SUCCESS;
 }
 
@@ -905,7 +905,7 @@ void
 _notmuch_message_clear_data (notmuch_message_t *message)
 {
     message->doc.set_data ("");
-    message->modified = TRUE;
+    message->modified = true;
 }
 
 static void
@@ -1044,7 +1044,7 @@ notmuch_message_get_date (notmuch_message_t *message)
     } catch (Xapian::Error &error) {
 	_notmuch_database_log(_notmuch_message_database (message), "A Xapian exception occurred when reading date: %s\n",
 		 error.get_msg().c_str());
-	message->notmuch->exception_reported = TRUE;
+	message->notmuch->exception_reported = true;
 	return 0;
     }
 
@@ -1115,7 +1115,7 @@ _notmuch_message_set_header_values (notmuch_message_t *message,
 			    Xapian::sortable_serialise (time_value));
     message->doc.add_value (NOTMUCH_VALUE_FROM, from);
     message->doc.add_value (NOTMUCH_VALUE_SUBJECT, subject);
-    message->modified = TRUE;
+    message->modified = true;
 }
 
 /* Upgrade a message to support NOTMUCH_FEATURE_LAST_MOD.  The caller
@@ -1125,7 +1125,7 @@ _notmuch_message_upgrade_last_mod (notmuch_message_t *message)
 {
     /* _notmuch_message_sync will update the last modification
      * revision; we just have to ask it to. */
-    message->modified = TRUE;
+    message->modified = true;
 }
 
 /* Synchronize changes made to message->doc out into the database. */
@@ -1154,7 +1154,7 @@ _notmuch_message_sync (notmuch_message_t *message)
 
     db = static_cast <Xapian::WritableDatabase *> (message->notmuch->xapian_db);
     db->replace_document (message->doc_id, message->doc);
-    message->modified = FALSE;
+    message->modified = false;
 }
 
 /* Delete a message document from the database, leaving a ghost
@@ -1170,7 +1170,7 @@ _notmuch_message_delete (notmuch_message_t *message)
     notmuch_database_t *notmuch;
     notmuch_query_t *query;
     unsigned int count = 0;
-    notmuch_bool_t is_ghost;
+    bool is_ghost;
 
     mid = notmuch_message_get_message_id (message);
     tid = notmuch_message_get_thread_id (message);
@@ -1299,7 +1299,7 @@ _notmuch_message_add_term (notmuch_message_t *message,
 	return NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG;
 
     message->doc.add_term (term, 0);
-    message->modified = TRUE;
+    message->modified = true;
 
     talloc_free (term);
 
@@ -1368,7 +1368,7 @@ _notmuch_message_remove_term (notmuch_message_t *message,
 
     try {
 	message->doc.remove_term (term);
-	message->modified = TRUE;
+	message->modified = true;
     } catch (const Xapian::InvalidArgumentError) {
 	/* We'll let the philosophers try to wrestle with the
 	 * question of whether failing to remove that which was not
@@ -1387,10 +1387,10 @@ notmuch_private_status_t
 _notmuch_message_has_term (notmuch_message_t *message,
 			   const char *prefix_name,
 			   const char *value,
-			   notmuch_bool_t *result)
+			   bool *result)
 {
     char *term;
-    notmuch_bool_t out = FALSE;
+    bool out = false;
     notmuch_private_status_t status = NOTMUCH_PRIVATE_STATUS_SUCCESS;
 
     if (value == NULL)
@@ -1408,7 +1408,7 @@ _notmuch_message_has_term (notmuch_message_t *message,
 	i.skip_to (term);
 	if (i != message->doc.termlist_end () &&
 	    !strcmp ((*i).c_str (), term))
-	    out = TRUE;
+	    out = true;
     } catch (Xapian::Error &error) {
 	status = NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION;
     }
@@ -1516,7 +1516,7 @@ _filename_is_in_maildir (const char *filename)
 }
 
 static void
-_ensure_maildir_flags (notmuch_message_t *message, notmuch_bool_t force)
+_ensure_maildir_flags (notmuch_message_t *message, bool force)
 {
     const char *flags;
     notmuch_filenames_t *filenames;
@@ -1563,7 +1563,7 @@ _ensure_maildir_flags (notmuch_message_t *message, notmuch_bool_t force)
 notmuch_bool_t
 notmuch_message_has_maildir_flag (notmuch_message_t *message, char flag)
 {
-    _ensure_maildir_flags (message, FALSE);
+    _ensure_maildir_flags (message, false);
     return message->maildir_flags && (strchr (message->maildir_flags, flag) != NULL);
 }
 
@@ -1573,7 +1573,7 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)
     notmuch_status_t status;
     unsigned i;
 
-    _ensure_maildir_flags (message, TRUE);
+    _ensure_maildir_flags (message, true);
     /* If none of the filenames have any maildir info field (not even
      * an empty info with no flags set) then there's no information to
      * go on, so do nothing. */
@@ -1685,7 +1685,7 @@ _new_maildir_filename (void *ctx,
     char *filename_new, *dir;
     char flag_map[128];
     int flags_in_map = 0;
-    notmuch_bool_t flags_changed = FALSE;
+    bool flags_changed = false;
     unsigned int i;
     char *s;
 
@@ -1726,7 +1726,7 @@ _new_maildir_filename (void *ctx,
 	if (flag_map[flag] == 0) {
 	    flag_map[flag] = 1;
 	    flags_in_map++;
-	    flags_changed = TRUE;
+	    flags_changed = true;
 	}
     }
 
@@ -1735,7 +1735,7 @@ _new_maildir_filename (void *ctx,
 	if (flag_map[flag]) {
 	    flag_map[flag] = 0;
 	    flags_in_map--;
-	    flags_changed = TRUE;
+	    flags_changed = true;
 	}
     }
 
@@ -1953,7 +1953,7 @@ _notmuch_message_property_map (notmuch_message_t *message)
     return message->property_map;
 }
 
-notmuch_bool_t
+bool
 _notmuch_message_frozen (notmuch_message_t *message)
 {
     return message->frozen;
diff --git a/lib/messages.c b/lib/messages.c
index b5363bb8f675..a88f974ff594 100644
--- a/lib/messages.c
+++ b/lib/messages.c
@@ -68,7 +68,7 @@ _notmuch_messages_create (notmuch_message_list_t *list)
     if (unlikely (messages == NULL))
 	return NULL;
 
-    messages->is_of_list_type = TRUE;
+    messages->is_of_list_type = true;
     messages->iterator = list->head;
 
     return messages;
@@ -93,7 +93,7 @@ notmuch_bool_t
 notmuch_messages_valid (notmuch_messages_t *messages)
 {
     if (messages == NULL)
-	return FALSE;
+	return false;
 
     if (! messages->is_of_list_type)
 	return _notmuch_mset_messages_valid (messages);
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index b187a80ff197..e86f45825fa3 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -24,6 +24,7 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE /* For getline and asprintf */
 #endif
+#include <stdbool.h>
 #include <stdio.h>
 
 #include "compat.h"
@@ -282,7 +283,7 @@ notmuch_private_status_t
 _notmuch_message_has_term (notmuch_message_t *message,
 			   const char *prefix_name,
 			   const char *value,
-			   notmuch_bool_t *result);
+			   bool *result);
 
 notmuch_private_status_t
 _notmuch_message_gen_terms (notmuch_message_t *message,
@@ -465,7 +466,7 @@ typedef struct _notmuch_message_list {
  * ignorance of that here. (See notmuch_mset_messages_t in query.cc)
  */
 struct _notmuch_messages {
-    notmuch_bool_t is_of_list_type;
+    bool is_of_list_type;
     notmuch_doc_id_set_t *excluded_doc_ids;
     notmuch_message_node_t *iterator;
 };
@@ -482,7 +483,7 @@ _notmuch_messages_create (notmuch_message_list_t *list);
 
 /* query.cc */
 
-notmuch_bool_t
+bool
 _notmuch_mset_messages_valid (notmuch_messages_t *messages);
 
 notmuch_message_t *
@@ -491,7 +492,7 @@ _notmuch_mset_messages_get (notmuch_messages_t *messages);
 void
 _notmuch_mset_messages_move_to_next (notmuch_messages_t *messages);
 
-notmuch_bool_t
+bool
 _notmuch_doc_id_set_contains (notmuch_doc_id_set_t *doc_ids,
 			      unsigned int doc_id);
 
@@ -591,9 +592,9 @@ _notmuch_string_map_get (notmuch_string_map_t *map, const char *key);
 
 notmuch_string_map_iterator_t *
 _notmuch_string_map_iterator_create (notmuch_string_map_t *map, const char *key,
-				     notmuch_bool_t exact);
+				     bool exact);
 
-notmuch_bool_t
+bool
 _notmuch_string_map_iterator_valid (notmuch_string_map_iterator_t *iter);
 
 void
diff --git a/lib/query.cc b/lib/query.cc
index 9c6ecc8db5ce..d633fa3d908a 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -29,7 +29,7 @@ struct _notmuch_query {
     notmuch_sort_t sort;
     notmuch_string_list_t *exclude_terms;
     notmuch_exclude_t omit_excluded;
-    notmuch_bool_t parsed;
+    bool parsed;
     Xapian::Query xapian_query;
     std::set<std::string> terms;
 };
@@ -62,12 +62,12 @@ struct _notmuch_threads {
 };
 
 /* We need this in the message functions so forward declare. */
-static notmuch_bool_t
+static bool
 _notmuch_doc_id_set_init (void *ctx,
 			  notmuch_doc_id_set_t *doc_ids,
 			  GArray *arr);
 
-static notmuch_bool_t
+static bool
 _debug_query (void)
 {
     char *env = getenv ("NOTMUCH_DEBUG_QUERY");
@@ -97,7 +97,7 @@ notmuch_query_create (notmuch_database_t *notmuch,
 
     new (&query->xapian_query) Xapian::Query ();
     new (&query->terms) std::set<std::string> ();
-    query->parsed = FALSE;
+    query->parsed = false;
 
     talloc_set_destructor (query, _notmuch_query_destructor);
 
@@ -134,7 +134,7 @@ _notmuch_query_ensure_parsed (notmuch_query_t *query)
 	     t != query->xapian_query.get_terms_end (); ++t)
 	    query->terms.insert (*t);
 
-	query->parsed = TRUE;
+	query->parsed = true;
 
     } catch (const Xapian::Error &error) {
 	if (!query->notmuch->exception_reported) {
@@ -144,7 +144,7 @@ _notmuch_query_ensure_parsed (notmuch_query_t *query)
 	    _notmuch_database_log_append (query->notmuch,
 					  "Query string was: %s\n",
 					  query->query_string);
-	    query->notmuch->exception_reported = TRUE;
+	    query->notmuch->exception_reported = true;
 	}
 
 	return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
@@ -261,7 +261,7 @@ _notmuch_query_search_documents (notmuch_query_t *query,
 
     try {
 
-	messages->base.is_of_list_type = FALSE;
+	messages->base.is_of_list_type = false;
 	messages->base.iterator = NULL;
 	messages->notmuch = notmuch;
 	new (&messages->iterator) Xapian::MSetIterator ();
@@ -304,7 +304,7 @@ _notmuch_query_search_documents (notmuch_query_t *query,
 
 		mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount ());
 
-		GArray *excluded_doc_ids = g_array_new (FALSE, FALSE, sizeof (unsigned int));
+		GArray *excluded_doc_ids = g_array_new (false, false, sizeof (unsigned int));
 
 		for (iterator = mset.begin (); iterator != mset.end (); iterator++) {
 		    unsigned int doc_id = *iterator;
@@ -322,13 +322,13 @@ _notmuch_query_search_documents (notmuch_query_t *query,
 
 	switch (query->sort) {
 	case NOTMUCH_SORT_OLDEST_FIRST:
-	    enquire.set_sort_by_value (NOTMUCH_VALUE_TIMESTAMP, FALSE);
+	    enquire.set_sort_by_value (NOTMUCH_VALUE_TIMESTAMP, false);
 	    break;
 	case NOTMUCH_SORT_NEWEST_FIRST:
-	    enquire.set_sort_by_value (NOTMUCH_VALUE_TIMESTAMP, TRUE);
+	    enquire.set_sort_by_value (NOTMUCH_VALUE_TIMESTAMP, true);
 	    break;
 	case NOTMUCH_SORT_MESSAGE_ID:
-	    enquire.set_sort_by_value (NOTMUCH_VALUE_MESSAGE_ID, FALSE);
+	    enquire.set_sort_by_value (NOTMUCH_VALUE_MESSAGE_ID, false);
 	    break;
 	case NOTMUCH_SORT_UNSORTED:
 	    break;
@@ -359,13 +359,13 @@ _notmuch_query_search_documents (notmuch_query_t *query,
 			       "Query string was: %s\n",
 			       query->query_string);
 
-	notmuch->exception_reported = TRUE;
+	notmuch->exception_reported = true;
 	talloc_free (messages);
 	return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
     }
 }
 
-notmuch_bool_t
+bool
 _notmuch_mset_messages_valid (notmuch_messages_t *messages)
 {
     notmuch_mset_messages_t *mset_messages;
@@ -415,7 +415,7 @@ _notmuch_mset_messages_get (notmuch_messages_t *messages)
 
     if (messages->excluded_doc_ids &&
 	_notmuch_doc_id_set_contains (messages->excluded_doc_ids, doc_id))
-	notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, TRUE);
+	notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, true);
 
     return message;
 }
@@ -430,7 +430,7 @@ _notmuch_mset_messages_move_to_next (notmuch_messages_t *messages)
     mset_messages->iterator++;
 }
 
-static notmuch_bool_t
+static bool
 _notmuch_doc_id_set_init (void *ctx,
 			  notmuch_doc_id_set_t *doc_ids,
 			  GArray *arr)
@@ -443,7 +443,7 @@ _notmuch_doc_id_set_init (void *ctx,
     bitmap = talloc_zero_array (ctx, unsigned char, DOCIDSET_WORD(max) + 1);
 
     if (bitmap == NULL)
-	return FALSE;
+	return false;
 
     doc_ids->bitmap = bitmap;
     doc_ids->bound = max + 1;
@@ -453,15 +453,15 @@ _notmuch_doc_id_set_init (void *ctx,
 	bitmap[DOCIDSET_WORD(doc_id)] |= 1 << DOCIDSET_BIT(doc_id);
     }
 
-    return TRUE;
+    return true;
 }
 
-notmuch_bool_t
+bool
 _notmuch_doc_id_set_contains (notmuch_doc_id_set_t *doc_ids,
 			      unsigned int doc_id)
 {
     if (doc_id >= doc_ids->bound)
-	return FALSE;
+	return false;
     return doc_ids->bitmap[DOCIDSET_WORD(doc_id)] & (1 << DOCIDSET_BIT(doc_id));
 }
 
@@ -514,7 +514,7 @@ notmuch_query_search_threads (notmuch_query_t *query,
 	return status;
     }
 
-    threads->doc_ids = g_array_new (FALSE, FALSE, sizeof (unsigned int));
+    threads->doc_ids = g_array_new (false, false, sizeof (unsigned int));
     while (notmuch_messages_valid (messages)) {
 	unsigned int doc_id = _notmuch_mset_messages_get_doc_id (messages);
 	g_array_append_val (threads->doc_ids, doc_id);
@@ -546,7 +546,7 @@ notmuch_threads_valid (notmuch_threads_t *threads)
     unsigned int doc_id;
 
     if (! threads)
-	return FALSE;
+	return false;
 
     while (threads->doc_id_pos < threads->doc_ids->len) {
 	doc_id = g_array_index (threads->doc_ids, unsigned int,
diff --git a/lib/string-map.c b/lib/string-map.c
index 0bb77e93aaec..5aac8bcc8a89 100644
--- a/lib/string-map.c
+++ b/lib/string-map.c
@@ -33,14 +33,14 @@ typedef struct _notmuch_string_pair_t {
 } notmuch_string_pair_t;
 
 struct _notmuch_string_map {
-    notmuch_bool_t sorted;
+    bool sorted;
     size_t length;
     notmuch_string_pair_t *pairs;
 };
 
 struct _notmuch_string_map_iterator {
     notmuch_string_pair_t *current;
-    notmuch_bool_t exact;
+    bool exact;
     const char *key;
 };
 
@@ -55,7 +55,7 @@ _notmuch_string_map_create (const void *ctx)
 
     map->length = 0;
     map->pairs = NULL;
-    map->sorted = TRUE;
+    map->sorted = true;
 
     return map;
 }
@@ -67,7 +67,7 @@ _notmuch_string_map_append (notmuch_string_map_t *map,
 {
 
     map->length++;
-    map->sorted = FALSE;
+    map->sorted = false;
 
     if (map->pairs)
 	map->pairs = talloc_realloc (map, map->pairs, notmuch_string_pair_t, map->length + 1);
@@ -103,11 +103,11 @@ _notmuch_string_map_sort (notmuch_string_map_t *map)
 
     qsort (map->pairs, map->length, sizeof (notmuch_string_pair_t), cmppair);
 
-    map->sorted = TRUE;
+    map->sorted = true;
 }
 
-static notmuch_bool_t
-string_cmp (const char *a, const char *b, notmuch_bool_t exact)
+static bool
+string_cmp (const char *a, const char *b, bool exact)
 {
     if (exact)
 	return (strcmp (a, b));
@@ -116,7 +116,7 @@ string_cmp (const char *a, const char *b, notmuch_bool_t exact)
 }
 
 static notmuch_string_pair_t *
-bsearch_first (notmuch_string_pair_t *array, size_t len, const char *key, notmuch_bool_t exact)
+bsearch_first (notmuch_string_pair_t *array, size_t len, const char *key, bool exact)
 {
     size_t first = 0;
     size_t last = len - 1;
@@ -151,7 +151,7 @@ _notmuch_string_map_get (notmuch_string_map_t *map, const char *key)
     /* this means that calling append invalidates iterators */
     _notmuch_string_map_sort (map);
 
-    pair = bsearch_first (map->pairs, map->length, key, TRUE);
+    pair = bsearch_first (map->pairs, map->length, key, true);
     if (! pair)
 	return NULL;
 
@@ -160,7 +160,7 @@ _notmuch_string_map_get (notmuch_string_map_t *map, const char *key)
 
 notmuch_string_map_iterator_t *
 _notmuch_string_map_iterator_create (notmuch_string_map_t *map, const char *key,
-				     notmuch_bool_t exact)
+				     bool exact)
 {
     notmuch_string_map_iterator_t *iter;
 
@@ -179,15 +179,15 @@ _notmuch_string_map_iterator_create (notmuch_string_map_t *map, const char *key,
     return iter;
 }
 
-notmuch_bool_t
+bool
 _notmuch_string_map_iterator_valid (notmuch_string_map_iterator_t *iterator)
 {
     if (iterator->current == NULL)
-	return FALSE;
+	return false;
 
     /* sentinel */
     if (iterator->current->key == NULL)
-	return FALSE;
+	return false;
 
     return (0 == string_cmp (iterator->key, iterator->current->key, iterator->exact));
 
diff --git a/lib/thread.cc b/lib/thread.cc
index e17ef63ef48e..1632da4cd0f4 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -59,12 +59,12 @@ _notmuch_thread_destructor (notmuch_thread_t *thread)
     g_hash_table_unref (thread->message_hash);
 
     if (thread->authors_array) {
-	g_ptr_array_free (thread->authors_array, TRUE);
+	g_ptr_array_free (thread->authors_array, true);
 	thread->authors_array = NULL;
     }
 
     if (thread->matched_authors_array) {
-	g_ptr_array_free (thread->matched_authors_array, TRUE);
+	g_ptr_array_free (thread->matched_authors_array, true);
 	thread->matched_authors_array = NULL;
     }
 
@@ -156,9 +156,9 @@ _resolve_thread_authors_string (notmuch_thread_t *thread)
 	first_non_matched_author = 0;
     }
 
-    g_ptr_array_free (thread->authors_array, TRUE);
+    g_ptr_array_free (thread->authors_array, true);
     thread->authors_array = NULL;
-    g_ptr_array_free (thread->matched_authors_array, TRUE);
+    g_ptr_array_free (thread->matched_authors_array, true);
     thread->matched_authors_array = NULL;
 }
 
@@ -239,7 +239,7 @@ _thread_add_message (notmuch_thread_t *thread,
     InternetAddress *address;
     const char *from, *author;
     char *clean_author;
-    notmuch_bool_t message_excluded = FALSE;
+    bool message_excluded = false;
 
     if (omit_exclude != NOTMUCH_EXCLUDE_FALSE) {
 	for (tags = notmuch_message_get_tags (message);
@@ -254,7 +254,7 @@ _thread_add_message (notmuch_thread_t *thread,
 	    {
 		/* Check for an empty string, and then ignore initial 'K'. */
 		if (*(term->string) && strcmp(tag, (term->string + 1)) == 0) {
-		    message_excluded = TRUE;
+		    message_excluded = true;
 		    break;
 		}
 	    }
@@ -310,7 +310,7 @@ _thread_add_message (notmuch_thread_t *thread,
 
     /* Mark excluded messages. */
     if (message_excluded)
-	notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, TRUE);
+	notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, true);
 }
 
 static void
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] cli: convert notmuch_bool_t to stdbool
  2017-10-07  8:44 [PATCH 1/2] cli: convert notmuch_bool_t to stdbool Jani Nikula
  2017-10-07  8:44 ` [PATCH 2/2] lib: convert notmuch_bool_t to stdbool internally Jani Nikula
@ 2017-10-07 17:05 ` Tomi Ollila
  2017-10-09 22:24 ` Daniel Kahn Gillmor
  2 siblings, 0 replies; 5+ messages in thread
From: Tomi Ollila @ 2017-10-07 17:05 UTC (permalink / raw)
  To: Jani Nikula, notmuch

On Sat, Oct 07 2017, Jani Nikula wrote:

> 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 cli and test binaries to stdbool.

+2 (i.e. +1 for both patches). I trust the changes works...

> ---
>  command-line-arguments.c | 58 +++++++++++++++++++--------------------
>  command-line-arguments.h | 10 ++++---
>  crypto.c                 |  6 ++---
>  debugger.c               |  8 +++---
>  gmime-filter-reply.c     | 32 +++++++++++-----------
>  mime-node.c              | 10 +++----
>  notmuch-client.h         | 35 ++++++++++++------------
>  notmuch-compact.c        |  2 +-
>  notmuch-config.c         | 28 +++++++++----------
>  notmuch-count.c          | 18 ++++++-------
>  notmuch-dump.c           | 10 +++----
>  notmuch-insert.c         | 70 ++++++++++++++++++++++++------------------------
>  notmuch-new.c            | 30 ++++++++++-----------
>  notmuch-reply.c          | 30 ++++++++++-----------
>  notmuch-restore.c        |  4 +--
>  notmuch-search.c         | 24 ++++++++---------
>  notmuch-setup.c          |  6 ++---
>  notmuch-show.c           | 52 +++++++++++++++++------------------
>  notmuch-tag.c            |  6 ++---
>  notmuch.c                | 12 ++++-----
>  sprinter-json.c          | 18 ++++++-------
>  sprinter-sexp.c          | 16 +++++------
>  sprinter-text.c          |  6 ++---
>  sprinter.h               |  6 ++---
>  tag-util.c               | 24 ++++++++---------
>  tag-util.h               |  8 +++---
>  test/arg-test.c          |  6 ++---
>  test/hex-xcode.c         |  8 +++---
>  test/random-corpus.c     |  2 +-
>  29 files changed, 275 insertions(+), 270 deletions(-)
>
> diff --git a/command-line-arguments.c b/command-line-arguments.c
> index 3fa8d9044966..1ff5aae578c6 100644
> --- a/command-line-arguments.c
> +++ b/command-line-arguments.c
> @@ -6,11 +6,11 @@
>  
>  /*
>    Search the array of keywords for a given argument, assigning the
> -  output variable to the corresponding value.  Return FALSE if nothing
> +  output variable to the corresponding value.  Return false if nothing
>    matches.
>  */
>  
> -static notmuch_bool_t
> +static bool
>  _process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
>  
>      const notmuch_keyword_t *keywords;
> @@ -29,64 +29,64 @@ _process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next, const char
>  	else
>  	    *arg_desc->opt_keyword = keywords->value;
>  
> -	return TRUE;
> +	return true;
>      }
>      if (next != '\0')
>  	fprintf (stderr, "Unknown keyword argument \"%s\" for option \"%s\".\n", arg_str, arg_desc->name);
>      else
>  	fprintf (stderr, "Option \"%s\" needs a keyword argument.\n", arg_desc->name);
> -    return FALSE;
> +    return false;
>  }
>  
> -static notmuch_bool_t
> +static bool
>  _process_boolean_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
> -    notmuch_bool_t value;
> +    bool value;
>  
>      if (next == '\0' || strcmp (arg_str, "true") == 0) {
> -	value = TRUE;
> +	value = true;
>      } else if (strcmp (arg_str, "false") == 0) {
> -	value = FALSE;
> +	value = false;
>      } else {
>  	fprintf (stderr, "Unknown argument \"%s\" for (boolean) option \"%s\".\n", arg_str, arg_desc->name);
> -	return FALSE;
> +	return false;
>      }
>  
>      *arg_desc->opt_bool = value;
>  
> -    return TRUE;
> +    return true;
>  }
>  
> -static notmuch_bool_t
> +static bool
>  _process_int_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
>  
>      char *endptr;
>      if (next == '\0' || arg_str[0] == '\0') {
>  	fprintf (stderr, "Option \"%s\" needs an integer argument.\n", arg_desc->name);
> -	return FALSE;
> +	return false;
>      }
>  
>      *arg_desc->opt_int = strtol (arg_str, &endptr, 10);
>      if (*endptr == '\0')
> -	return TRUE;
> +	return true;
>  
>      fprintf (stderr, "Unable to parse argument \"%s\" for option \"%s\" as an integer.\n",
>  	     arg_str, arg_desc->name);
> -    return FALSE;
> +    return false;
>  }
>  
> -static notmuch_bool_t
> +static bool
>  _process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
>  
>      if (next == '\0') {
>  	fprintf (stderr, "Option \"%s\" needs a string argument.\n", arg_desc->name);
> -	return FALSE;
> +	return false;
>      }
>      if (arg_str[0] == '\0') {
>  	fprintf (stderr, "String argument for option \"%s\" must be non-empty.\n", arg_desc->name);
> -	return FALSE;
> +	return false;
>      }
>      *arg_desc->opt_string = arg_str;
> -    return TRUE;
> +    return true;
>  }
>  
>  /* Return number of non-NULL opt_* fields in opt_desc. */
> @@ -102,8 +102,8 @@ static int _opt_set_count (const notmuch_opt_desc_t *opt_desc)
>  	!!opt_desc->opt_position;
>  }
>  
> -/* Return TRUE if opt_desc is valid. */
> -static notmuch_bool_t _opt_valid (const notmuch_opt_desc_t *opt_desc)
> +/* Return true if opt_desc is valid. */
> +static bool _opt_valid (const notmuch_opt_desc_t *opt_desc)
>  {
>      int n = _opt_set_count (opt_desc);
>  
> @@ -115,11 +115,11 @@ static notmuch_bool_t _opt_valid (const notmuch_opt_desc_t *opt_desc)
>  }
>  
>  /*
> -   Search for the {pos_arg_index}th position argument, return FALSE if
> +   Search for the {pos_arg_index}th position argument, return false if
>     that does not exist.
>  */
>  
> -notmuch_bool_t
> +bool
>  parse_position_arg (const char *arg_str, int pos_arg_index,
>  		    const notmuch_opt_desc_t *arg_desc) {
>  
> @@ -129,14 +129,14 @@ parse_position_arg (const char *arg_str, int pos_arg_index,
>  	    if (pos_arg_counter == pos_arg_index) {
>  		*arg_desc->opt_position = arg_str;
>  		if (arg_desc->present)
> -		    *arg_desc->present = TRUE;
> -		return TRUE;
> +		    *arg_desc->present = true;
> +		return true;
>  	    }
>  	    pos_arg_counter++;
>  	}
>  	arg_desc++;
>      }
> -    return FALSE;
> +    return false;
>  }
>  
>  /*
> @@ -192,7 +192,7 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
>  	    opt_index ++;
>  	}
>  
> -	notmuch_bool_t opt_status = FALSE;
> +	bool opt_status = false;
>  	if (try->opt_keyword || try->opt_flags)
>  	    opt_status = _process_keyword_arg (try, next, value);
>  	else if (try->opt_bool)
> @@ -208,7 +208,7 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
>  	    return -1;
>  
>  	if (try->present)
> -	    *try->present = TRUE;
> +	    *try->present = true;
>  
>  	return opt_index+1;
>      }
> @@ -221,7 +221,7 @@ parse_arguments (int argc, char **argv,
>  		 const notmuch_opt_desc_t *options, int opt_index) {
>  
>      int pos_arg_index = 0;
> -    notmuch_bool_t more_args = TRUE;
> +    bool more_args = true;
>  
>      while (more_args && opt_index < argc) {
>  	if (strncmp (argv[opt_index],"--",2) != 0) {
> @@ -242,7 +242,7 @@ parse_arguments (int argc, char **argv,
>  	    opt_index = parse_option (argc, argv, options, opt_index);
>  	    if (opt_index < 0) {
>  		fprintf (stderr, "Unrecognized option: %s\n", argv[prev_opt_index]);
> -		more_args = FALSE;
> +		more_args = false;
>  	    }
>  	}
>      }
> diff --git a/command-line-arguments.h b/command-line-arguments.h
> index dfc808bdab78..76ca4dcbb276 100644
> --- a/command-line-arguments.h
> +++ b/command-line-arguments.h
> @@ -1,6 +1,8 @@
>  #ifndef NOTMUCH_OPTS_H
>  #define NOTMUCH_OPTS_H
>  
> +#include <stdbool.h>
> +
>  #include "notmuch.h"
>  
>  /*
> @@ -17,7 +19,7 @@ typedef struct notmuch_keyword {
>  typedef struct notmuch_opt_desc {
>      /* One and only one of opt_* must be set. */
>      const struct notmuch_opt_desc *opt_inherit;
> -    notmuch_bool_t *opt_bool;
> +    bool *opt_bool;
>      int *opt_int;
>      int *opt_keyword;
>      int *opt_flags;
> @@ -27,8 +29,8 @@ typedef struct notmuch_opt_desc {
>      /* Must be set except for opt_inherit and opt_position. */
>      const char *name;
>  
> -    /* Optional, if non-NULL, set to TRUE if the option is present. */
> -    notmuch_bool_t *present;
> +    /* Optional, if non-NULL, set to true if the option is present. */
> +    bool *present;
>  
>      /* Must be set for opt_keyword and opt_flags. */
>      const struct notmuch_keyword *keywords;
> @@ -64,7 +66,7 @@ parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int o
>  int
>  parse_option (int argc, char **argv, const notmuch_opt_desc_t* options, int opt_index);
>  
> -notmuch_bool_t
> +bool
>  parse_position_arg (const char *arg,
>  		    int position_arg_index,
>  		    const notmuch_opt_desc_t* options);
> diff --git a/crypto.c b/crypto.c
> index cc45b88521ec..9c557d6e0640 100644
> --- a/crypto.c
> +++ b/crypto.c
> @@ -37,8 +37,8 @@ create_gpg_context (notmuch_crypto_t *crypto)
>      }
>      crypto->gpgctx = gpgctx;
>  
> -    g_mime_gpg_context_set_use_agent ((GMimeGpgContext *) gpgctx, TRUE);
> -    g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) gpgctx, FALSE);
> +    g_mime_gpg_context_set_use_agent ((GMimeGpgContext *) gpgctx, true);
> +    g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) gpgctx, false);
>  
>      return gpgctx;
>  }
> @@ -61,7 +61,7 @@ create_pkcs7_context (notmuch_crypto_t *crypto)
>      crypto->pkcs7ctx = pkcs7ctx;
>  
>      g_mime_pkcs7_context_set_always_trust ((GMimePkcs7Context *) pkcs7ctx,
> -					   FALSE);
> +					   false);
>  
>      return pkcs7ctx;
>  }
> diff --git a/debugger.c b/debugger.c
> index 0fa0fb6bda23..5cb38ac444e3 100644
> --- a/debugger.c
> +++ b/debugger.c
> @@ -28,20 +28,20 @@
>  #define RUNNING_ON_VALGRIND 0
>  #endif
>  
> -notmuch_bool_t
> +bool
>  debugger_is_active (void)
>  {
>      char buf[1024];
>  
>      if (RUNNING_ON_VALGRIND)
> -	return TRUE;
> +	return true;
>  
>      sprintf (buf, "/proc/%d/exe", getppid ());
>      if (readlink (buf, buf, sizeof (buf)) != -1 &&
>  	strncmp (basename (buf), "gdb", 3) == 0)
>      {
> -	return TRUE;
> +	return true;
>      }
>  
> -    return FALSE;
> +    return false;
>  }
> diff --git a/gmime-filter-reply.c b/gmime-filter-reply.c
> index 847426bfe663..a1ba4b45411b 100644
> --- a/gmime-filter-reply.c
> +++ b/gmime-filter-reply.c
> @@ -16,6 +16,8 @@
>   * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
>   */
>  
> +#include <stdbool.h>
> +
>  #include "gmime-filter-reply.h"
>  
>  /**
> @@ -87,8 +89,8 @@ static void
>  g_mime_filter_reply_init (GMimeFilterReply *filter, GMimeFilterReplyClass *klass)
>  {
>  	(void) klass;
> -	filter->saw_nl = TRUE;
> -	filter->saw_angle = FALSE;
> +	filter->saw_nl = true;
> +	filter->saw_angle = false;
>  }
>  
>  static void
> @@ -117,43 +119,43 @@ filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
>  
>  	(void) prespace;
>  	if (reply->encode) {
> -		g_mime_filter_set_size (filter, 3 * inlen, FALSE);
> +		g_mime_filter_set_size (filter, 3 * inlen, false);
>  
>  		outptr = filter->outbuf;
>  		while (inptr < inend) {
>  			if (reply->saw_nl) {
>  				*outptr++ = '>';
>  				*outptr++ = ' ';
> -				reply->saw_nl = FALSE;
> +				reply->saw_nl = false;
>  			}
>  			if (*inptr == '\n')
> -				reply->saw_nl = TRUE;
> +				reply->saw_nl = true;
>  			else
> -				reply->saw_nl = FALSE;
> +				reply->saw_nl = false;
>  			if (*inptr != '\r')
>  				*outptr++ = *inptr;
>  			inptr++;
>  		}
>  	} else {
> -		g_mime_filter_set_size (filter, inlen + 1, FALSE);
> +		g_mime_filter_set_size (filter, inlen + 1, false);
>  
>  		outptr = filter->outbuf;
>  		while (inptr < inend) {
>  			if (reply->saw_nl) {
>  				if (*inptr == '>')
> -					reply->saw_angle = TRUE;
> +					reply->saw_angle = true;
>  				else
>  					*outptr++ = *inptr;
> -				reply->saw_nl = FALSE;
> +				reply->saw_nl = false;
>  			} else if (reply->saw_angle) {
>  				if (*inptr == ' ')
>  					;
>  				else
>  					*outptr++ = *inptr;
> -				reply->saw_angle = FALSE;
> +				reply->saw_angle = false;
>  			} else if (*inptr != '\r') {
>  				if (*inptr == '\n')
> -					reply->saw_nl = TRUE;
> +					reply->saw_nl = true;
>  				*outptr++ = *inptr;
>  			}
>  
> @@ -179,19 +181,19 @@ filter_reset (GMimeFilter *filter)
>  {
>  	GMimeFilterReply *reply = (GMimeFilterReply *) filter;
>  
> -	reply->saw_nl = TRUE;
> -	reply->saw_angle = FALSE;
> +	reply->saw_nl = true;
> +	reply->saw_angle = false;
>  }
>  
>  
>  /**
>   * g_mime_filter_reply_new:
> - * @encode: %TRUE if the filter should encode or %FALSE otherwise
> + * @encode: %true if the filter should encode or %false otherwise
>   * @dots: encode/decode dots (as for SMTP)
>   *
>   * Creates a new #GMimeFilterReply filter.
>   *
> - * If @encode is %TRUE, then all lines will be prefixed by "> ",
> + * If @encode is %true, then all lines will be prefixed by "> ",
>   * otherwise any lines starting with "> " will have that removed
>   *
>   * Returns: a new #GMimeFilterReply filter.
> diff --git a/mime-node.c b/mime-node.c
> index 24d73afa8458..8b767d783117 100644
> --- a/mime-node.c
> +++ b/mime-node.c
> @@ -112,7 +112,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
>  	status = NOTMUCH_STATUS_OUT_OF_MEMORY;
>  	goto DONE;
>      }
> -    g_mime_stream_file_set_owner (GMIME_STREAM_FILE (mctx->stream), FALSE);
> +    g_mime_stream_file_set_owner (GMIME_STREAM_FILE (mctx->stream), false);
>  
>      mctx->parser = g_mime_parser_new_with_stream (mctx->stream);
>      if (!mctx->parser) {
> @@ -175,7 +175,7 @@ node_verify (mime_node_t *node, GMimeObject *part,
>  {
>      GError *err = NULL;
>  
> -    node->verify_attempted = TRUE;
> +    node->verify_attempted = true;
>      node->sig_list = g_mime_multipart_signed_verify
>  	(GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);
>  
> @@ -198,7 +198,7 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
>      GMimeDecryptResult *decrypt_result = NULL;
>      GMimeMultipartEncrypted *encrypteddata = GMIME_MULTIPART_ENCRYPTED (part);
>  
> -    node->decrypt_attempted = TRUE;
> +    node->decrypt_attempted = true;
>      node->decrypted_child = g_mime_multipart_encrypted_decrypt
>  	(encrypteddata, cryptoctx, &decrypt_result, &err);
>      if (! node->decrypted_child) {
> @@ -207,8 +207,8 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
>  	goto DONE;
>      }
>  
> -    node->decrypt_success = TRUE;
> -    node->verify_attempted = TRUE;
> +    node->decrypt_success = true;
> +    node->verify_attempted = true;
>  
>      /* This may be NULL if the part is not signed. */
>      node->sig_list = g_mime_decrypt_result_get_signatures (decrypt_result);
> diff --git a/notmuch-client.h b/notmuch-client.h
> index c68538fcc0a2..0365baae4b89 100644
> --- a/notmuch-client.h
> +++ b/notmuch-client.h
> @@ -24,6 +24,7 @@
>  #ifndef _GNU_SOURCE
>  #define _GNU_SOURCE /* for getline */
>  #endif
> +#include <stdbool.h>
>  #include <stdio.h>
>  #include <sysexits.h>
>  
> @@ -72,8 +73,8 @@ typedef struct notmuch_show_format {
>  } notmuch_show_format_t;
>  
>  typedef struct notmuch_crypto {
> -    notmuch_bool_t verify;
> -    notmuch_bool_t decrypt;
> +    bool verify;
> +    bool decrypt;
>  #if (GMIME_MAJOR_VERSION < 3)
>      notmuch_crypto_context_t* gpgctx;
>      notmuch_crypto_context_t* pkcs7ctx;
> @@ -82,12 +83,12 @@ typedef struct notmuch_crypto {
>  } notmuch_crypto_t;
>  
>  typedef struct notmuch_show_params {
> -    notmuch_bool_t entire_thread;
> -    notmuch_bool_t omit_excluded;
> -    notmuch_bool_t output_body;
> +    bool entire_thread;
> +    bool omit_excluded;
> +    bool output_body;
>      int part;
>      notmuch_crypto_t crypto;
> -    notmuch_bool_t include_html;
> +    bool include_html;
>      GMimeStream *out_stream;
>  } notmuch_show_params_t;
>  
> @@ -247,12 +248,12 @@ show_one_part (const char *filename, int part);
>  
>  void
>  format_part_sprinter (const void *ctx, struct sprinter *sp, mime_node_t *node,
> -		      notmuch_bool_t output_body,
> -		      notmuch_bool_t include_html);
> +		      bool output_body,
> +		      bool include_html);
>  
>  void
>  format_headers_sprinter (struct sprinter *sp, GMimeMessage *message,
> -			 notmuch_bool_t reply);
> +			 bool reply);
>  
>  typedef enum {
>      NOTMUCH_SHOW_TEXT_PART_REPLY = 1 << 0,
> @@ -286,7 +287,7 @@ notmuch_config_close (notmuch_config_t *config);
>  int
>  notmuch_config_save (notmuch_config_t *config);
>  
> -notmuch_bool_t
> +bool
>  notmuch_config_is_new (notmuch_config_t *config);
>  
>  const char *
> @@ -345,12 +346,12 @@ notmuch_config_set_new_ignore (notmuch_config_t *config,
>  			       const char *new_ignore[],
>  			       size_t length);
>  
> -notmuch_bool_t
> +bool
>  notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config);
>  
>  void
>  notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,
> -					      notmuch_bool_t synchronize_flags);
> +					      bool synchronize_flags);
>  
>  const char **
>  notmuch_config_get_search_exclude_tags (notmuch_config_t *config, size_t *length);
> @@ -363,7 +364,7 @@ notmuch_config_set_search_exclude_tags (notmuch_config_t *config,
>  int
>  notmuch_run_hook (const char *db_path, const char *hook);
>  
> -notmuch_bool_t
> +bool
>  debugger_is_active (void);
>  
>  /* mime-node.c */
> @@ -406,14 +407,14 @@ struct mime_node {
>      int part_num;
>  
>      /* True if decryption of this part was attempted. */
> -    notmuch_bool_t decrypt_attempted;
> +    bool decrypt_attempted;
>      /* True if decryption of this part's child succeeded.  In this
>       * case, the decrypted part is substituted for the second child of
>       * this part (which would usually be the encrypted data). */
> -    notmuch_bool_t decrypt_success;
> +    bool decrypt_success;
>  
>      /* True if signature verification on this part was attempted. */
> -    notmuch_bool_t verify_attempted;
> +    bool verify_attempted;
>  
>      /* The list of signatures for signed or encrypted containers. If
>       * there are no signatures, this will be NULL. */
> @@ -487,7 +488,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
>  		       const char *query_str,
>  		       dump_format_t output_format,
>  		       dump_include_t include,
> -		       notmuch_bool_t gzip_output);
> +		       bool gzip_output);
>  
>  /* If status is non-zero (i.e. error) print appropriate
>     messages to stderr.
> diff --git a/notmuch-compact.c b/notmuch-compact.c
> index ae464e4805cb..f8996cf46039 100644
> --- a/notmuch-compact.c
> +++ b/notmuch-compact.c
> @@ -32,7 +32,7 @@ notmuch_compact_command (notmuch_config_t *config, int argc, char *argv[])
>      const char *path = notmuch_config_get_database_path (config);
>      const char *backup_path = NULL;
>      notmuch_status_t ret;
> -    notmuch_bool_t quiet = FALSE;
> +    bool quiet = false;
>      int opt_index;
>  
>      notmuch_opt_desc_t options[] = {
> diff --git a/notmuch-config.c b/notmuch-config.c
> index cb9529b90912..8fb59f96eb6d 100644
> --- a/notmuch-config.c
> +++ b/notmuch-config.c
> @@ -122,7 +122,7 @@ static const char crypto_config_comment[] =
>  struct _notmuch_config {
>      char *filename;
>      GKeyFile *key_file;
> -    notmuch_bool_t is_new;
> +    bool is_new;
>  
>      char *database_path;
>      char *crypto_gpg_path;
> @@ -134,7 +134,7 @@ struct _notmuch_config {
>      size_t new_tags_length;
>      const char **new_ignore;
>      size_t new_ignore_length;
> -    notmuch_bool_t maildir_synchronize_flags;
> +    bool maildir_synchronize_flags;
>      const char **search_exclude_tags;
>      size_t search_exclude_tags_length;
>  };
> @@ -212,8 +212,8 @@ get_username_from_passwd_file (void *ctx)
>      return name;
>  }
>  
> -static notmuch_bool_t
> -get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
> +static bool
> +get_config_from_file (notmuch_config_t *config, bool create_new)
>  {
>      #define BUF_SIZE 4096
>      char *config_str = NULL;
> @@ -221,7 +221,7 @@ get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
>      int config_bufsize = BUF_SIZE;
>      size_t len;
>      GError *error = NULL;
> -    notmuch_bool_t ret = FALSE;
> +    bool ret = false;
>  
>      FILE *fp = fopen(config->filename, "r");
>      if (fp == NULL) {
> @@ -230,8 +230,8 @@ get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
>  	     * default configuration file in the case of FILE NOT FOUND.
>  	     */
>  	    if (create_new) {
> -		config->is_new = TRUE;
> -		ret = TRUE;
> +		config->is_new = true;
> +		ret = true;
>  	    } else {
>  		fprintf (stderr, "Configuration file %s not found.\n"
>  			 "Try running 'notmuch setup' to create a configuration.\n",
> @@ -271,7 +271,7 @@ get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
>  
>      if (g_key_file_load_from_data (config->key_file, config_str, config_len,
>  				   G_KEY_FILE_KEEP_COMMENTS, &error)) {
> -	ret = TRUE;
> +	ret = true;
>  	goto out;
>      }
>  
> @@ -352,7 +352,7 @@ notmuch_config_open (void *ctx,
>      talloc_set_destructor (config, notmuch_config_destructor);
>  
>      /* non-zero defaults */
> -    config->maildir_synchronize_flags = TRUE;
> +    config->maildir_synchronize_flags = true;
>  
>      if (filename) {
>  	config->filename = talloc_strdup (config, filename);
> @@ -366,7 +366,7 @@ notmuch_config_open (void *ctx,
>      config->key_file = g_key_file_new ();
>  
>      if (config_mode & NOTMUCH_CONFIG_OPEN) {
> -	notmuch_bool_t create_new = (config_mode & NOTMUCH_CONFIG_CREATE) != 0;
> +	bool create_new = (config_mode & NOTMUCH_CONFIG_CREATE) != 0;
>  
>  	if (! get_config_from_file (config, create_new)) {
>  	    talloc_free (config);
> @@ -466,7 +466,7 @@ notmuch_config_open (void *ctx,
>  	g_key_file_get_boolean (config->key_file,
>  				"maildir", "synchronize_flags", &error);
>      if (error) {
> -	notmuch_config_set_maildir_synchronize_flags (config, TRUE);
> +	notmuch_config_set_maildir_synchronize_flags (config, true);
>  	g_error_free (error);
>      }
>  
> @@ -579,7 +579,7 @@ notmuch_config_save (notmuch_config_t *config)
>      return 0;
>  }
>  
> -notmuch_bool_t
> +bool
>  notmuch_config_is_new (notmuch_config_t *config)
>  {
>      return config->is_new;
> @@ -1086,7 +1086,7 @@ notmuch_config_command (notmuch_config_t *config, int argc, char *argv[])
>  
>  }
>  
> -notmuch_bool_t
> +bool
>  notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config)
>  {
>      return config->maildir_synchronize_flags;
> @@ -1094,7 +1094,7 @@ notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config)
>  
>  void
>  notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,
> -					      notmuch_bool_t synchronize_flags)
> +					      bool synchronize_flags)
>  {
>      g_key_file_set_boolean (config->key_file,
>  			    "maildir", "synchronize_flags", synchronize_flags);
> diff --git a/notmuch-count.c b/notmuch-count.c
> index b8b03cdbc0d4..1ae7d5146d92 100644
> --- a/notmuch-count.c
> +++ b/notmuch-count.c
> @@ -29,8 +29,8 @@ enum {
>  
>  /* The following is to allow future options to be added more easily */
>  enum {
> -    EXCLUDE_TRUE,
> -    EXCLUDE_FALSE,
> +    EXCLUDE_true,
> +    EXCLUDE_false,
>  };
>  
>  /* Return the number of files matching the query, or -1 for an error */
> @@ -160,11 +160,11 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
>      char *query_str;
>      int opt_index;
>      int output = OUTPUT_MESSAGES;
> -    int exclude = EXCLUDE_TRUE;
> +    int exclude = EXCLUDE_true;
>      const char **search_exclude_tags = NULL;
>      size_t search_exclude_tags_length = 0;
> -    notmuch_bool_t batch = FALSE;
> -    notmuch_bool_t print_lastmod = FALSE;
> +    bool batch = false;
> +    bool print_lastmod = false;
>      FILE *input = stdin;
>      const char *input_file_name = NULL;
>      int ret;
> @@ -176,8 +176,8 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
>  				  { "files", OUTPUT_FILES },
>  				  { 0, 0 } } },
>  	{ .opt_keyword = &exclude, .name = "exclude", .keywords =
> -	  (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },
> -				  { "false", EXCLUDE_FALSE },
> +	  (notmuch_keyword_t []){ { "true", EXCLUDE_true },
> +				  { "false", EXCLUDE_false },
>  				  { 0, 0 } } },
>  	{ .opt_bool = &print_lastmod, .name = "lastmod" },
>  	{ .opt_bool = &batch, .name = "batch" },
> @@ -193,7 +193,7 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
>      notmuch_process_shared_options (argv[0]);
>  
>      if (input_file_name) {
> -	batch = TRUE;
> +	batch = true;
>  	input = fopen (input_file_name, "r");
>  	if (input == NULL) {
>  	    fprintf (stderr, "Error opening %s for reading: %s\n",
> @@ -221,7 +221,7 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
>  	return EXIT_FAILURE;
>      }
>  
> -    if (exclude == EXCLUDE_TRUE) {
> +    if (exclude == EXCLUDE_true) {
>  	search_exclude_tags = notmuch_config_get_search_exclude_tags
>  	    (config, &search_exclude_tags_length);
>      }
> diff --git a/notmuch-dump.c b/notmuch-dump.c
> index 03e64d608c85..ef2f02dfeb5c 100644
> --- a/notmuch-dump.c
> +++ b/notmuch-dump.c
> @@ -97,7 +97,7 @@ dump_properties_message (void *ctx,
>  {
>      const char *message_id;
>      notmuch_message_properties_t *list;
> -    notmuch_bool_t first = TRUE;
> +    bool first = true;
>  
>      message_id = notmuch_message_get_message_id (message);
>  
> @@ -106,7 +106,7 @@ dump_properties_message (void *ctx,
>  	return 0;
>      }
>  
> -    for (list = notmuch_message_get_properties (message, "", FALSE);
> +    for (list = notmuch_message_get_properties (message, "", false);
>  	 notmuch_message_properties_valid (list); notmuch_message_properties_move_to_next (list)) {
>  	const char *key, *val;
>  
> @@ -116,7 +116,7 @@ dump_properties_message (void *ctx,
>  		return 1;
>  	    }
>  	    gzprintf (output, "#= %s", *buffer_p);
> -	    first = FALSE;
> +	    first = false;
>  	}
>  
>  	key = notmuch_message_properties_key (list);
> @@ -277,7 +277,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
>  		       const char *query_str,
>  		       dump_format_t output_format,
>  		       dump_include_t include,
> -		       notmuch_bool_t gzip_output)
> +		       bool gzip_output)
>  {
>      gzFile output = NULL;
>      const char *mode = gzip_output ? "w9" : "wT";
> @@ -374,7 +374,7 @@ notmuch_dump_command (notmuch_config_t *config, int argc, char *argv[])
>  
>      int output_format = DUMP_FORMAT_BATCH_TAG;
>      int include = 0;
> -    notmuch_bool_t gzip_output = 0;
> +    bool gzip_output = 0;
>  
>      notmuch_opt_desc_t options[] = {
>  	{ .opt_keyword = &output_format, .name = "format", .keywords =
> diff --git a/notmuch-insert.c b/notmuch-insert.c
> index bbbc29ea103d..32be74193472 100644
> --- a/notmuch-insert.c
> +++ b/notmuch-insert.c
> @@ -65,7 +65,7 @@ safe_gethostname (char *hostname, size_t len)
>  }
>  
>  /* Call fsync() on a directory path. */
> -static notmuch_bool_t
> +static bool
>  sync_dir (const char *dir)
>  {
>      int fd, r;
> @@ -73,7 +73,7 @@ sync_dir (const char *dir)
>      fd = open (dir, O_RDONLY);
>      if (fd == -1) {
>  	fprintf (stderr, "Error: open %s: %s\n", dir, strerror (errno));
> -	return FALSE;
> +	return false;
>      }
>  
>      r = fsync (fd);
> @@ -88,29 +88,29 @@ sync_dir (const char *dir)
>  /*
>   * Check the specified folder name does not contain a directory
>   * component ".." to prevent writes outside of the Maildir
> - * hierarchy. Return TRUE on valid folder name, FALSE otherwise.
> + * hierarchy. Return true on valid folder name, false otherwise.
>   */
> -static notmuch_bool_t
> +static bool
>  is_valid_folder_name (const char *folder)
>  {
>      const char *p = folder;
>  
>      for (;;) {
>  	if ((p[0] == '.') && (p[1] == '.') && (p[2] == '\0' || p[2] == '/'))
> -	    return FALSE;
> +	    return false;
>  	p = strchr (p, '/');
>  	if (!p)
> -	    return TRUE;
> +	    return true;
>  	p++;
>      }
>  }
>  
>  /*
>   * Make the given directory and its parents as necessary, using the
> - * given mode. Return TRUE on success, FALSE otherwise. Partial
> + * given mode. Return true on success, false otherwise. Partial
>   * results are not cleaned up on errors.
>   */
> -static notmuch_bool_t
> +static bool
>  mkdir_recursive (const void *ctx, const char *path, int mode)
>  {
>      struct stat st;
> @@ -123,13 +123,13 @@ mkdir_recursive (const void *ctx, const char *path, int mode)
>          if (! S_ISDIR (st.st_mode)) {
>  	    fprintf (stderr, "Error: '%s' is not a directory: %s\n",
>  		     path, strerror (EEXIST));
> -	    return FALSE;
> +	    return false;
>  	}
>  
> -	return TRUE;
> +	return true;
>      } else if (errno != ENOENT) {
>  	fprintf (stderr, "Error: stat '%s': %s\n", path, strerror (errno));
> -	return FALSE;
> +	return false;
>      }
>  
>      /* mkdir parents, if any */
> @@ -138,27 +138,27 @@ mkdir_recursive (const void *ctx, const char *path, int mode)
>  	parent = talloc_strndup (ctx, path, slash - path);
>  	if (! parent) {
>  	    fprintf (stderr, "Error: %s\n", strerror (ENOMEM));
> -	    return FALSE;
> +	    return false;
>  	}
>  
>  	if (! mkdir_recursive (ctx, parent, mode))
> -	    return FALSE;
> +	    return false;
>      }
>  
>      if (mkdir (path, mode)) {
>  	fprintf (stderr, "Error: mkdir '%s': %s\n", path, strerror (errno));
> -	return FALSE;
> +	return false;
>      }
>  
> -    return parent ? sync_dir (parent) : TRUE;
> +    return parent ? sync_dir (parent) : true;
>  }
>  
>  /*
>   * Create the given maildir folder, i.e. maildir and its
> - * subdirectories cur/new/tmp. Return TRUE on success, FALSE
> + * subdirectories cur/new/tmp. Return true on success, false
>   * otherwise. Partial results are not cleaned up on errors.
>   */
> -static notmuch_bool_t
> +static bool
>  maildir_create_folder (const void *ctx, const char *maildir)
>  {
>      const char *subdirs[] = { "cur", "new", "tmp" };
> @@ -170,14 +170,14 @@ maildir_create_folder (const void *ctx, const char *maildir)
>  	subdir = talloc_asprintf (ctx, "%s/%s", maildir, subdirs[i]);
>  	if (! subdir) {
>  	    fprintf (stderr, "Error: %s\n", strerror (ENOMEM));
> -	    return FALSE;
> +	    return false;
>  	}
>  
>  	if (! mkdir_recursive (ctx, subdir, mode))
> -	    return FALSE;
> +	    return false;
>      }
>  
> -    return TRUE;
> +    return true;
>  }
>  
>  /*
> @@ -241,13 +241,13 @@ maildir_mktemp (const void *ctx, const char *maildir, char **path_out)
>  }
>  
>  /*
> - * Copy fdin to fdout, return TRUE on success, and FALSE on errors and
> + * Copy fdin to fdout, return true on success, and false on errors and
>   * empty input.
>   */
> -static notmuch_bool_t
> +static bool
>  copy_fd (int fdout, int fdin)
>  {
> -    notmuch_bool_t empty = TRUE;
> +    bool empty = true;
>  
>      while (! interrupted) {
>  	ssize_t remain;
> @@ -262,7 +262,7 @@ copy_fd (int fdout, int fdin)
>  		continue;
>  	    fprintf (stderr, "Error: reading from standard input: %s\n",
>  		     strerror (errno));
> -	    return FALSE;
> +	    return false;
>  	}
>  
>  	p = buf;
> @@ -273,11 +273,11 @@ copy_fd (int fdout, int fdin)
>  	    if (written <= 0) {
>  		fprintf (stderr, "Error: writing to temporary file: %s",
>  			 strerror (errno));
> -		return FALSE;
> +		return false;
>  	    }
>  	    p += written;
>  	    remain -= written;
> -	    empty = FALSE;
> +	    empty = false;
>  	} while (remain > 0);
>      }
>  
> @@ -367,19 +367,19 @@ FAIL:
>  
>  /*
>   * Add the specified message file to the notmuch database, applying
> - * tags in tag_ops. If synchronize_flags is TRUE, the tags are
> + * tags in tag_ops. If synchronize_flags is true, the tags are
>   * synchronized to maildir flags (which may result in message file
>   * rename).
>   *
>   * Return NOTMUCH_STATUS_SUCCESS on success, errors otherwise. If keep
> - * is TRUE, errors in tag changes and flag syncing are ignored and
> + * is true, errors in tag changes and flag syncing are ignored and
>   * success status is returned; otherwise such errors cause the message
>   * to be removed from the database. Failure to add the message to the
>   * database results in error status regardless of keep.
>   */
>  static notmuch_status_t
>  add_file (notmuch_database_t *notmuch, const char *path, tag_op_list_t *tag_ops,
> -	  notmuch_bool_t synchronize_flags, notmuch_bool_t keep)
> +	  bool synchronize_flags, bool keep)
>  {
>      notmuch_message_t *message;
>      notmuch_status_t status;
> @@ -453,10 +453,10 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
>      tag_op_list_t *tag_ops;
>      char *query_string = NULL;
>      const char *folder = "";
> -    notmuch_bool_t create_folder = FALSE;
> -    notmuch_bool_t keep = FALSE;
> -    notmuch_bool_t no_hooks = FALSE;
> -    notmuch_bool_t synchronize_flags;
> +    bool create_folder = false;
> +    bool keep = false;
> +    bool no_hooks = false;
> +    bool synchronize_flags;
>      char *maildir;
>      char *newpath;
>      int opt_index;
> @@ -489,14 +489,14 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
>      for (i = 0; i < new_tags_length; i++) {
>  	const char *error_msg;
>  
> -	error_msg = illegal_tag (new_tags[i], FALSE);
> +	error_msg = illegal_tag (new_tags[i], false);
>  	if (error_msg) {
>  	    fprintf (stderr, "Error: tag '%s' in new.tags: %s\n",
>  		     new_tags[i],  error_msg);
>  	    return EXIT_FAILURE;
>  	}
>  
> -	if (tag_op_list_append (tag_ops, new_tags[i], FALSE))
> +	if (tag_op_list_append (tag_ops, new_tags[i], false))
>  	    return EXIT_FAILURE;
>      }
>  
> diff --git a/notmuch-new.c b/notmuch-new.c
> index 50597b75c07e..0f50457eb894 100644
> --- a/notmuch-new.c
> +++ b/notmuch-new.c
> @@ -44,7 +44,7 @@ enum verbosity {
>  typedef struct {
>      int output_is_a_tty;
>      enum verbosity verbosity;
> -    notmuch_bool_t debug;
> +    bool debug;
>      const char **new_tags;
>      size_t new_tags_length;
>      const char **new_ignore;
> @@ -60,7 +60,7 @@ typedef struct {
>      _filename_list_t *removed_directories;
>      _filename_list_t *directory_mtimes;
>  
> -    notmuch_bool_t synchronize_flags;
> +    bool synchronize_flags;
>  } add_files_state_t;
>  
>  static volatile sig_atomic_t do_print_progress = 0;
> @@ -234,7 +234,7 @@ _entries_resemble_maildir (const char *path, struct dirent **entries, int count)
>      return 0;
>  }
>  
> -static notmuch_bool_t
> +static bool
>  _special_directory (const char *entry)
>  {
>      return strcmp (entry, ".") == 0 || strcmp (entry, "..") == 0;
> @@ -242,16 +242,16 @@ _special_directory (const char *entry)
>  
>  /* Test if the file/directory is to be ignored.
>   */
> -static notmuch_bool_t
> +static bool
>  _entry_in_ignore_list (const char *entry, add_files_state_t *state)
>  {
>      size_t i;
>  
>      for (i = 0; i < state->new_ignore_length; i++)
>  	if (strcmp (entry, state->new_ignore[i]) == 0)
> -	    return TRUE;
> +	    return true;
>  
> -    return FALSE;
> +    return false;
>  }
>  
>  /* Add a single file to the database. */
> @@ -376,7 +376,7 @@ add_files (notmuch_database_t *notmuch,
>      notmuch_filenames_t *db_subdirs = NULL;
>      time_t stat_time;
>      struct stat st;
> -    notmuch_bool_t is_maildir;
> +    bool is_maildir;
>  
>      if (stat (path, &st)) {
>  	fprintf (stderr, "Error reading directory %s: %s\n",
> @@ -837,7 +837,7 @@ remove_filename (notmuch_database_t *notmuch,
>      status = notmuch_database_remove_message (notmuch, path);
>      if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {
>  	add_files_state->renamed_messages++;
> -	if (add_files_state->synchronize_flags == TRUE)
> +	if (add_files_state->synchronize_flags == true)
>  	    notmuch_message_maildir_flags_to_tags (message);
>  	status = NOTMUCH_STATUS_SUCCESS;
>      } else if (status == NOTMUCH_STATUS_SUCCESS) {
> @@ -941,7 +941,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
>      notmuch_database_t *notmuch;
>      add_files_state_t add_files_state = {
>  	.verbosity = VERBOSITY_NORMAL,
> -	.debug = FALSE,
> +	.debug = false,
>  	.output_is_a_tty = isatty (fileno (stdout)),
>      };
>      struct timeval tv_start;
> @@ -953,9 +953,9 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
>      _filename_node_t *f;
>      int opt_index;
>      unsigned int i;
> -    notmuch_bool_t timer_is_active = FALSE;
> -    notmuch_bool_t no_hooks = FALSE;
> -    notmuch_bool_t quiet = FALSE, verbose = FALSE;
> +    bool timer_is_active = false;
> +    bool no_hooks = false;
> +    bool quiet = false, verbose = false;
>      notmuch_status_t status;
>  
>      notmuch_opt_desc_t options[] = {
> @@ -987,7 +987,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
>      for (i = 0; i < add_files_state.new_tags_length; i++) {
>  	const char *error_msg;
>  
> -	error_msg = illegal_tag (add_files_state.new_tags[i], FALSE);
> +	error_msg = illegal_tag (add_files_state.new_tags[i], false);
>  	if (error_msg) {
>  	    fprintf (stderr, "Error: tag '%s' in new.tags: %s\n",
>  		     add_files_state.new_tags[i], error_msg);
> @@ -1054,7 +1054,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
>  	    }
>  
>  	    if (notmuch_database_dump (notmuch, backup_name, "",
> -				       DUMP_FORMAT_BATCH_TAG, DUMP_INCLUDE_DEFAULT, TRUE)) {
> +				       DUMP_FORMAT_BATCH_TAG, DUMP_INCLUDE_DEFAULT, true)) {
>  		fprintf (stderr, "Backup failed. Aborting upgrade.");
>  		return EXIT_FAILURE;
>  	    }
> @@ -1101,7 +1101,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
>      if (add_files_state.verbosity == VERBOSITY_NORMAL &&
>  	add_files_state.output_is_a_tty && ! debugger_is_active ()) {
>  	setup_progress_printing_timer ();
> -	timer_is_active = TRUE;
> +	timer_is_active = true;
>      }
>  
>      ret = add_files (notmuch, db_path, &add_files_state);
> diff --git a/notmuch-reply.c b/notmuch-reply.c
> index e7ead79d755d..3e5a1443719a 100644
> --- a/notmuch-reply.c
> +++ b/notmuch-reply.c
> @@ -93,7 +93,7 @@ typedef enum {
>  } address_match_t;
>  
>  /* Match given string against given address according to mode. */
> -static notmuch_bool_t
> +static bool
>  match_address (const char *str, const char *address, address_match_t mode)
>  {
>      switch (mode) {
> @@ -105,7 +105,7 @@ match_address (const char *str, const char *address, address_match_t mode)
>  	return strcasecmp (address, str) == 0;
>      }
>  
> -    return FALSE;
> +    return false;
>  }
>  
>  /* Match given string against user's configured "primary" and "other"
> @@ -153,7 +153,7 @@ string_in_user_address (const char *str, notmuch_config_t *config)
>  
>  /* Is the given address configured as one of the user's "primary" or
>   * "other" addresses. */
> -static notmuch_bool_t
> +static bool
>  address_is_users (const char *address, notmuch_config_t *config)
>  {
>      return address_match (address, config, STRING_IS_USER_ADDRESS) != NULL;
> @@ -221,7 +221,7 @@ scan_address_list (InternetAddressList *list,
>  /* Does the address in the Reply-To header of 'message' already appear
>   * in either the 'To' or 'Cc' header of the message?
>   */
> -static notmuch_bool_t
> +static bool
>  reply_to_header_is_redundant (GMimeMessage *message,
>  			      InternetAddressList *reply_to_list)
>  {
> @@ -229,7 +229,7 @@ reply_to_header_is_redundant (GMimeMessage *message,
>      InternetAddress *address;
>      InternetAddressMailbox *mailbox;
>      InternetAddressList *recipients;
> -    notmuch_bool_t ret = FALSE;
> +    bool ret = false;
>      int i;
>  
>      if (reply_to_list == NULL ||
> @@ -253,7 +253,7 @@ reply_to_header_is_redundant (GMimeMessage *message,
>  	mailbox = INTERNET_ADDRESS_MAILBOX (address);
>  	addr = internet_address_mailbox_get_addr (mailbox);
>  	if (strcmp (addr, reply_to) == 0) {
> -	    ret = TRUE;
> +	    ret = true;
>  	    break;
>  	}
>      }
> @@ -323,7 +323,7 @@ static const char *
>  add_recipients_from_message (GMimeMessage *reply,
>  			     notmuch_config_t *config,
>  			     GMimeMessage *message,
> -			     notmuch_bool_t reply_all)
> +			     bool reply_all)
>  {
>  
>      /* There is a memory leak here with gmime-2.6 because get_sender
> @@ -522,8 +522,8 @@ create_reply_message(void *ctx,
>  		     notmuch_config_t *config,
>  		     notmuch_message_t *message,
>  		     GMimeMessage *mime_message,
> -		     notmuch_bool_t reply_all,
> -		     notmuch_bool_t limited)
> +		     bool reply_all,
> +		     bool limited)
>  {
>      const char *subject, *from_addr = NULL;
>      const char *in_reply_to, *orig_references, *references;
> @@ -612,7 +612,7 @@ static int do_reply(notmuch_config_t *config,
>  		    notmuch_query_t *query,
>  		    notmuch_show_params_t *params,
>  		    int format,
> -		    notmuch_bool_t reply_all)
> +		    bool reply_all)
>  {
>      GMimeMessage *reply;
>      mime_node_t *node;
> @@ -663,11 +663,11 @@ static int do_reply(notmuch_config_t *config,
>  
>  	    /* The headers of the reply message we've created */
>  	    sp->map_key (sp, "reply-headers");
> -	    format_headers_sprinter (sp, reply, TRUE);
> +	    format_headers_sprinter (sp, reply, true);
>  
>  	    /* Start the original */
>  	    sp->map_key (sp, "original");
> -	    format_part_sprinter (config, sp, node, TRUE, FALSE);
> +	    format_part_sprinter (config, sp, node, true, false);
>  
>  	    /* End */
>  	    sp->end (sp);
> @@ -702,7 +702,7 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
>  	.part = -1,
>      };
>      int format = FORMAT_DEFAULT;
> -    int reply_all = TRUE;
> +    int reply_all = true;
>  
>      notmuch_opt_desc_t options[] = {
>  	{ .opt_keyword = &format, .name = "format", .keywords =
> @@ -713,8 +713,8 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
>  				  { 0, 0 } } },
>  	{ .opt_int = &notmuch_format_version, .name = "format-version" },
>  	{ .opt_keyword = &reply_all, .name = "reply-to", .keywords =
> -	  (notmuch_keyword_t []){ { "all", TRUE },
> -				  { "sender", FALSE },
> +	  (notmuch_keyword_t []){ { "all", true },
> +				  { "sender", false },
>  				  { 0, 0 } } },
>  	{ .opt_bool = &params.crypto.decrypt, .name = "decrypt" },
>  	{ .opt_inherit = notmuch_shared_options },
> diff --git a/notmuch-restore.c b/notmuch-restore.c
> index 0025e2c316be..dee19c206d13 100644
> --- a/notmuch-restore.c
> +++ b/notmuch-restore.c
> @@ -211,7 +211,7 @@ parse_sup_line (void *ctx, char *line,
>  	    tok_len++;
>  	}
>  
> -	if (tag_op_list_append (tag_ops, tok, FALSE))
> +	if (tag_op_list_append (tag_ops, tok, false))
>  	    return -1;
>      }
>  
> @@ -223,7 +223,7 @@ int
>  notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[])
>  {
>      notmuch_database_t *notmuch;
> -    notmuch_bool_t accumulate = FALSE;
> +    bool accumulate = false;
>      tag_op_flag_t flags = 0;
>      tag_op_list_t *tag_ops;
>  
> diff --git a/notmuch-search.c b/notmuch-search.c
> index 2ea658d325d6..0abac08eb7ab 100644
> --- a/notmuch-search.c
> +++ b/notmuch-search.c
> @@ -163,7 +163,7 @@ do_search_threads (search_context_t *ctx)
>  	    int files = notmuch_thread_get_total_files (thread);
>  	    int total = notmuch_thread_get_total_messages (thread);
>  	    const char *relative_date = NULL;
> -	    notmuch_bool_t first_tag = TRUE;
> +	    bool first_tag = true;
>  
>  	    format->begin_map (format);
>  
> @@ -243,7 +243,7 @@ do_search_threads (search_context_t *ctx)
>  		if (format->is_text_printer) {
>                    /* Special case for the text formatter */
>  		    if (first_tag)
> -			first_tag = FALSE;
> +			first_tag = false;
>  		    else
>  			fputc (' ', stdout);
>  		    fputs (tag, stdout);
> @@ -295,9 +295,9 @@ static int mailbox_compare (const void *v1, const void *v2)
>      return ret;
>  }
>  
> -/* Returns TRUE iff name and addr is duplicate. If not, stores the
> +/* Returns true iff name and addr is duplicate. If not, stores the
>   * name/addr pair in order to detect subsequent duplicates. */
> -static notmuch_bool_t
> +static bool
>  is_duplicate (const search_context_t *ctx, const char *name, const char *addr)
>  {
>      char *key;
> @@ -315,12 +315,12 @@ is_duplicate (const search_context_t *ctx, const char *name, const char *addr)
>  	if (l) {
>  	    mailbox = l->data;
>  	    mailbox->count++;
> -	    return TRUE;
> +	    return true;
>  	}
>  
>  	mailbox = new_mailbox (ctx->format, name, addr);
>  	if (! mailbox)
> -	    return FALSE;
> +	    return false;
>  
>  	/*
>  	 * XXX: It would be more efficient to prepend to the list, but
> @@ -331,24 +331,24 @@ is_duplicate (const search_context_t *ctx, const char *name, const char *addr)
>  	if (list != g_list_append (list, mailbox))
>  	    INTERNAL_ERROR ("appending to list changed list head\n");
>  
> -	return FALSE;
> +	return false;
>      }
>  
>      key = talloc_strdup (ctx->format, addr);
>      if (! key)
> -	return FALSE;
> +	return false;
>  
>      mailbox = new_mailbox (ctx->format, name, addr);
>      if (! mailbox)
> -	return FALSE;
> +	return false;
>  
>      list = g_list_append (NULL, mailbox);
>      if (! list)
> -	return FALSE;
> +	return false;
>  
>      g_hash_table_insert (ctx->addresses, key, list);
>  
> -    return FALSE;
> +    return false;
>  }
>  
>  static void
> @@ -363,7 +363,7 @@ print_mailbox (const search_context_t *ctx, const mailbox_t *mailbox)
>  
>      /* name_addr has the name part quoted if necessary. Compare
>       * 'John Doe <john@doe.com>' vs. '"Doe, John" <john@doe.com>' */
> -    name_addr = internet_address_to_string (ia, FALSE);
> +    name_addr = internet_address_to_string (ia, false);
>  
>      if (format->is_text_printer) {
>  	if (ctx->output & OUTPUT_COUNT) {
> diff --git a/notmuch-setup.c b/notmuch-setup.c
> index 9a66810db385..5304800553cf 100644
> --- a/notmuch-setup.c
> +++ b/notmuch-setup.c
> @@ -187,7 +187,7 @@ notmuch_setup_command (notmuch_config_t *config,
>  					     (const char **)
>  					     other_emails->pdata,
>  					     other_emails->len);
> -    g_ptr_array_free (other_emails, TRUE);
> +    g_ptr_array_free (other_emails, true);
>  
>      prompt ("Top-level directory of your email archive [%s]: ",
>  	    notmuch_config_get_database_path (config));
> @@ -210,7 +210,7 @@ notmuch_setup_command (notmuch_config_t *config,
>  	notmuch_config_set_new_tags (config, (const char **) tags->pdata,
>  				     tags->len);
>  
> -	g_ptr_array_free (tags, TRUE);
> +	g_ptr_array_free (tags, true);
>      }
>  
>  
> @@ -227,7 +227,7 @@ notmuch_setup_command (notmuch_config_t *config,
>  						(const char **) tags->pdata,
>  						tags->len);
>  
> -	g_ptr_array_free (tags, TRUE);
> +	g_ptr_array_free (tags, true);
>      }
>  
>      if (notmuch_config_save (config))
> diff --git a/notmuch-show.c b/notmuch-show.c
> index 3d11a40c6a59..1cfc74652aca 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -196,7 +196,7 @@ _is_from_line (const char *line)
>  
>  void
>  format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
> -			 notmuch_bool_t reply)
> +			 bool reply)
>  {
>      /* Any changes to the JSON or S-Expression format should be
>       * reflected in the file devel/schemata. */
> @@ -283,7 +283,7 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
>  	return;
>  
>      stream_filter = g_mime_stream_filter_new (stream_out);
> -    crlf_filter = g_mime_filter_crlf_new (FALSE, FALSE);
> +    crlf_filter = g_mime_filter_crlf_new (false, false);
>      g_mime_stream_filter_add(GMIME_STREAM_FILTER (stream_filter),
>  			     crlf_filter);
>      g_object_unref (crlf_filter);
> @@ -305,7 +305,7 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
>  
>      if (flags & NOTMUCH_SHOW_TEXT_PART_REPLY) {
>  	GMimeFilter *reply_filter;
> -	reply_filter = g_mime_filter_reply_new (TRUE);
> +	reply_filter = g_mime_filter_reply_new (true);
>  	if (reply_filter) {
>  	    g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter),
>  				      reply_filter);
> @@ -350,7 +350,7 @@ do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
>      for (unsigned int i = 0; i < array_map_len; i++) {
>  	if (errors & key_map[i].bit) {
>  	    sp->map_key (sp, key_map[i].string);
> -	    sp->boolean (sp, TRUE);
> +	    sp->boolean (sp, true);
>  	}
>      }
>  
> @@ -490,7 +490,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
>      GMimeObject *meta = node->envelope_part ?
>  	GMIME_OBJECT (node->envelope_part) : node->part;
>      GMimeContentType *content_type = g_mime_object_get_content_type (meta);
> -    const notmuch_bool_t leaf = GMIME_IS_PART (node->part);
> +    const bool leaf = GMIME_IS_PART (node->part);
>      GMimeStream *stream = params->out_stream;
>      const char *part_type;
>      int i;
> @@ -603,8 +603,8 @@ format_omitted_part_meta_sprinter (sprinter_t *sp, GMimeObject *meta, GMimePart
>  
>  void
>  format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
> -		      notmuch_bool_t output_body,
> -		      notmuch_bool_t include_html)
> +		      bool output_body,
> +		      bool include_html)
>  {
>      /* Any changes to the JSON or S-Expression format should be
>       * reflected in the file devel/schemata. */
> @@ -614,12 +614,12 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
>  	format_message_sprinter (sp, node->envelope_file);
>  
>  	sp->map_key (sp, "headers");
> -	format_headers_sprinter (sp, GMIME_MESSAGE (node->part), FALSE);
> +	format_headers_sprinter (sp, GMIME_MESSAGE (node->part), false);
>  
>  	if (output_body) {
>  	    sp->map_key (sp, "body");
>  	    sp->begin_list (sp);
> -	    format_part_sprinter (ctx, sp, mime_node_child (node, 0), TRUE, include_html);
> +	    format_part_sprinter (ctx, sp, mime_node_child (node, 0), true, include_html);
>  	    sp->end (sp);
>  	}
>  	sp->end (sp);
> @@ -713,7 +713,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
>  	sp->begin_map (sp);
>  
>  	sp->map_key (sp, "headers");
> -	format_headers_sprinter (sp, GMIME_MESSAGE (node->part), FALSE);
> +	format_headers_sprinter (sp, GMIME_MESSAGE (node->part), false);
>  
>  	sp->map_key (sp, "body");
>  	sp->begin_list (sp);
> @@ -721,7 +721,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
>      }
>  
>      for (i = 0; i < node->nchildren; i++)
> -	format_part_sprinter (ctx, sp, mime_node_child (node, i), TRUE, include_html);
> +	format_part_sprinter (ctx, sp, mime_node_child (node, i), true, include_html);
>  
>      /* Close content structures */
>      for (i = 0; i < nclose; i++)
> @@ -898,8 +898,8 @@ show_messages (void *ctx,
>  	       notmuch_show_params_t *params)
>  {
>      notmuch_message_t *message;
> -    notmuch_bool_t match;
> -    notmuch_bool_t excluded;
> +    bool match;
> +    bool excluded;
>      int next_indent;
>      notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
>  
> @@ -1081,13 +1081,13 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
>      sprinter_t *sprinter;
>      notmuch_show_params_t params = {
>  	.part = -1,
> -	.omit_excluded = TRUE,
> -	.output_body = TRUE,
> +	.omit_excluded = true,
> +	.output_body = true,
>      };
>      int format = NOTMUCH_FORMAT_NOT_SPECIFIED;
> -    notmuch_bool_t exclude = TRUE;
> -    notmuch_bool_t entire_thread_set = FALSE;
> -    notmuch_bool_t single_message;
> +    bool exclude = true;
> +    bool entire_thread_set = false;
> +    bool single_message;
>  
>      notmuch_opt_desc_t options[] = {
>  	{ .opt_keyword = &format, .name = "format", .keywords =
> @@ -1118,7 +1118,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
>  
>      /* decryption implies verification */
>      if (params.crypto.decrypt)
> -	params.crypto.verify = TRUE;
> +	params.crypto.verify = true;
>  
>      /* specifying a part implies single message display */
>      single_message = params.part >= 0;
> @@ -1138,21 +1138,21 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
>  	}
>      } else if (format == NOTMUCH_FORMAT_RAW) {
>  	/* raw format only supports single message display */
> -	single_message = TRUE;
> +	single_message = true;
>      }
>  
>      notmuch_exit_if_unsupported_format ();
>  
> -    /* Default is entire-thread = FALSE except for format=json and
> +    /* Default is entire-thread = false except for format=json and
>       * format=sexp. */
>      if (! entire_thread_set &&
>  	(format == NOTMUCH_FORMAT_JSON || format == NOTMUCH_FORMAT_SEXP))
> -	params.entire_thread = TRUE;
> +	params.entire_thread = true;
>  
>      if (!params.output_body) {
>  	if (params.part > 0) {
>  	    fprintf (stderr, "Warning: --body=false is incompatible with --part > 0. Disabling.\n");
> -	    params.output_body = TRUE;
> +	    params.output_body = true;
>  	} else {
>  	    if (format != NOTMUCH_FORMAT_JSON && format != NOTMUCH_FORMAT_SEXP)
>  		fprintf (stderr,
> @@ -1222,9 +1222,9 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
>  	    }
>  	}
>  
> -	if (exclude == FALSE) {
> -	    notmuch_query_set_omit_excluded (query, FALSE);
> -	    params.omit_excluded = FALSE;
> +	if (exclude == false) {
> +	    notmuch_query_set_omit_excluded (query, false);
> +	    params.omit_excluded = false;
>  	}
>  
>  	ret = do_show (config, query, formatter, sprinter, &params);
> diff --git a/notmuch-tag.c b/notmuch-tag.c
> index 630efa65399c..05b1837d7c50 100644
> --- a/notmuch-tag.c
> +++ b/notmuch-tag.c
> @@ -194,8 +194,8 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[])
>      notmuch_database_t *notmuch;
>      struct sigaction action;
>      tag_op_flag_t tag_flags = TAG_FLAG_NONE;
> -    notmuch_bool_t batch = FALSE;
> -    notmuch_bool_t remove_all = FALSE;
> +    bool batch = false;
> +    bool remove_all = false;
>      FILE *input = stdin;
>      const char *input_file_name = NULL;
>      int opt_index;
> @@ -223,7 +223,7 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[])
>      notmuch_process_shared_options (argv[0]);
>  
>      if (input_file_name) {
> -	batch = TRUE;
> +	batch = true;
>  	input = fopen (input_file_name, "r");
>  	if (input == NULL) {
>  	    fprintf (stderr, "Error opening %s for reading: %s\n",
> diff --git a/notmuch.c b/notmuch.c
> index cc9c34aefb30..02148f2e3bf6 100644
> --- a/notmuch.c
> +++ b/notmuch.c
> @@ -46,7 +46,7 @@ notmuch_command (notmuch_config_t *config, int argc, char *argv[]);
>  static int
>  _help_for (const char *topic);
>  
> -static notmuch_bool_t print_version = FALSE, print_help = FALSE;
> +static bool print_version = false, print_help = false;
>  const char *notmuch_requested_db_uuid = NULL;
>  
>  const notmuch_opt_desc_t notmuch_shared_options [] = {
> @@ -371,13 +371,13 @@ notmuch_command (notmuch_config_t *config,
>   * is).
>   *
>   * Does not return if the external command is found and
> - * executed. Return TRUE if external command is not found. Return
> - * FALSE on errors.
> + * executed. Return true if external command is not found. Return
> + * false on errors.
>   */
> -static notmuch_bool_t try_external_command(char *argv[])
> +static bool try_external_command(char *argv[])
>  {
>      char *old_argv0 = argv[0];
> -    notmuch_bool_t ret = TRUE;
> +    bool ret = true;
>  
>      argv[0] = talloc_asprintf (NULL, "notmuch-%s", old_argv0);
>  
> @@ -389,7 +389,7 @@ static notmuch_bool_t try_external_command(char *argv[])
>      if (errno != ENOENT) {
>  	fprintf (stderr, "Error: Running external command '%s' failed: %s\n",
>  		 argv[0], strerror(errno));
> -	ret = FALSE;
> +	ret = false;
>      }
>  
>      talloc_free (argv[0]);
> diff --git a/sprinter-json.c b/sprinter-json.c
> index 0a077907cd83..c6ec857720d9 100644
> --- a/sprinter-json.c
> +++ b/sprinter-json.c
> @@ -13,14 +13,14 @@ struct sprinter_json {
>      /* A flag to signify that a separator should be inserted in the
>       * output as soon as possible.
>       */
> -    notmuch_bool_t insert_separator;
> +    bool insert_separator;
>  };
>  
>  struct json_state {
>      struct json_state *parent;
>      /* True if nothing has been printed in this aggregate yet.
>       * Suppresses the comma before a value. */
> -    notmuch_bool_t first;
> +    bool first;
>      /* The character that closes the current aggregate. */
>      char close;
>  };
> @@ -37,12 +37,12 @@ json_begin_value (struct sprinter *sp)
>  	    fputc (',', spj->stream);
>  	    if (spj->insert_separator) {
>  		fputc ('\n', spj->stream);
> -		spj->insert_separator = FALSE;
> +		spj->insert_separator = false;
>  	    } else {
>  		fputc (' ', spj->stream);
>  	    }
>  	} else {
> -	    spj->state->first = FALSE;
> +	    spj->state->first = false;
>  	}
>      }
>      return spj;
> @@ -58,7 +58,7 @@ json_begin_aggregate (struct sprinter *sp, char open, char close)
>  
>      fputc (open, spj->stream);
>      state->parent = spj->state;
> -    state->first = TRUE;
> +    state->first = true;
>      state->close = close;
>      spj->state = state;
>  }
> @@ -132,7 +132,7 @@ json_integer (struct sprinter *sp, int val)
>  }
>  
>  static void
> -json_boolean (struct sprinter *sp, notmuch_bool_t val)
> +json_boolean (struct sprinter *sp, bool val)
>  {
>      struct sprinter_json *spj = json_begin_value (sp);
>  
> @@ -154,7 +154,7 @@ json_map_key (struct sprinter *sp, const char *key)
>  
>      json_string (sp, key);
>      fputs (": ", spj->stream);
> -    spj->state->first = TRUE;
> +    spj->state->first = true;
>  }
>  
>  static void
> @@ -167,7 +167,7 @@ json_separator (struct sprinter *sp)
>  {
>      struct sprinter_json *spj = (struct sprinter_json *) sp;
>  
> -    spj->insert_separator = TRUE;
> +    spj->insert_separator = true;
>  }
>  
>  struct sprinter *
> @@ -186,7 +186,7 @@ sprinter_json_create (const void *ctx, FILE *stream)
>  	    .map_key = json_map_key,
>  	    .separator = json_separator,
>  	    .set_prefix = json_set_prefix,
> -	    .is_text_printer = FALSE,
> +	    .is_text_printer = false,
>  	}
>      };
>      struct sprinter_json *res;
> diff --git a/sprinter-sexp.c b/sprinter-sexp.c
> index 08783e11d3bd..6891ea4254f8 100644
> --- a/sprinter-sexp.c
> +++ b/sprinter-sexp.c
> @@ -33,7 +33,7 @@ struct sprinter_sexp {
>  
>      /* A flag to signify that a separator should be inserted in the
>       * output as soon as possible. */
> -    notmuch_bool_t insert_separator;
> +    bool insert_separator;
>  };
>  
>  struct sexp_state {
> @@ -41,7 +41,7 @@ struct sexp_state {
>  
>      /* True if nothing has been printed in this aggregate yet.
>       * Suppresses the space before a value. */
> -    notmuch_bool_t first;
> +    bool first;
>  };
>  
>  /* Helper function to set up the stream to print a value.  If this
> @@ -55,12 +55,12 @@ sexp_begin_value (struct sprinter *sp)
>  	if (! sps->state->first) {
>  	    if (sps->insert_separator) {
>  		fputc ('\n', sps->stream);
> -		sps->insert_separator = FALSE;
> +		sps->insert_separator = false;
>  	    } else {
>  		fputc (' ', sps->stream);
>  	    }
>  	} else {
> -	    sps->state->first = FALSE;
> +	    sps->state->first = false;
>  	}
>      }
>      return sps;
> @@ -76,7 +76,7 @@ sexp_begin_aggregate (struct sprinter *sp)
>  
>      fputc ('(', sps->stream);
>      state->parent = sps->state;
> -    state->first = TRUE;
> +    state->first = true;
>      sps->state = state;
>  }
>  
> @@ -169,7 +169,7 @@ sexp_integer (struct sprinter *sp, int val)
>  }
>  
>  static void
> -sexp_boolean (struct sprinter *sp, notmuch_bool_t val)
> +sexp_boolean (struct sprinter *sp, bool val)
>  {
>      struct sprinter_sexp *sps = sexp_begin_value (sp);
>  
> @@ -202,7 +202,7 @@ sexp_separator (struct sprinter *sp)
>  {
>      struct sprinter_sexp *sps = (struct sprinter_sexp *) sp;
>  
> -    sps->insert_separator = TRUE;
> +    sps->insert_separator = true;
>  }
>  
>  struct sprinter *
> @@ -221,7 +221,7 @@ sprinter_sexp_create (const void *ctx, FILE *stream)
>  	    .map_key = sexp_map_key,
>  	    .separator = sexp_separator,
>  	    .set_prefix = sexp_set_prefix,
> -	    .is_text_printer = FALSE,
> +	    .is_text_printer = false,
>  	}
>      };
>      struct sprinter_sexp *res;
> diff --git a/sprinter-text.c b/sprinter-text.c
> index 7779488f99a3..648b54b1e886 100644
> --- a/sprinter-text.c
> +++ b/sprinter-text.c
> @@ -21,7 +21,7 @@ struct sprinter_text {
>      /* A flag to indicate if this is the first tag. Used in list of tags
>       * for summary.
>       */
> -    notmuch_bool_t first_tag;
> +    bool first_tag;
>  };
>  
>  static void
> @@ -52,7 +52,7 @@ text_integer (struct sprinter *sp, int val)
>  }
>  
>  static void
> -text_boolean (struct sprinter *sp, notmuch_bool_t val)
> +text_boolean (struct sprinter *sp, bool val)
>  {
>      struct sprinter_text *sptxt = (struct sprinter_text *) sp;
>  
> @@ -128,7 +128,7 @@ sprinter_text_create (const void *ctx, FILE *stream)
>  	    .map_key = text_map_key,
>  	    .separator = text_separator,
>  	    .set_prefix = text_set_prefix,
> -	    .is_text_printer = TRUE,
> +	    .is_text_printer = true,
>  	},
>      };
>      struct sprinter_text *res;
> diff --git a/sprinter.h b/sprinter.h
> index f859672f8b3f..9d2e9b6f7140 100644
> --- a/sprinter.h
> +++ b/sprinter.h
> @@ -1,7 +1,7 @@
>  #ifndef NOTMUCH_SPRINTER_H
>  #define NOTMUCH_SPRINTER_H
>  
> -/* Necessary for notmuch_bool_t */
> +/* Necessary for bool */
>  #include "notmuch-client.h"
>  
>  /* Structure printer interface. This is used to create output
> @@ -34,7 +34,7 @@ typedef struct sprinter {
>      void (*string) (struct sprinter *, const char *);
>      void (*string_len) (struct sprinter *, const char *, size_t);
>      void (*integer) (struct sprinter *, int);
> -    void (*boolean) (struct sprinter *, notmuch_bool_t);
> +    void (*boolean) (struct sprinter *, bool);
>      void (*null) (struct sprinter *);
>  
>      /* Print the key of a map's key/value pair. The char * must be UTF-8
> @@ -58,7 +58,7 @@ typedef struct sprinter {
>  
>      /* True if this is the special-cased plain text printer.
>       */
> -    notmuch_bool_t is_text_printer;
> +    bool is_text_printer;
>  } sprinter_t;
>  
>  
> diff --git a/tag-util.c b/tag-util.c
> index d9fca7b832fd..1837b1aeafa3 100644
> --- a/tag-util.c
> +++ b/tag-util.c
> @@ -7,7 +7,7 @@
>  
>  struct _tag_operation_t {
>      const char *tag;
> -    notmuch_bool_t remove;
> +    bool remove;
>  };
>  
>  struct _tag_op_list_t {
> @@ -35,7 +35,7 @@ line_error (tag_parse_status_t status,
>  }
>  
>  const char *
> -illegal_tag (const char *tag, notmuch_bool_t remove)
> +illegal_tag (const char *tag, bool remove)
>  {
>      if (*tag == '\0' && ! remove)
>  	return "empty tag forbidden";
> @@ -84,7 +84,7 @@ parse_tag_line (void *ctx, char *line,
>  
>      /* Parse tags. */
>      while ((tok = strtok_len (tok + tok_len, " ", &tok_len)) != NULL) {
> -	notmuch_bool_t remove;
> +	bool remove;
>  	char *tag;
>  
>  	/* Optional explicit end of tags marker. */
> @@ -168,7 +168,7 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
>  	if (argv[i][0] != '+' && argv[i][0] != '-')
>  	    break;
>  
> -	notmuch_bool_t is_remove = argv[i][0] == '-';
> +	bool is_remove = argv[i][0] == '-';
>  	const char *msg;
>  
>  	msg = illegal_tag (argv[i] + 1, is_remove);
> @@ -215,7 +215,7 @@ makes_changes (notmuch_message_t *message,
>      size_t i;
>  
>      notmuch_tags_t *tags;
> -    notmuch_bool_t changes = FALSE;
> +    bool changes = false;
>  
>      /* First, do we delete an existing tag? */
>      for (tags = notmuch_message_get_tags (message);
> @@ -239,11 +239,11 @@ makes_changes (notmuch_message_t *message,
>      notmuch_tags_destroy (tags);
>  
>      if (changes)
> -	return TRUE;
> +	return true;
>  
>      /* Now check for adding new tags */
>      for (i = 0; i < list->count; i++) {
> -	notmuch_bool_t exists = FALSE;
> +	bool exists = false;
>  
>  	if (list->ops[i].remove)
>  	    continue;
> @@ -253,7 +253,7 @@ makes_changes (notmuch_message_t *message,
>  	     notmuch_tags_move_to_next (tags)) {
>  	    const char *cur_tag = notmuch_tags_get (tags);
>  	    if (strcmp (cur_tag, list->ops[i].tag) == 0) {
> -		exists = TRUE;
> +		exists = true;
>  		break;
>  	    }
>  	}
> @@ -264,9 +264,9 @@ makes_changes (notmuch_message_t *message,
>  	 * but this is OK from a correctness point of view
>  	 */
>  	if (! exists)
> -	    return TRUE;
> +	    return true;
>      }
> -    return FALSE;
> +    return false;
>  
>  }
>  
> @@ -359,7 +359,7 @@ tag_op_list_create (void *ctx)
>  int
>  tag_op_list_append (tag_op_list_t *list,
>  		    const char *tag,
> -		    notmuch_bool_t remove)
> +		    bool remove)
>  {
>      /* Make room if current array is full.  This should be a fairly
>       * rare case, considering the initial array size.
> @@ -387,7 +387,7 @@ tag_op_list_append (tag_op_list_t *list,
>   *   Is the i'th tag operation a remove?
>   */
>  
> -notmuch_bool_t
> +bool
>  tag_op_list_isremove (const tag_op_list_t *list, size_t i)
>  {
>      assert (i < list->count);
> diff --git a/tag-util.h b/tag-util.h
> index 8a4074ce168f..a2f0ddfaa280 100644
> --- a/tag-util.h
> +++ b/tag-util.h
> @@ -99,7 +99,7 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
>   *	   explanatory message otherwise.
>   */
>  const char *
> -illegal_tag (const char *tag, notmuch_bool_t remove);
> +illegal_tag (const char *tag, bool remove);
>  
>  /*
>   * Create an empty list of tag operations
> @@ -111,14 +111,14 @@ tag_op_list_t *
>  tag_op_list_create (void *ctx);
>  
>  /*
> - * Add a tag operation (delete iff remove == TRUE) to a list.
> + * Add a tag operation (delete iff remove == true) to a list.
>   * The list is expanded as necessary.
>   */
>  
>  int
>  tag_op_list_append (tag_op_list_t *list,
>  		    const char *tag,
> -		    notmuch_bool_t remove);
> +		    bool remove);
>  
>  /*
>   * Apply a list of tag operations, in order, to a given message.
> @@ -157,7 +157,7 @@ tag_op_list_tag (const tag_op_list_t *list, size_t i);
>   *   Is the i'th tag operation a remove?
>   */
>  
> -notmuch_bool_t
> +bool
>  tag_op_list_isremove (const tag_op_list_t *list, size_t i);
>  
>  #endif
> diff --git a/test/arg-test.c b/test/arg-test.c
> index 64751df4ada1..7aff825507a5 100644
> --- a/test/arg-test.c
> +++ b/test/arg-test.c
> @@ -12,9 +12,9 @@ int main(int argc, char **argv){
>      const char *pos_arg1=NULL;
>      const char *pos_arg2=NULL;
>      const char *string_val=NULL;
> -    notmuch_bool_t bool_val = FALSE;
> -    notmuch_bool_t fl_set = FALSE, int_set = FALSE, bool_set = FALSE,
> -	kw_set = FALSE, string_set = FALSE, pos1_set = FALSE, pos2_set = FALSE;
> +    bool bool_val = false;
> +    bool fl_set = false, int_set = false, bool_set = false,
> +	kw_set = false, string_set = false, pos1_set = false, pos2_set = false;
>  
>      notmuch_opt_desc_t parent_options[] = {
>  	{ .opt_flags = &fl_val, .name = "flag", .present = &fl_set, .keywords =
> diff --git a/test/hex-xcode.c b/test/hex-xcode.c
> index 221ccdb90843..33046e9a5178 100644
> --- a/test/hex-xcode.c
> +++ b/test/hex-xcode.c
> @@ -16,7 +16,7 @@ enum direction {
>      DECODE
>  };
>  
> -static int inplace = FALSE;
> +static bool inplace = false;
>  
>  static int
>  xcode (void *ctx, enum direction dir, char *in, char **buf_p, size_t *size_p)
> @@ -45,7 +45,7 @@ main (int argc, char **argv)
>  {
>  
>      int dir = DECODE;
> -    notmuch_bool_t omit_newline = FALSE;
> +    bool omit_newline = false;
>  
>      notmuch_opt_desc_t options[] = {
>  	{ .opt_keyword = &dir, .name = "direction", .keywords =
> @@ -71,7 +71,7 @@ main (int argc, char **argv)
>      char *buffer = NULL;
>      size_t buf_size = 0;
>  
> -    notmuch_bool_t read_stdin = TRUE;
> +    bool read_stdin = true;
>  
>      for (; opt_index < argc; opt_index++) {
>  
> @@ -82,7 +82,7 @@ main (int argc, char **argv)
>  	if (! omit_newline)
>  	    putchar ('\n');
>  
> -	read_stdin = FALSE;
> +	read_stdin = false;
>      }
>  
>      if (! read_stdin)
> diff --git a/test/random-corpus.c b/test/random-corpus.c
> index e3b855e1efd8..9272afda8bed 100644
> --- a/test/random-corpus.c
> +++ b/test/random-corpus.c
> @@ -179,7 +179,7 @@ main (int argc, char **argv)
>  	exit (1);
>      }
>  
> -    config = notmuch_config_open (ctx, config_path, FALSE);
> +    config = notmuch_config_open (ctx, config_path, false);
>      if (config == NULL)
>  	return 1;
>  
> -- 
> 2.11.0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] cli: convert notmuch_bool_t to stdbool
  2017-10-07  8:44 [PATCH 1/2] cli: convert notmuch_bool_t to stdbool Jani Nikula
  2017-10-07  8:44 ` [PATCH 2/2] lib: convert notmuch_bool_t to stdbool internally Jani Nikula
  2017-10-07 17:05 ` [PATCH 1/2] cli: convert notmuch_bool_t to stdbool Tomi Ollila
@ 2017-10-09 22:24 ` Daniel Kahn Gillmor
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Kahn Gillmor @ 2017-10-09 22:24 UTC (permalink / raw)
  To: Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

On Sat 2017-10-07 11:44:04 +0300, Jani Nikula wrote:
> 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 cli and test binaries to stdbool.

+1 LGTM.

I'd also be interested in contemplating a switch to stdbool for the
library interface whenever we do the next ABI bump, but that's
presumably something to consider separately.

Thanks for this work, Jani.

    --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] lib: convert notmuch_bool_t to stdbool internally
  2017-10-07  8:44 ` [PATCH 2/2] lib: convert notmuch_bool_t to stdbool internally Jani Nikula
@ 2017-10-10  1:43   ` David Bremner
  0 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2017-10-10  1:43 UTC (permalink / raw)
  To: Jani Nikula, notmuch

Jani Nikula <jani@nikula.org> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-10  1:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-07  8:44 [PATCH 1/2] cli: convert notmuch_bool_t to stdbool Jani Nikula
2017-10-07  8:44 ` [PATCH 2/2] lib: convert notmuch_bool_t to stdbool internally Jani Nikula
2017-10-10  1:43   ` David Bremner
2017-10-07 17:05 ` [PATCH 1/2] cli: convert notmuch_bool_t to stdbool Tomi Ollila
2017-10-09 22:24 ` Daniel Kahn Gillmor

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).