[PATCH 4/8] cli: run uncrustify

Subject: [PATCH 4/8] cli: run uncrustify

Date: Thu, 13 Jun 2019 08:08:33 -0300

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


From: uncrustify <david@tethera.net>

This is the result of running

     $ uncrustify --replace --config devel/uncrustify.cfg *.c *.h

in the top level source directory
---
 command-line-arguments.c |  56 +++++++-----
 command-line-arguments.h |  32 +++----
 debugger.c               |   3 +-
 gmime-filter-reply.c     | 190 +++++++++++++++++++--------------------
 gmime-filter-reply.h     |  10 +--
 hooks.c                  |   4 +-
 mime-node.c              |  26 +++---
 notmuch-client.h         |  60 ++++++-------
 notmuch-config.c         | 126 +++++++++++++-------------
 notmuch-count.c          |  10 +--
 notmuch-dump.c           |  20 ++---
 notmuch-insert.c         |  10 +--
 notmuch-new.c            |  86 ++++++++----------
 notmuch-reindex.c        |   8 +-
 notmuch-reply.c          |  93 ++++++++++---------
 notmuch-restore.c        |  39 ++++----
 notmuch-search.c         | 144 +++++++++++++++--------------
 notmuch-setup.c          |  87 +++++++++---------
 notmuch-show.c           | 128 +++++++++++++-------------
 notmuch-time.c           |  17 ++--
 notmuch.c                |  49 +++++-----
 sprinter.h               |  22 ++---
 status.c                 |   4 +-
 tag-util.h               |  18 ++--
 24 files changed, 621 insertions(+), 621 deletions(-)

diff --git a/command-line-arguments.c b/command-line-arguments.c
index 6699c521..169b12a3 100644
--- a/command-line-arguments.c
+++ b/command-line-arguments.c
@@ -5,16 +5,16 @@
 #include "command-line-arguments.h"
 
 typedef enum {
-    OPT_FAILED, /* false */
-    OPT_OK, /* good */
-    OPT_GIVEBACK, /* pop one of the arguments you thought you were getting off the stack */
+    OPT_FAILED,         /* false */
+    OPT_OK,             /* good */
+    OPT_GIVEBACK,       /* pop one of the arguments you thought you were getting off the stack */
 } opt_handled;
 
 /*
-  Search the array of keywords for a given argument, assigning the
-  output variable to the corresponding value.  Return false if nothing
-  matches.
-*/
+ * Search the array of keywords for a given argument, assigning the
+ * output variable to the corresponding value.  Return false if nothing
+ * matches.
+ */
 
 static opt_handled
 _process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next,
@@ -84,9 +84,11 @@ _process_boolean_arg (const notmuch_opt_desc_t *arg_desc, char next,
 }
 
 static opt_handled
-_process_int_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
+_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 OPT_FAILED;
@@ -102,7 +104,8 @@ _process_int_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg
 }
 
 static opt_handled
-_process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
+_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);
@@ -117,7 +120,8 @@ _process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *
 }
 
 /* Return number of non-NULL opt_* fields in opt_desc. */
-static int _opt_set_count (const notmuch_opt_desc_t *opt_desc)
+static int
+_opt_set_count (const notmuch_opt_desc_t *opt_desc)
 {
     return
 	(bool) opt_desc->opt_inherit +
@@ -130,7 +134,8 @@ static int _opt_set_count (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)
+static bool
+_opt_valid (const notmuch_opt_desc_t *opt_desc)
 {
     int n = _opt_set_count (opt_desc);
 
@@ -142,15 +147,17 @@ static bool _opt_valid (const notmuch_opt_desc_t *opt_desc)
 }
 
 /*
-   Search for the {pos_arg_index}th position argument, return false if
-   that does not exist.
-*/
+ * Search for the {pos_arg_index}th position argument, return false if
+ * that does not exist.
+ */
 
 bool
 parse_position_arg (const char *arg_str, int pos_arg_index,
-		    const notmuch_opt_desc_t *arg_desc) {
+		    const notmuch_opt_desc_t *arg_desc)
+{
 
     int pos_arg_counter = 0;
+
     while (_opt_valid (arg_desc)) {
 	if (arg_desc->opt_position) {
 	    if (pos_arg_counter == pos_arg_index) {
@@ -176,12 +183,12 @@ parse_position_arg (const char *arg_str, int pos_arg_index,
 int
 parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_index)
 {
-    assert(argv);
+    assert (argv);
 
     const char *_arg = argv[opt_index];
 
-    assert(_arg);
-    assert(options);
+    assert (_arg);
+    assert (options);
 
     const char *arg = _arg + 2; /* _arg starts with -- */
     const char *negative_arg = NULL;
@@ -239,7 +246,7 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
 	if (lookahead) {
 	    next = ' ';
 	    value = next_arg;
-	    opt_index ++;
+	    opt_index++;
 	}
 
 	opt_handled opt_status = OPT_FAILED;
@@ -258,12 +265,12 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
 	    return -1;
 
 	if (lookahead && opt_status == OPT_GIVEBACK)
-	    opt_index --;
+	    opt_index--;
 
 	if (try->present)
 	    *try->present = true;
 
-	return opt_index+1;
+	return opt_index + 1;
     }
     return -1;
 }
@@ -271,13 +278,14 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
 /* See command-line-arguments.h for description */
 int
 parse_arguments (int argc, char **argv,
-		 const notmuch_opt_desc_t *options, int opt_index) {
+		 const notmuch_opt_desc_t *options, int opt_index)
+{
 
     int pos_arg_index = 0;
     bool more_args = true;
 
     while (more_args && opt_index < argc) {
-	if (strncmp (argv[opt_index],"--",2) != 0) {
+	if (strncmp (argv[opt_index], "--", 2) != 0) {
 
 	    more_args = parse_position_arg (argv[opt_index], pos_arg_index, options);
 
@@ -290,7 +298,7 @@ parse_arguments (int argc, char **argv,
 	    int prev_opt_index = opt_index;
 
 	    if (strlen (argv[opt_index]) == 2)
-		return opt_index+1;
+		return opt_index + 1;
 
 	    opt_index = parse_option (argc, argv, options, opt_index);
 	    if (opt_index < 0) {
diff --git a/command-line-arguments.h b/command-line-arguments.h
index f722f97d..606e5cd0 100644
--- a/command-line-arguments.h
+++ b/command-line-arguments.h
@@ -45,20 +45,20 @@ typedef struct notmuch_opt_desc {
 
 
 /*
-  This is the main entry point for command line argument parsing.
-
-  Parse command line arguments according to structure options,
-  starting at position opt_index.
-
-  All output of parsed values is via pointers in options.
-
-  Parsing stops at -- (consumed) or at the (k+1)st argument
-  not starting with -- (a "positional argument") if options contains
-  k positional argument descriptors.
-
-  Returns the index of first non-parsed argument, or -1 in case of error.
-
-*/
+ * This is the main entry point for command line argument parsing.
+ *
+ * Parse command line arguments according to structure options,
+ * starting at position opt_index.
+ *
+ * All output of parsed values is via pointers in options.
+ *
+ * Parsing stops at -- (consumed) or at the (k+1)st argument
+ * not starting with -- (a "positional argument") if options contains
+ * k positional argument descriptors.
+ *
+ * Returns the index of first non-parsed argument, or -1 in case of error.
+ *
+ */
 int
 parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_index);
 
@@ -71,12 +71,12 @@ 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);
+parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_index);
 
 bool
 parse_position_arg (const char *arg,
 		    int position_arg_index,
-		    const notmuch_opt_desc_t* options);
+		    const notmuch_opt_desc_t *options);
 
 
 #endif
diff --git a/debugger.c b/debugger.c
index 0febf170..5f47a1d7 100644
--- a/debugger.c
+++ b/debugger.c
@@ -39,8 +39,7 @@ debugger_is_active (void)
 
     sprintf (buf, "/proc/%d/exe", getppid ());
     if (readlink (buf, buf2, sizeof (buf2)) != -1 &&
-	strncmp (basename (buf2), "gdb", 3) == 0)
-    {
+	strncmp (basename (buf2), "gdb", 3) == 0) {
 	return true;
     }
 
diff --git a/gmime-filter-reply.c b/gmime-filter-reply.c
index 480d9381..2b067669 100644
--- a/gmime-filter-reply.c
+++ b/gmime-filter-reply.c
@@ -47,143 +47,143 @@ static GMimeFilterClass *parent_class = NULL;
 GType
 g_mime_filter_reply_get_type (void)
 {
-	static GType type = 0;
-
-	if (!type) {
-		static const GTypeInfo info = {
-			.class_size = sizeof (GMimeFilterReplyClass),
-			.base_init = NULL,
-			.base_finalize = NULL,
-			.class_init = (GClassInitFunc) g_mime_filter_reply_class_init,
-			.class_finalize = NULL,
-			.class_data = NULL,
-			.instance_size = sizeof (GMimeFilterReply),
-			.n_preallocs = 0,
-			.instance_init = (GInstanceInitFunc) g_mime_filter_reply_init,
-			.value_table = NULL,
-		};
-
-		type = g_type_register_static (GMIME_TYPE_FILTER, "GMimeFilterReply", &info, (GTypeFlags) 0);
-	}
-
-	return type;
+    static GType type = 0;
+
+    if (! type) {
+	static const GTypeInfo info = {
+	    .class_size = sizeof (GMimeFilterReplyClass),
+	    .base_init = NULL,
+	    .base_finalize = NULL,
+	    .class_init = (GClassInitFunc) g_mime_filter_reply_class_init,
+	    .class_finalize = NULL,
+	    .class_data = NULL,
+	    .instance_size = sizeof (GMimeFilterReply),
+	    .n_preallocs = 0,
+	    .instance_init = (GInstanceInitFunc) g_mime_filter_reply_init,
+	    .value_table = NULL,
+	};
+
+	type = g_type_register_static (GMIME_TYPE_FILTER, "GMimeFilterReply", &info, (GTypeFlags) 0);
+    }
+
+    return type;
 }
 
 
 static void
 g_mime_filter_reply_class_init (GMimeFilterReplyClass *klass, unused (void *class_data))
 {
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	GMimeFilterClass *filter_class = GMIME_FILTER_CLASS (klass);
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GMimeFilterClass *filter_class = GMIME_FILTER_CLASS (klass);
 
-	parent_class = (GMimeFilterClass *) g_type_class_ref (GMIME_TYPE_FILTER);
+    parent_class = (GMimeFilterClass *) g_type_class_ref (GMIME_TYPE_FILTER);
 
-	object_class->finalize = g_mime_filter_reply_finalize;
+    object_class->finalize = g_mime_filter_reply_finalize;
 
-	filter_class->copy = filter_copy;
-	filter_class->filter = filter_filter;
-	filter_class->complete = filter_complete;
-	filter_class->reset = filter_reset;
+    filter_class->copy = filter_copy;
+    filter_class->filter = filter_filter;
+    filter_class->complete = filter_complete;
+    filter_class->reset = filter_reset;
 }
 
 static void
 g_mime_filter_reply_init (GMimeFilterReply *filter, GMimeFilterReplyClass *klass)
 {
-	(void) klass;
-	filter->saw_nl = true;
-	filter->saw_angle = false;
+    (void) klass;
+    filter->saw_nl = true;
+    filter->saw_angle = false;
 }
 
 static void
 g_mime_filter_reply_finalize (GObject *object)
 {
-	G_OBJECT_CLASS (parent_class)->finalize (object);
+    G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 
 static GMimeFilter *
 filter_copy (GMimeFilter *filter)
 {
-	GMimeFilterReply *reply = (GMimeFilterReply *) filter;
+    GMimeFilterReply *reply = (GMimeFilterReply *) filter;
 
-	return g_mime_filter_reply_new (reply->encode);
+    return g_mime_filter_reply_new (reply->encode);
 }
 
 static void
 filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
 	       char **outbuf, size_t *outlen, size_t *outprespace)
 {
-	GMimeFilterReply *reply = (GMimeFilterReply *) filter;
-	const char *inptr = inbuf;
-	const char *inend = inbuf + inlen;
-	char *outptr;
-
-	(void) prespace;
-	if (reply->encode) {
-		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;
-			}
-			if (*inptr == '\n')
-				reply->saw_nl = true;
-			else
-				reply->saw_nl = false;
-			if (*inptr != '\r')
-				*outptr++ = *inptr;
-			inptr++;
-		}
-	} else {
-		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;
-				else
-					*outptr++ = *inptr;
-				reply->saw_nl = false;
-			} else if (reply->saw_angle) {
-				if (*inptr == ' ')
-					;
-				else
-					*outptr++ = *inptr;
-				reply->saw_angle = false;
-			} else if (*inptr != '\r') {
-				if (*inptr == '\n')
-					reply->saw_nl = true;
-				*outptr++ = *inptr;
-			}
-
-			inptr++;
-		}
+    GMimeFilterReply *reply = (GMimeFilterReply *) filter;
+    const char *inptr = inbuf;
+    const char *inend = inbuf + inlen;
+    char *outptr;
+
+    (void) prespace;
+    if (reply->encode) {
+	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;
+	    }
+	    if (*inptr == '\n')
+		reply->saw_nl = true;
+	    else
+		reply->saw_nl = false;
+	    if (*inptr != '\r')
+		*outptr++ = *inptr;
+	    inptr++;
+	}
+    } else {
+	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;
+		else
+		    *outptr++ = *inptr;
+		reply->saw_nl = false;
+	    } else if (reply->saw_angle) {
+		if (*inptr == ' ')
+		    ;
+		else
+		    *outptr++ = *inptr;
+		reply->saw_angle = false;
+	    } else if (*inptr != '\r') {
+		if (*inptr == '\n')
+		    reply->saw_nl = true;
+		*outptr++ = *inptr;
+	    }
+
+	    inptr++;
 	}
+    }
 
-	*outlen = outptr - filter->outbuf;
-	*outprespace = filter->outpre;
-	*outbuf = filter->outbuf;
+    *outlen = outptr - filter->outbuf;
+    *outprespace = filter->outpre;
+    *outbuf = filter->outbuf;
 }
 
 static void
 filter_complete (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
 		 char **outbuf, size_t *outlen, size_t *outprespace)
 {
-	if (inbuf && inlen)
-		filter_filter (filter, inbuf, inlen, prespace, outbuf, outlen, outprespace);
+    if (inbuf && inlen)
+	filter_filter (filter, inbuf, inlen, prespace, outbuf, outlen, outprespace);
 }
 
 static void
 filter_reset (GMimeFilter *filter)
 {
-	GMimeFilterReply *reply = (GMimeFilterReply *) filter;
+    GMimeFilterReply *reply = (GMimeFilterReply *) filter;
 
-	reply->saw_nl = true;
-	reply->saw_angle = false;
+    reply->saw_nl = true;
+    reply->saw_angle = false;
 }
 
 
@@ -202,11 +202,11 @@ filter_reset (GMimeFilter *filter)
 GMimeFilter *
 g_mime_filter_reply_new (gboolean encode)
 {
-	GMimeFilterReply *new_reply;
+    GMimeFilterReply *new_reply;
 
-	new_reply = (GMimeFilterReply *) g_object_new (GMIME_TYPE_FILTER_REPLY, NULL);
-	new_reply->encode = encode;
+    new_reply = (GMimeFilterReply *) g_object_new (GMIME_TYPE_FILTER_REPLY, NULL);
+    new_reply->encode = encode;
 
-	return (GMimeFilter *) new_reply;
+    return (GMimeFilter *) new_reply;
 }
 
diff --git a/gmime-filter-reply.h b/gmime-filter-reply.h
index b7cbc6b1..5a1e606e 100644
--- a/gmime-filter-reply.h
+++ b/gmime-filter-reply.h
@@ -43,15 +43,15 @@ typedef struct _GMimeFilterReplyClass GMimeFilterReplyClass;
  * A filter to insert/remove reply markers (lines beginning with >)
  **/
 struct _GMimeFilterReply {
-	GMimeFilter parent_object;
+    GMimeFilter parent_object;
 
-	gboolean encode;
-	gboolean saw_nl;
-	gboolean saw_angle;
+    gboolean encode;
+    gboolean saw_nl;
+    gboolean saw_angle;
 };
 
 struct _GMimeFilterReplyClass {
-	GMimeFilterClass parent_class;
+    GMimeFilterClass parent_class;
 
 };
 
diff --git a/hooks.c b/hooks.c
index 7348d322..59c58070 100644
--- a/hooks.c
+++ b/hooks.c
@@ -53,7 +53,7 @@ notmuch_run_hook (const char *db_path, const char *hook)
     /* Flush any buffered output before forking. */
     fflush (stdout);
 
-    pid = fork();
+    pid = fork ();
     if (pid == -1) {
 	fprintf (stderr, "Error: %s hook fork failed: %s\n", hook,
 		 strerror (errno));
@@ -78,7 +78,7 @@ notmuch_run_hook (const char *db_path, const char *hook)
 	goto DONE;
     }
 
-    if (!WIFEXITED (status) || WEXITSTATUS (status)) {
+    if (! WIFEXITED (status) || WEXITSTATUS (status)) {
 	if (WIFEXITED (status)) {
 	    fprintf (stderr, "Error: %s hook failed with status %d\n",
 		     hook, WEXITSTATUS (status));
diff --git a/mime-node.c b/mime-node.c
index 4ca51fe9..3133ca44 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -55,7 +55,7 @@ _mime_node_context_free (mime_node_context_t *res)
     return 0;
 }
 
-const _notmuch_message_crypto_t*
+const _notmuch_message_crypto_t *
 mime_node_get_message_crypto_status (mime_node_t *node)
 {
     return node->ctx->msg_crypto;
@@ -97,8 +97,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
 	notmuch_filenames_t *filenames;
 	for (filenames = notmuch_message_get_filenames (message);
 	     notmuch_filenames_valid (filenames);
-	     notmuch_filenames_move_to_next (filenames))
-	{
+	     notmuch_filenames_move_to_next (filenames)) {
 	    filename = notmuch_filenames_get (filenames);
 	    fd = open (filename, O_RDONLY);
 	    if (fd != -1)
@@ -109,27 +108,27 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
 	if (fd == -1) {
 	    /* Give up */
 	    fprintf (stderr, "Error opening %s: %s\n", filename, strerror (errno));
-		status = NOTMUCH_STATUS_FILE_ERROR;
-		goto DONE;
-	    }
+	    status = NOTMUCH_STATUS_FILE_ERROR;
+	    goto DONE;
 	}
+    }
 
     mctx->stream = g_mime_stream_gzfile_new (fd);
-    if (!mctx->stream) {
+    if (! mctx->stream) {
 	fprintf (stderr, "Out of memory.\n");
 	status = NOTMUCH_STATUS_OUT_OF_MEMORY;
 	goto DONE;
     }
 
     mctx->parser = g_mime_parser_new_with_stream (mctx->stream);
-    if (!mctx->parser) {
+    if (! mctx->parser) {
 	fprintf (stderr, "Out of memory.\n");
 	status = NOTMUCH_STATUS_OUT_OF_MEMORY;
 	goto DONE;
     }
 
     mctx->mime_message = g_mime_parser_construct_message (mctx->parser, NULL);
-    if (!mctx->mime_message) {
+    if (! mctx->mime_message) {
 	fprintf (stderr, "Failed to parse %s\n", filename);
 	status = NOTMUCH_STATUS_FILE_ERROR;
 	goto DONE;
@@ -153,7 +152,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
     *root_out = root;
     return NOTMUCH_STATUS_SUCCESS;
 
-DONE:
+  DONE:
     talloc_free (root);
     return status;
 }
@@ -171,6 +170,7 @@ static void
 set_signature_list_destructor (mime_node_t *node)
 {
     GMimeSignatureList **proxy = talloc (node, GMimeSignatureList *);
+
     if (proxy) {
 	*proxy = node->sig_list;
 	talloc_set_destructor (proxy, _signature_list_free);
@@ -259,7 +259,7 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part)
 	g_object_unref (decrypt_result);
     }
 
- DONE:
+  DONE:
     if (err)
 	g_error_free (err);
 }
@@ -273,7 +273,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part, int numchild)
     /* Set basic node properties */
     node->part = part;
     node->ctx = parent->ctx;
-    if (!talloc_reference (node, node->ctx)) {
+    if (! talloc_reference (node, node->ctx)) {
 	fprintf (stderr, "Out of memory.\n");
 	talloc_free (node);
 	return NULL;
@@ -335,7 +335,7 @@ mime_node_child (mime_node_t *parent, int child)
     GMimeObject *sub;
     mime_node_t *node;
 
-    if (!parent || !parent->part || child < 0 || child >= parent->nchildren)
+    if (! parent || ! parent->part || child < 0 || child >= parent->nchildren)
 	return NULL;
 
     if (GMIME_IS_MULTIPART (parent->part)) {
diff --git a/notmuch-client.h b/notmuch-client.h
index b3a501a9..d1b78017 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -55,7 +55,7 @@
 
 #define unused(x) x ## _unused __attribute__ ((unused))
 
-#define STRINGIFY(s) STRINGIFY_(s)
+#define STRINGIFY(s) STRINGIFY_ (s)
 #define STRINGIFY_(s) #s
 
 typedef struct mime_node mime_node_t;
@@ -63,10 +63,10 @@ struct sprinter;
 struct notmuch_show_params;
 
 typedef struct notmuch_show_format {
-    struct sprinter *(*new_sprinter) (const void *ctx, FILE *stream);
-    notmuch_status_t (*part) (const void *ctx, struct sprinter *sprinter,
-			      struct mime_node *node, int indent,
-			      const struct notmuch_show_params *params);
+    struct sprinter *(*new_sprinter)(const void *ctx, FILE *stream);
+    notmuch_status_t (*part)(const void *ctx, struct sprinter *sprinter,
+			     struct mime_node *node, int indent,
+			     const struct notmuch_show_params *params);
 } notmuch_show_format_t;
 
 typedef struct notmuch_show_params {
@@ -85,12 +85,12 @@ typedef struct notmuch_show_params {
  *
  * Note that __location__ comes from talloc.h.
  */
-#define INTERNAL_ERROR(format, ...)			\
-    do {						\
-	fprintf(stderr,					\
-		"Internal error: " format " (%s)\n",	\
-		##__VA_ARGS__, __location__);		\
-	exit (1);					\
+#define INTERNAL_ERROR(format, ...)                     \
+    do {                                                \
+	fprintf (stderr,                                 \
+		 "Internal error: " format " (%s)\n",    \
+		 ##__VA_ARGS__, __location__);           \
+	exit (1);                                       \
     } while (0)
 
 #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
@@ -101,8 +101,8 @@ typedef struct notmuch_show_params {
 static inline void
 chomp_newline (char *str)
 {
-    if (str && str[strlen(str)-1] == '\n')
-	str[strlen(str)-1] = '\0';
+    if (str && str[strlen (str) - 1] == '\n')
+	str[strlen (str) - 1] = '\0';
 }
 
 /* Exit status code indicating temporary failure; user is invited to
@@ -251,8 +251,8 @@ json_quote_str (const void *ctx, const char *str);
 /* notmuch-config.c */
 
 typedef enum {
-    NOTMUCH_CONFIG_OPEN	= 1 << 0,
-    NOTMUCH_CONFIG_CREATE = 1 << 1,
+    NOTMUCH_CONFIG_OPEN		= 1 << 0,
+    NOTMUCH_CONFIG_CREATE	= 1 << 1,
 } notmuch_config_mode_t;
 
 notmuch_config_t *
@@ -328,8 +328,8 @@ notmuch_config_get_search_exclude_tags (notmuch_config_t *config, size_t *length
 
 void
 notmuch_config_set_search_exclude_tags (notmuch_config_t *config,
-				      const char *list[],
-				      size_t length);
+					const char *list[],
+					size_t length);
 
 int
 notmuch_run_hook (const char *db_path, const char *hook);
@@ -388,7 +388,7 @@ struct mime_node {
 
     /* The list of signatures for signed or encrypted containers. If
      * there are no signatures, this will be NULL. */
-    GMimeSignatureList* sig_list;
+    GMimeSignatureList *sig_list;
 
     /* Internal: Context inherited from the root iterator. */
     struct mime_node_context *ctx;
@@ -435,11 +435,11 @@ mime_node_t *
 mime_node_child (mime_node_t *parent, int child);
 
 /* Return the nth child of node in a depth-first traversal.  If n is
- * 0, returns node itself.  Returns NULL if there is no such part. */
+* 0, returns node itself.  Returns NULL if there is no such part. */
 mime_node_t *
 mime_node_seek_dfs (mime_node_t *node, int n);
 
-const _notmuch_message_crypto_t*
+const _notmuch_message_crypto_t *
 mime_node_get_message_crypto_status (mime_node_t *node);
 
 typedef enum dump_formats {
@@ -449,9 +449,9 @@ typedef enum dump_formats {
 } dump_format_t;
 
 typedef enum dump_includes {
-    DUMP_INCLUDE_TAGS = 1,
-    DUMP_INCLUDE_CONFIG = 2,
-    DUMP_INCLUDE_PROPERTIES = 4
+    DUMP_INCLUDE_TAGS		= 1,
+    DUMP_INCLUDE_CONFIG		= 2,
+    DUMP_INCLUDE_PROPERTIES	= 4
 } dump_include_t;
 
 #define DUMP_INCLUDE_DEFAULT (DUMP_INCLUDE_TAGS | DUMP_INCLUDE_CONFIG | DUMP_INCLUDE_PROPERTIES)
@@ -467,8 +467,8 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 		       bool gzip_output);
 
 /* If status is non-zero (i.e. error) print appropriate
-   messages to stderr.
-*/
+ * messages to stderr.
+ */
 
 notmuch_status_t
 print_status_query (const char *loc,
@@ -491,11 +491,11 @@ status_to_exit (notmuch_status_t status);
 #include "command-line-arguments.h"
 
 extern const char *notmuch_requested_db_uuid;
-extern const notmuch_opt_desc_t  notmuch_shared_options [];
+extern const notmuch_opt_desc_t notmuch_shared_options [];
 void notmuch_exit_if_unmatched_db_uuid (notmuch_database_t *notmuch);
 
-void notmuch_process_shared_options (const char* subcommand_name);
-int notmuch_minimal_options (const char* subcommand_name,
+void notmuch_process_shared_options (const char *subcommand_name);
+int notmuch_minimal_options (const char *subcommand_name,
 			     int argc, char **argv);
 
 
@@ -504,10 +504,10 @@ int notmuch_minimal_options (const char* subcommand_name,
 struct _notmuch_client_indexing_cli_choices {
     int decrypt_policy;
     bool decrypt_policy_set;
-    notmuch_indexopts_t * opts;
+    notmuch_indexopts_t *opts;
 };
 extern struct _notmuch_client_indexing_cli_choices indexing_cli_choices;
-extern const notmuch_opt_desc_t  notmuch_shared_indexing_options [];
+extern const notmuch_opt_desc_t notmuch_shared_indexing_options [];
 notmuch_status_t
 notmuch_process_shared_indexing_options (notmuch_database_t *notmuch);
 
diff --git a/notmuch-config.c b/notmuch-config.c
index b7f0784f..f16410a1 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -151,14 +151,14 @@ get_name_from_passwd_file (void *ctx)
     char *name;
     int e;
 
-    pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
+    pw_buf_size = sysconf (_SC_GETPW_R_SIZE_MAX);
     if (pw_buf_size == -1) pw_buf_size = 64;
     pw_buf = talloc_size (ctx, pw_buf_size);
 
     while ((e = getpwuid_r (getuid (), &passwd, pw_buf,
-                            pw_buf_size, &ignored)) == ERANGE) {
-        pw_buf_size = pw_buf_size * 2;
-        pw_buf = talloc_zero_size(ctx, pw_buf_size);
+			    pw_buf_size, &ignored)) == ERANGE) {
+	pw_buf_size = pw_buf_size * 2;
+	pw_buf = talloc_zero_size (ctx, pw_buf_size);
     }
 
     if (e == 0) {
@@ -186,14 +186,14 @@ get_username_from_passwd_file (void *ctx)
     char *name;
     int e;
 
-    pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
+    pw_buf_size = sysconf (_SC_GETPW_R_SIZE_MAX);
     if (pw_buf_size == -1) pw_buf_size = 64;
     pw_buf = talloc_zero_size (ctx, pw_buf_size);
 
     while ((e = getpwuid_r (getuid (), &passwd, pw_buf,
-                            pw_buf_size, &ignored)) == ERANGE) {
-        pw_buf_size = pw_buf_size * 2;
-        pw_buf = talloc_zero_size(ctx, pw_buf_size);
+			    pw_buf_size, &ignored)) == ERANGE) {
+	pw_buf_size = pw_buf_size * 2;
+	pw_buf = talloc_zero_size (ctx, pw_buf_size);
     }
 
     if (e == 0)
@@ -217,7 +217,7 @@ get_config_from_file (notmuch_config_t *config, bool create_new)
     GError *error = NULL;
     bool ret = false;
 
-    FILE *fp = fopen(config->filename, "r");
+    FILE *fp = fopen (config->filename, "r");
     if (fp == NULL) {
 	if (errno == ENOENT) {
 	    /* If create_new is true, then the caller is prepared for a
@@ -233,7 +233,7 @@ get_config_from_file (notmuch_config_t *config, bool create_new)
 	    }
 	} else {
 	    fprintf (stderr, "Error opening config file '%s': %s\n",
-		     config->filename, strerror(errno));
+		     config->filename, strerror (errno));
 	}
 	goto out;
     }
@@ -274,12 +274,12 @@ get_config_from_file (notmuch_config_t *config, bool create_new)
 
     g_error_free (error);
 
-out:
+  out:
     if (fp)
-	fclose(fp);
+	fclose (fp);
 
     if (config_str)
-	talloc_free(config_str);
+	talloc_free (config_str);
 
     return ret;
 }
@@ -300,20 +300,20 @@ out:
  *
  *	If is_new_ret is NULL, then a "file not found" message will be
  *	printed to stderr and NULL will be returned.
-
+ *
  *	If is_new_ret is non-NULL then a default configuration will be
  *	returned and *is_new_ret will be set to 1 on return so that
  *	the caller can recognize this case.
  *
- * 	These default configuration settings are determined as
- * 	follows:
+ *      These default configuration settings are determined as
+ *      follows:
  *
  *		database_path:		$MAILDIR, otherwise $HOME/mail
  *
  *		user_name:		$NAME variable if set, otherwise
  *					read from /etc/passwd
  *
- *		user_primary_mail: 	$EMAIL variable if set, otherwise
+ *		user_primary_mail:      $EMAIL variable if set, otherwise
  *					constructed from the username and
  *					hostname of the current machine.
  *
@@ -338,11 +338,12 @@ notmuch_config_open (void *ctx,
     int file_had_crypto_group;
 
     notmuch_config_t *config = talloc_zero (ctx, notmuch_config_t);
+
     if (config == NULL) {
 	fprintf (stderr, "Out of memory.\n");
 	return NULL;
     }
-    
+
     talloc_set_destructor (config, notmuch_config_destructor);
 
     /* non-zero defaults */
@@ -438,7 +439,7 @@ notmuch_config_open (void *ctx,
     }
 
     if (notmuch_config_get_new_tags (config, &tmp) == NULL) {
-        const char *tags[] = { "unread", "inbox" };
+	const char *tags[] = { "unread", "inbox" };
 	notmuch_config_set_new_tags (config, tags, 2);
     }
 
@@ -499,11 +500,11 @@ notmuch_config_open (void *ctx,
 }
 
 /* Close the given notmuch_config_t object, freeing all resources.
- * 
+ *
  * Note: Any changes made to the configuration are *not* saved by this
  * function. To save changes, call notmuch_config_save before
  * notmuch_config_close.
-*/
+ */
 void
 notmuch_config_close (notmuch_config_t *config)
 {
@@ -605,13 +606,13 @@ _config_get_list (notmuch_config_t *config,
 		  const char *section, const char *key,
 		  const char ***outlist, size_t *list_length, size_t *ret_length)
 {
-    assert(outlist);
+    assert (outlist);
 
     /* read from config file and cache value, if not cached already */
     if (*outlist == NULL) {
 
 	char **inlist = g_key_file_get_string_list (config->key_file,
-					     section, key, list_length, NULL);
+						    section, key, list_length, NULL);
 	if (inlist) {
 	    unsigned int i;
 
@@ -648,7 +649,7 @@ _config_set_list (notmuch_config_t *config,
 const char *
 notmuch_config_get_database_path (notmuch_config_t *config)
 {
-    char *db_path = (char *)_config_get (config, &config->database_path, "database", "path");
+    char *db_path = (char *) _config_get (config, &config->database_path, "database", "path");
 
     if (db_path && *db_path != '/') {
 	/* If the path in the configuration file begins with any
@@ -726,16 +727,16 @@ notmuch_config_set_user_other_email (notmuch_config_t *config,
 				     size_t length)
 {
     _config_set_list (config, "user", "other_email", list, length,
-		     &(config->user_other_email));
+		      &(config->user_other_email));
 }
 
 void
 notmuch_config_set_new_tags (notmuch_config_t *config,
-				     const char *list[],
-				     size_t length)
+			     const char *list[],
+			     size_t length)
 {
     _config_set_list (config, "new", "tags", list, length,
-		     &(config->new_tags));
+		      &(config->new_tags));
 }
 
 void
@@ -744,7 +745,7 @@ notmuch_config_set_new_ignore (notmuch_config_t *config,
 			       size_t length)
 {
     _config_set_list (config, "new", "ignore", list, length,
-		     &(config->new_ignore));
+		      &(config->new_ignore));
 }
 
 const char **
@@ -757,8 +758,8 @@ notmuch_config_get_search_exclude_tags (notmuch_config_t *config, size_t *length
 
 void
 notmuch_config_set_search_exclude_tags (notmuch_config_t *config,
-				      const char *list[],
-				      size_t length)
+					const char *list[],
+					size_t length)
 {
     _config_set_list (config, "search", "exclude_tags", list, length,
 		      &(config->search_exclude_tags));
@@ -779,7 +780,7 @@ _item_split (char *item, char **group, char **key)
     *group = item;
 
     period = strchr (item, '.');
-    if (period == NULL || *(period+1) == '\0') {
+    if (period == NULL || *(period + 1) == '\0') {
 	fprintf (stderr,
 		 "Invalid configuration name: %s\n"
 		 "(Should be of the form <section>.<item>)\n", item);
@@ -793,7 +794,7 @@ _item_split (char *item, char **group, char **key)
 }
 
 /* These are more properly called Xapian fields, but the user facing
-   docs call them prefixes, so make the error message match */
+ * docs call them prefixes, so make the error message match */
 static bool
 validate_field_name (const char *str)
 {
@@ -839,10 +840,10 @@ typedef struct config_key {
 } config_key_info_t;
 
 static struct config_key
-config_key_table[] = {
-    {"index.decrypt",	true,	false,	NULL},
-    {"index.header.",	true,	true,	validate_field_name},
-    {"query.",		true,	true,	NULL},
+    config_key_table[] = {
+    { "index.decrypt",   true,   false,  NULL },
+    { "index.header.",   true,   true,   validate_field_name },
+    { "query.",          true,   true,   NULL },
 };
 
 static config_key_info_t *
@@ -851,10 +852,10 @@ _config_key_info (const char *item)
     for (size_t i = 0; i < ARRAY_SIZE (config_key_table); i++) {
 	if (config_key_table[i].prefix &&
 	    strncmp (item, config_key_table[i].name,
-		     strlen(config_key_table[i].name)) == 0)
-	    return config_key_table+i;
+		     strlen (config_key_table[i].name)) == 0)
+	    return config_key_table + i;
 	if (strcmp (item, config_key_table[i].name) == 0)
-	    return config_key_table+i;
+	    return config_key_table + i;
     }
     return NULL;
 }
@@ -863,13 +864,14 @@ static bool
 _stored_in_db (const char *item)
 {
     config_key_info_t *info;
+
     info = _config_key_info (item);
 
     return (info && info->in_db);
 }
 
 static int
-_print_db_config(notmuch_config_t *config, const char *name)
+_print_db_config (notmuch_config_t *config, const char *name)
 {
     notmuch_database_t *notmuch;
     char *val;
@@ -884,7 +886,7 @@ _print_db_config(notmuch_config_t *config, const char *name)
 			       notmuch_database_get_config (notmuch, name, &val)))
 	return EXIT_FAILURE;
 
-     puts (val);
+    puts (val);
 
     return EXIT_SUCCESS;
 }
@@ -892,20 +894,20 @@ _print_db_config(notmuch_config_t *config, const char *name)
 static int
 notmuch_config_command_get (notmuch_config_t *config, char *item)
 {
-    if (strcmp(item, "database.path") == 0) {
+    if (strcmp (item, "database.path") == 0) {
 	printf ("%s\n", notmuch_config_get_database_path (config));
-    } else if (strcmp(item, "user.name") == 0) {
+    } else if (strcmp (item, "user.name") == 0) {
 	printf ("%s\n", notmuch_config_get_user_name (config));
-    } else if (strcmp(item, "user.primary_email") == 0) {
+    } else if (strcmp (item, "user.primary_email") == 0) {
 	printf ("%s\n", notmuch_config_get_user_primary_email (config));
-    } else if (strcmp(item, "user.other_email") == 0) {
+    } else if (strcmp (item, "user.other_email") == 0) {
 	const char **other_email;
 	size_t i, length;
-	
+
 	other_email = notmuch_config_get_user_other_email (config, &length);
 	for (i = 0; i < length; i++)
 	    printf ("%s\n", other_email[i]);
-    } else if (strcmp(item, "new.tags") == 0) {
+    } else if (strcmp (item, "new.tags") == 0) {
 	const char **tags;
 	size_t i, length;
 
@@ -944,7 +946,7 @@ notmuch_config_command_get (notmuch_config_t *config, char *item)
 }
 
 static int
-_set_db_config(notmuch_config_t *config, const char *key, int argc, char **argv)
+_set_db_config (notmuch_config_t *config, const char *key, int argc, char **argv)
 {
     notmuch_database_t *notmuch;
     const char *val = "";
@@ -1025,15 +1027,15 @@ static
 void
 _notmuch_config_list_built_with ()
 {
-    printf("%scompact=%s\n",
-	   BUILT_WITH_PREFIX,
-	   notmuch_built_with ("compact") ? "true" : "false");
-    printf("%sfield_processor=%s\n",
-	   BUILT_WITH_PREFIX,
-	   notmuch_built_with ("field_processor") ? "true" : "false");
-    printf("%sretry_lock=%s\n",
-	   BUILT_WITH_PREFIX,
-	   notmuch_built_with ("retry_lock") ? "true" : "false");
+    printf ("%scompact=%s\n",
+	    BUILT_WITH_PREFIX,
+	    notmuch_built_with ("compact") ? "true" : "false");
+    printf ("%sfield_processor=%s\n",
+	    BUILT_WITH_PREFIX,
+	    notmuch_built_with ("field_processor") ? "true" : "false");
+    printf ("%sretry_lock=%s\n",
+	    BUILT_WITH_PREFIX,
+	    notmuch_built_with ("retry_lock") ? "true" : "false");
 }
 
 static int
@@ -1054,11 +1056,11 @@ _list_db_config (notmuch_config_t *config)
 	return EXIT_FAILURE;
 
     for (; notmuch_config_list_valid (list); notmuch_config_list_move_to_next (list)) {
-	printf("%s=%s\n", notmuch_config_list_key (list), notmuch_config_list_value(list));
+	printf ("%s=%s\n", notmuch_config_list_key (list), notmuch_config_list_value (list));
     }
     notmuch_config_list_destroy (list);
 
-   return EXIT_SUCCESS;
+    return EXIT_SUCCESS;
 }
 
 static int
@@ -1115,8 +1117,8 @@ notmuch_config_command (notmuch_config_t *config, int argc, char *argv[])
 		 notmuch_requested_db_uuid);
 
     /* skip at least subcommand argument */
-    argc-= opt_index;
-    argv+= opt_index;
+    argc -= opt_index;
+    argv += opt_index;
 
     if (argc < 1) {
 	fprintf (stderr, "Error: notmuch config requires at least one argument.\n");
diff --git a/notmuch-count.c b/notmuch-count.c
index ca05c979..d8ad7d6d 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -165,10 +165,10 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
 
     notmuch_opt_desc_t options[] = {
 	{ .opt_keyword = &output, .name = "output", .keywords =
-	  (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },
-				  { "messages", OUTPUT_MESSAGES },
-				  { "files", OUTPUT_FILES },
-				  { 0, 0 } } },
+	      (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },
+				      { "messages", OUTPUT_MESSAGES },
+				      { "files", OUTPUT_FILES },
+				      { 0, 0 } } },
 	{ .opt_bool = &exclude, .name = "exclude" },
 	{ .opt_bool = &print_lastmod, .name = "lastmod" },
 	{ .opt_bool = &batch, .name = "batch" },
@@ -214,7 +214,7 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
 
     if (exclude) {
 	search_exclude_tags = notmuch_config_get_search_exclude_tags
-	    (config, &search_exclude_tags_length);
+				  (config, &search_exclude_tags_length);
     }
 
     if (batch)
diff --git a/notmuch-dump.c b/notmuch-dump.c
index ef2f02df..505c1469 100644
--- a/notmuch-dump.c
+++ b/notmuch-dump.c
@@ -56,7 +56,7 @@ database_dump_config (notmuch_database_t *notmuch, gzFile output)
 
     ret = EXIT_SUCCESS;
 
- DONE:
+  DONE:
     if (list)
 	notmuch_config_list_destroy (list);
 
@@ -220,7 +220,7 @@ database_dump_file (notmuch_database_t *notmuch, gzFile output,
 
     if (include & DUMP_INCLUDE_CONFIG) {
 	if (print_status_database ("notmuch dump", notmuch,
-				   database_dump_config(notmuch,output)))
+				   database_dump_config (notmuch, output)))
 	    return EXIT_FAILURE;
     }
 
@@ -307,7 +307,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 		 name_for_error, strerror (errno));
 	if (close (outfd))
 	    fprintf (stderr, "Error closing %s during shutdown: %s\n",
-		 name_for_error, strerror (errno));
+		     name_for_error, strerror (errno));
 	goto DONE;
     }
 
@@ -346,7 +346,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 	}
 
     }
- DONE:
+  DONE:
     if (ret != EXIT_SUCCESS && output)
 	(void) gzclose_w (output);
 
@@ -378,13 +378,13 @@ notmuch_dump_command (notmuch_config_t *config, int argc, char *argv[])
 
     notmuch_opt_desc_t options[] = {
 	{ .opt_keyword = &output_format, .name = "format", .keywords =
-	  (notmuch_keyword_t []){ { "sup", DUMP_FORMAT_SUP },
-				  { "batch-tag", DUMP_FORMAT_BATCH_TAG },
-				  { 0, 0 } } },
+	      (notmuch_keyword_t []){ { "sup", DUMP_FORMAT_SUP },
+				      { "batch-tag", DUMP_FORMAT_BATCH_TAG },
+				      { 0, 0 } } },
 	{ .opt_flags = &include, .name = "include", .keywords =
-	  (notmuch_keyword_t []){ { "config", DUMP_INCLUDE_CONFIG },
-				  { "properties", DUMP_INCLUDE_PROPERTIES },
-				  { "tags", DUMP_INCLUDE_TAGS} } },
+	      (notmuch_keyword_t []){ { "config", DUMP_INCLUDE_CONFIG },
+				      { "properties", DUMP_INCLUDE_PROPERTIES },
+				      { "tags", DUMP_INCLUDE_TAGS } } },
 	{ .opt_string = &output_file_name, .name = "output" },
 	{ .opt_bool = &gzip_output, .name = "gzip" },
 	{ .opt_inherit = notmuch_shared_options },
diff --git a/notmuch-insert.c b/notmuch-insert.c
index 327470d4..1d3b0150 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -99,7 +99,7 @@ is_valid_folder_name (const char *folder)
 	if ((p[0] == '.') && (p[1] == '.') && (p[2] == '\0' || p[2] == '/'))
 	    return false;
 	p = strchr (p, '/');
-	if (!p)
+	if (! p)
 	    return true;
 	p++;
     }
@@ -120,7 +120,7 @@ mkdir_recursive (const void *ctx, const char *path, int mode)
     /* First check the common case: directory already exists. */
     r = stat (path, &st);
     if (r == 0) {
-        if (! S_ISDIR (st.st_mode)) {
+	if (! S_ISDIR (st.st_mode)) {
 	    fprintf (stderr, "Error: '%s' is not a directory: %s\n",
 		     path, strerror (EEXIST));
 	    return false;
@@ -282,7 +282,7 @@ copy_fd (int fdout, int fdin)
 	} while (remain > 0);
     }
 
-    return (!interrupted && !empty);
+    return (! interrupted && ! empty);
 }
 
 /*
@@ -311,7 +311,7 @@ maildir_write_tmp (const void *ctx, int fdin, const char *maildir, bool world_re
 
     return path;
 
-FAIL:
+  FAIL:
     close (fdout);
     unlink (path);
 
@@ -360,7 +360,7 @@ maildir_write_new (const void *ctx, int fdin, const char *maildir, bool world_re
 
     return newpath;
 
-FAIL:
+  FAIL:
     unlink (cleanpath);
 
     return NULL;
diff --git a/notmuch-new.c b/notmuch-new.c
index 184e9aa2..f079f62a 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -87,7 +87,7 @@ handle_sigint (unused (int sig))
      * result.  It is not required for correctness, and if it does
      * fail or produce a short write, we want to get out of the signal
      * handler as quickly as possible, not retry it. */
-    IGNORE_RESULT (write (2, msg, sizeof(msg)-1));
+    IGNORE_RESULT (write (2, msg, sizeof (msg) - 1));
     interrupted = 1;
 }
 
@@ -184,23 +184,23 @@ dirent_type (const char *path, const struct dirent *entry)
     /* Mapping from d_type to stat mode_t.  We omit DT_LNK so that
      * we'll fall through to stat and get the real file type. */
     static const mode_t modes[] = {
-	[DT_BLK]  = S_IFBLK,
-	[DT_CHR]  = S_IFCHR,
-	[DT_DIR]  = S_IFDIR,
+	[DT_BLK] = S_IFBLK,
+	[DT_CHR] = S_IFCHR,
+	[DT_DIR] = S_IFDIR,
 	[DT_FIFO] = S_IFIFO,
-	[DT_REG]  = S_IFREG,
+	[DT_REG] = S_IFREG,
 	[DT_SOCK] = S_IFSOCK
     };
-    if (entry->d_type < ARRAY_SIZE(modes) && modes[entry->d_type])
+    if (entry->d_type < ARRAY_SIZE (modes) && modes[entry->d_type])
 	return modes[entry->d_type];
 #endif
 
     abspath = talloc_asprintf (NULL, "%s/%s", path, entry->d_name);
-    if (!abspath) {
+    if (! abspath) {
 	errno = ENOMEM;
 	return -1;
     }
-    err = stat(abspath, &statbuf);
+    err = stat (abspath, &statbuf);
     saved_errno = errno;
     talloc_free (abspath);
     if (err < 0) {
@@ -226,10 +226,9 @@ _entries_resemble_maildir (const char *path, struct dirent **entries, int count)
 	if (dirent_type (path, entries[i]) != S_IFDIR)
 	    continue;
 
-	if (strcmp(entries[i]->d_name, "new") == 0 ||
-	    strcmp(entries[i]->d_name, "cur") == 0 ||
-	    strcmp(entries[i]->d_name, "tmp") == 0)
-	{
+	if (strcmp (entries[i]->d_name, "new") == 0 ||
+	    strcmp (entries[i]->d_name, "cur") == 0 ||
+	    strcmp (entries[i]->d_name, "tmp") == 0) {
 	    found++;
 	    if (found == 3)
 		return 1;
@@ -389,8 +388,8 @@ add_file (notmuch_database_t *notmuch, const char *filename,
 	    notmuch_message_maildir_flags_to_tags (message);
 
 	for (tag = state->new_tags; *tag != NULL; tag++) {
-	    if (strcmp ("unread", *tag) !=0 ||
-		!notmuch_message_has_maildir_flag (message, 'S')) {
+	    if (strcmp ("unread", *tag) != 0 ||
+		! notmuch_message_has_maildir_flag (message, 'S')) {
 		notmuch_message_add_tag (message, *tag);
 	    }
 	}
@@ -415,7 +414,7 @@ add_file (notmuch_database_t *notmuch, const char *filename,
     case NOTMUCH_STATUS_READ_ONLY_DATABASE:
     case NOTMUCH_STATUS_XAPIAN_EXCEPTION:
     case NOTMUCH_STATUS_OUT_OF_MEMORY:
-	(void) print_status_database("add_file", notmuch, status);
+	(void) print_status_database ("add_file", notmuch, status);
 	goto DONE;
     default:
 	INTERNAL_ERROR ("add_message returned unexpected value: %d", status);
@@ -534,7 +533,7 @@ add_files (notmuch_database_t *notmuch,
 	 * file system link count.  So, only bail early if the
 	 * database agrees that there are no sub-directories. */
 	db_subdirs = notmuch_directory_get_child_directories (directory);
-	if (!notmuch_filenames_valid (db_subdirs))
+	if (! notmuch_filenames_valid (db_subdirs))
 	    goto DONE;
 	notmuch_filenames_destroy (db_subdirs);
 	db_subdirs = NULL;
@@ -631,7 +630,7 @@ add_files (notmuch_database_t *notmuch,
 
     /* Pass 2: Scan for new files, removed files, and removed directories. */
     for (i = 0; i < num_fs_entries && ! interrupted; i++) {
-        entry = fs_entries[i];
+	entry = fs_entries[i];
 
 	/* Ignore special directories early. */
 	if (_special_directory (entry->d_name))
@@ -648,8 +647,7 @@ add_files (notmuch_database_t *notmuch,
 	/* Check if we've walked past any names in db_files or
 	 * db_subdirs. If so, these have been deleted. */
 	while (notmuch_filenames_valid (db_files) &&
-	       strcmp (notmuch_filenames_get (db_files), entry->d_name) < 0)
-	{
+	       strcmp (notmuch_filenames_get (db_files), entry->d_name) < 0) {
 	    char *absolute = talloc_asprintf (state->removed_files,
 					      "%s/%s", path,
 					      notmuch_filenames_get (db_files));
@@ -664,17 +662,15 @@ add_files (notmuch_database_t *notmuch,
 	}
 
 	while (notmuch_filenames_valid (db_subdirs) &&
-	       strcmp (notmuch_filenames_get (db_subdirs), entry->d_name) <= 0)
-	{
+	       strcmp (notmuch_filenames_get (db_subdirs), entry->d_name) <= 0) {
 	    const char *filename = notmuch_filenames_get (db_subdirs);
 
-	    if (strcmp (filename, entry->d_name) < 0)
-	    {
+	    if (strcmp (filename, entry->d_name) < 0) {
 		char *absolute = talloc_asprintf (state->removed_directories,
 						  "%s/%s", path, filename);
 		if (state->debug)
 		    printf ("(D) add_files, pass 2: queuing passed directory %s for deletion from database\n",
-			absolute);
+			    absolute);
 
 		_filename_list_add (state->removed_directories, absolute);
 	    }
@@ -694,8 +690,7 @@ add_files (notmuch_database_t *notmuch,
 
 	/* Don't add a file that we've added before. */
 	if (notmuch_filenames_valid (db_files) &&
-	    strcmp (notmuch_filenames_get (db_files), entry->d_name) == 0)
-	{
+	    strcmp (notmuch_filenames_get (db_files), entry->d_name) == 0) {
 	    notmuch_filenames_move_to_next (db_files);
 	    continue;
 	}
@@ -708,12 +703,12 @@ add_files (notmuch_database_t *notmuch,
 
 	if (state->verbosity >= VERBOSITY_VERBOSE) {
 	    if (state->output_is_a_tty)
-		printf("\r\033[K");
+		printf ("\r\033[K");
 
 	    printf ("%i/%i: %s", state->processed_files, state->total_files,
 		    next);
 
-	    putchar((state->output_is_a_tty) ? '\r' : '\n');
+	    putchar ((state->output_is_a_tty) ? '\r' : '\n');
 	    fflush (stdout);
 	}
 
@@ -738,8 +733,7 @@ add_files (notmuch_database_t *notmuch,
 
     /* Now that we've walked the whole filesystem list, anything left
      * over in the database lists has been deleted. */
-    while (notmuch_filenames_valid (db_files))
-    {
+    while (notmuch_filenames_valid (db_files)) {
 	char *absolute = talloc_asprintf (state->removed_files,
 					  "%s/%s", path,
 					  notmuch_filenames_get (db_files));
@@ -752,8 +746,7 @@ add_files (notmuch_database_t *notmuch,
 	notmuch_filenames_move_to_next (db_files);
     }
 
-    while (notmuch_filenames_valid (db_subdirs))
-    {
+    while (notmuch_filenames_valid (db_subdirs)) {
 	char *absolute = talloc_asprintf (state->removed_directories,
 					  "%s/%s", path,
 					  notmuch_filenames_get (db_subdirs));
@@ -856,7 +849,7 @@ count_files (const char *path, int *count, add_files_state_t *state)
     }
 
     for (i = 0; i < num_fs_entries && ! interrupted; i++) {
-        entry = fs_entries[i];
+	entry = fs_entries[i];
 
 	/* Ignore special directories to avoid infinite recursion.
 	 * Also ignore the .notmuch directory.
@@ -901,7 +894,7 @@ count_files (const char *path, int *count, add_files_state_t *state)
 	for (i = 0; i < num_fs_entries; i++)
 	    free (fs_entries[i]);
 
-        free (fs_entries);
+	free (fs_entries);
     }
 }
 
@@ -939,6 +932,7 @@ remove_filename (notmuch_database_t *notmuch,
 {
     notmuch_status_t status;
     notmuch_message_t *message;
+
     status = notmuch_database_begin_atomic (notmuch);
     if (status)
 	return status;
@@ -976,13 +970,12 @@ _remove_directory (void *ctx,
     char *absolute;
 
     status = notmuch_database_get_directory (notmuch, path, &directory);
-    if (status || !directory)
+    if (status || ! directory)
 	return status;
 
     for (files = notmuch_directory_get_child_files (directory);
 	 notmuch_filenames_valid (files);
-	 notmuch_filenames_move_to_next (files))
-    {
+	 notmuch_filenames_move_to_next (files)) {
 	absolute = talloc_asprintf (ctx, "%s/%s", path,
 				    notmuch_filenames_get (files));
 	status = remove_filename (notmuch, absolute, add_files_state);
@@ -993,8 +986,7 @@ _remove_directory (void *ctx,
 
     for (subdirs = notmuch_directory_get_child_directories (directory);
 	 notmuch_filenames_valid (subdirs);
-	 notmuch_filenames_move_to_next (subdirs))
-    {
+	 notmuch_filenames_move_to_next (subdirs)) {
 	absolute = talloc_asprintf (ctx, "%s/%s", path,
 				    notmuch_filenames_get (subdirs));
 	status = _remove_directory (ctx, notmuch, absolute, add_files_state);
@@ -1234,32 +1226,32 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
 	goto DONE;
 
     gettimeofday (&tv_start, NULL);
-    for (f = add_files_state.removed_files->head; f && !interrupted; f = f->next) {
+    for (f = add_files_state.removed_files->head; f && ! interrupted; f = f->next) {
 	ret = remove_filename (notmuch, f->filename, &add_files_state);
 	if (ret)
 	    goto DONE;
 	if (do_print_progress) {
 	    do_print_progress = 0;
 	    generic_print_progress ("Cleaned up", "messages",
-		tv_start, add_files_state.removed_messages + add_files_state.renamed_messages,
-		add_files_state.removed_files->count);
+				    tv_start, add_files_state.removed_messages + add_files_state.renamed_messages,
+				    add_files_state.removed_files->count);
 	}
     }
 
     gettimeofday (&tv_start, NULL);
-    for (f = add_files_state.removed_directories->head, i = 0; f && !interrupted; f = f->next, i++) {
+    for (f = add_files_state.removed_directories->head, i = 0; f && ! interrupted; f = f->next, i++) {
 	ret = _remove_directory (config, notmuch, f->filename, &add_files_state);
 	if (ret)
 	    goto DONE;
 	if (do_print_progress) {
 	    do_print_progress = 0;
 	    generic_print_progress ("Cleaned up", "directories",
-		tv_start, i,
-		add_files_state.removed_directories->count);
+				    tv_start, i,
+				    add_files_state.removed_directories->count);
 	}
     }
 
-    for (f = add_files_state.directory_mtimes->head; f && !interrupted; f = f->next) {
+    for (f = add_files_state.directory_mtimes->head; f && ! interrupted; f = f->next) {
 	notmuch_directory_t *directory;
 	status = notmuch_database_get_directory (notmuch, f->filename, &directory);
 	if (status == NOTMUCH_STATUS_SUCCESS && directory) {
@@ -1285,7 +1277,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
 
     notmuch_database_destroy (notmuch);
 
-    if (hooks && !ret && !interrupted)
+    if (hooks && ! ret && ! interrupted)
 	ret = notmuch_run_hook (db_path, "post-new");
 
     if (ret || interrupted)
diff --git a/notmuch-reindex.c b/notmuch-reindex.c
index 3139a8c6..5a39ade1 100644
--- a/notmuch-reindex.c
+++ b/notmuch-reindex.c
@@ -68,13 +68,13 @@ reindex_query (notmuch_database_t *notmuch, const char *query_string,
 	 notmuch_messages_move_to_next (messages)) {
 	message = notmuch_messages_get (messages);
 
-	ret = notmuch_message_reindex(message, indexopts);
+	ret = notmuch_message_reindex (message, indexopts);
 	if (ret != NOTMUCH_STATUS_SUCCESS)
 	    break;
 	notmuch_message_destroy (message);
     }
 
-    if (!ret)
+    if (! ret)
 	ret = notmuch_database_end_atomic (notmuch);
 
     notmuch_query_destroy (query);
@@ -124,7 +124,7 @@ notmuch_reindex_command (notmuch_config_t *config, int argc, char *argv[])
 	return EXIT_FAILURE;
     }
 
-    query_string = query_string_from_args (config, argc-opt_index, argv+opt_index);
+    query_string = query_string_from_args (config, argc - opt_index, argv + opt_index);
     if (query_string == NULL) {
 	fprintf (stderr, "Out of memory\n");
 	return EXIT_FAILURE;
@@ -134,7 +134,7 @@ notmuch_reindex_command (notmuch_config_t *config, int argc, char *argv[])
 	fprintf (stderr, "Error: notmuch reindex requires at least one search term.\n");
 	return EXIT_FAILURE;
     }
-    
+
     ret = reindex_query (notmuch, query_string, indexing_cli_choices.opts);
 
     notmuch_database_destroy (notmuch);
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 46bab434..2c30f6f9 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -28,8 +28,8 @@ static void
 show_reply_headers (GMimeStream *stream, GMimeMessage *message)
 {
     /* Output RFC 2822 formatted (and RFC 2047 encoded) headers. */
-    if (g_mime_object_write_to_stream (GMIME_OBJECT(message), NULL, stream) < 0) {
-	INTERNAL_ERROR("failed to write headers to stdout\n");
+    if (g_mime_object_write_to_stream (GMIME_OBJECT (message), NULL, stream) < 0) {
+	INTERNAL_ERROR ("failed to write headers to stdout\n");
     }
 }
 
@@ -68,7 +68,7 @@ format_part_reply (GMimeStream *stream, mime_node_t *node)
 	    g_mime_content_type_is_type (content_type, "application", "pgp-signature")) {
 	    /* Ignore PGP/MIME cruft parts */
 	} else if (g_mime_content_type_is_type (content_type, "text", "*") &&
-		   !g_mime_content_type_is_type (content_type, "text", "html")) {
+		   ! g_mime_content_type_is_type (content_type, "text", "html")) {
 	    show_text_part_content (node->part, stream, NOTMUCH_SHOW_TEXT_PART_REPLY);
 	} else if (disposition &&
 		   strcasecmp (g_mime_content_disposition_get_disposition (disposition),
@@ -117,7 +117,7 @@ address_match (const char *str, notmuch_config_t *config, address_match_t mode)
     const char **other;
     size_t i, other_len;
 
-    if (!str || *str == '\0')
+    if (! str || *str == '\0')
 	return NULL;
 
     primary = notmuch_config_get_user_primary_email (config);
@@ -263,14 +263,15 @@ reply_to_header_is_redundant (GMimeMessage *message,
     return ret;
 }
 
-static InternetAddressList *get_sender(GMimeMessage *message)
+static InternetAddressList *
+get_sender (GMimeMessage *message)
 {
     InternetAddressList *reply_to_list;
 
     reply_to_list = g_mime_message_get_reply_to_list (message);
     if (reply_to_list &&
 	internet_address_list_length (reply_to_list) > 0) {
-        /*
+	/*
 	 * Some mailing lists munge the Reply-To header despite it
 	 * being A Bad Thing, see
 	 * http://marc.merlins.org/netrants/reply-to-harmful.html
@@ -290,17 +291,20 @@ static InternetAddressList *get_sender(GMimeMessage *message)
     return g_mime_message_get_from (message);
 }
 
-static InternetAddressList *get_to(GMimeMessage *message)
+static InternetAddressList *
+get_to (GMimeMessage *message)
 {
     return g_mime_message_get_addresses (message, GMIME_ADDRESS_TYPE_TO);
 }
 
-static InternetAddressList *get_cc(GMimeMessage *message)
+static InternetAddressList *
+get_cc (GMimeMessage *message)
 {
     return g_mime_message_get_addresses (message, GMIME_ADDRESS_TYPE_CC);
 }
 
-static InternetAddressList *get_bcc(GMimeMessage *message)
+static InternetAddressList *
+get_bcc (GMimeMessage *message)
 {
     return g_mime_message_get_addresses (message, GMIME_ADDRESS_TYPE_BCC);
 }
@@ -327,10 +331,10 @@ add_recipients_from_message (GMimeMessage *reply,
 	InternetAddressList * (*get_header)(GMimeMessage *message);
 	GMimeAddressType recipient_type;
     } reply_to_map[] = {
-	{ get_sender,	GMIME_ADDRESS_TYPE_TO },
-	{ get_to,	GMIME_ADDRESS_TYPE_TO },
-	{ get_cc,	GMIME_ADDRESS_TYPE_CC },
-	{ get_bcc,	GMIME_ADDRESS_TYPE_BCC },
+	{ get_sender,   GMIME_ADDRESS_TYPE_TO },
+	{ get_to,       GMIME_ADDRESS_TYPE_TO },
+	{ get_cc,       GMIME_ADDRESS_TYPE_CC },
+	{ get_bcc,      GMIME_ADDRESS_TYPE_BCC },
     };
     const char *from_addr = NULL;
     unsigned int i;
@@ -344,7 +348,7 @@ add_recipients_from_message (GMimeMessage *reply,
 	n += scan_address_list (recipients, config, reply,
 				reply_to_map[i].recipient_type, &from_addr);
 
-	if (!reply_all && n) {
+	if (! reply_all && n) {
 	    /* Stop adding new recipients in reply-to-sender mode if
 	     * we have added some recipient(s) above.
 	     *
@@ -414,7 +418,7 @@ guess_from_in_received_by (notmuch_config_t *config, const char *received)
 	if (*by == '\0')
 	    break;
 	mta = xstrdup (by);
-	token = strtok(mta," \t");
+	token = strtok (mta, " \t");
 	if (token == NULL) {
 	    free (mta);
 	    break;
@@ -518,12 +522,12 @@ get_from_in_to_headers (notmuch_config_t *config, notmuch_message_t *message)
 }
 
 static GMimeMessage *
-create_reply_message(void *ctx,
-		     notmuch_config_t *config,
-		     notmuch_message_t *message,
-		     GMimeMessage *mime_message,
-		     bool reply_all,
-		     bool limited)
+create_reply_message (void *ctx,
+		      notmuch_config_t *config,
+		      notmuch_message_t *message,
+		      GMimeMessage *mime_message,
+		      bool reply_all,
+		      bool limited)
 {
     const char *subject, *from_addr = NULL;
     const char *in_reply_to, *orig_references, *references;
@@ -533,6 +537,7 @@ create_reply_message(void *ctx,
      * otherwise.
      */
     GMimeMessage *reply = g_mime_message_new (limited ? 0 : 1);
+
     if (reply == NULL) {
 	fprintf (stderr, "Out of memory\n");
 	return NULL;
@@ -608,11 +613,12 @@ enum {
     FORMAT_HEADERS_ONLY,
 };
 
-static int do_reply(notmuch_config_t *config,
-		    notmuch_query_t *query,
-		    notmuch_show_params_t *params,
-		    int format,
-		    bool reply_all)
+static int
+do_reply (notmuch_config_t *config,
+	  notmuch_query_t *query,
+	  notmuch_show_params_t *params,
+	  int format,
+	  bool reply_all)
 {
     GMimeMessage *reply;
     mime_node_t *node;
@@ -645,8 +651,7 @@ static int do_reply(notmuch_config_t *config,
 
     for (;
 	 notmuch_messages_valid (messages);
-	 notmuch_messages_move_to_next (messages))
-    {
+	 notmuch_messages_move_to_next (messages)) {
 	message = notmuch_messages_get (messages);
 
 	if (mime_node_open (config, message, &params->crypto, &node))
@@ -655,7 +660,7 @@ static int do_reply(notmuch_config_t *config,
 	reply = create_reply_message (config, config, message,
 				      GMIME_MESSAGE (node->part), reply_all,
 				      format == FORMAT_HEADERS_ONLY);
-	if (!reply)
+	if (! reply)
 	    return 1;
 
 	if (format == FORMAT_JSON || format == FORMAT_SEXP) {
@@ -681,7 +686,7 @@ static int do_reply(notmuch_config_t *config,
 		    format_part_reply (stream_stdout, node);
 	    }
 	    g_mime_stream_flush (stream_stdout);
-	    g_object_unref(stream_stdout);
+	    g_object_unref (stream_stdout);
 	}
 
 	g_object_unref (G_OBJECT (reply));
@@ -709,22 +714,22 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
 
     notmuch_opt_desc_t options[] = {
 	{ .opt_keyword = &format, .name = "format", .keywords =
-	  (notmuch_keyword_t []){ { "default", FORMAT_DEFAULT },
-				  { "json", FORMAT_JSON },
-				  { "sexp", FORMAT_SEXP },
-				  { "headers-only", FORMAT_HEADERS_ONLY },
-				  { 0, 0 } } },
+	      (notmuch_keyword_t []){ { "default", FORMAT_DEFAULT },
+				      { "json", FORMAT_JSON },
+				      { "sexp", FORMAT_SEXP },
+				      { "headers-only", FORMAT_HEADERS_ONLY },
+				      { 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 },
-				  { 0, 0 } } },
-	{ .opt_keyword = (int*)(&params.crypto.decrypt), .name = "decrypt",
+	      (notmuch_keyword_t []){ { "all", true },
+				      { "sender", false },
+				      { 0, 0 } } },
+	{ .opt_keyword = (int *) (&params.crypto.decrypt), .name = "decrypt",
 	  .keyword_no_arg_value = "true", .keywords =
-	  (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE },
-				  { "auto", NOTMUCH_DECRYPT_AUTO },
-				  { "true", NOTMUCH_DECRYPT_NOSTASH },
-				  { 0, 0 } } },
+	      (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE },
+				      { "auto", NOTMUCH_DECRYPT_AUTO },
+				      { "true", NOTMUCH_DECRYPT_NOSTASH },
+				      { 0, 0 } } },
 	{ .opt_inherit = notmuch_shared_options },
 	{ }
     };
@@ -737,7 +742,7 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
 
     notmuch_exit_if_unsupported_format ();
 
-    query_string = query_string_from_args (config, argc-opt_index, argv+opt_index);
+    query_string = query_string_from_args (config, argc - opt_index, argv + opt_index);
     if (query_string == NULL) {
 	fprintf (stderr, "Out of memory\n");
 	return EXIT_FAILURE;
diff --git a/notmuch-restore.c b/notmuch-restore.c
index dee19c20..4b509d95 100644
--- a/notmuch-restore.c
+++ b/notmuch-restore.c
@@ -25,18 +25,18 @@
 #include "zlib-extra.h"
 
 static int
-process_config_line (notmuch_database_t *notmuch, const char* line)
+process_config_line (notmuch_database_t *notmuch, const char *line)
 {
     const char *key_p, *val_p;
     char *key, *val;
-    size_t key_len,val_len;
+    size_t key_len, val_len;
     const char *delim = " \t\n";
     int ret = EXIT_FAILURE;
 
-    void *local = talloc_new(NULL);
+    void *local = talloc_new (NULL);
 
     key_p = strtok_len_c (line, delim, &key_len);
-    val_p = strtok_len_c (key_p+key_len, delim, &val_len);
+    val_p = strtok_len_c (key_p + key_len, delim, &val_len);
 
     key = talloc_strndup (local, key_p, key_len);
     val = talloc_strndup (local, val_p, val_len);
@@ -52,14 +52,13 @@ process_config_line (notmuch_database_t *notmuch, const char* line)
 
     ret = EXIT_SUCCESS;
 
- DONE:
+  DONE:
     talloc_free (local);
     return ret;
 }
 
 static int
-process_properties_line (notmuch_database_t *notmuch, const char* line)
-
+process_properties_line (notmuch_database_t *notmuch, const char *line)
 {
     const char *id_p, *tok;
     size_t id_len = 0, tok_len = 0;
@@ -248,14 +247,14 @@ notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[])
 
     notmuch_opt_desc_t options[] = {
 	{ .opt_keyword = &input_format, .name = "format", .keywords =
-	  (notmuch_keyword_t []){ { "auto", DUMP_FORMAT_AUTO },
-				  { "batch-tag", DUMP_FORMAT_BATCH_TAG },
-				  { "sup", DUMP_FORMAT_SUP },
-				  { 0, 0 } } },
+	      (notmuch_keyword_t []){ { "auto", DUMP_FORMAT_AUTO },
+				      { "batch-tag", DUMP_FORMAT_BATCH_TAG },
+				      { "sup", DUMP_FORMAT_SUP },
+				      { 0, 0 } } },
 	{ .opt_flags = &include, .name = "include", .keywords =
-	  (notmuch_keyword_t []){ { "config", DUMP_INCLUDE_CONFIG },
-				  { "properties", DUMP_INCLUDE_PROPERTIES },
-				  { "tags", DUMP_INCLUDE_TAGS} } },
+	      (notmuch_keyword_t []){ { "config", DUMP_INCLUDE_CONFIG },
+				      { "properties", DUMP_INCLUDE_PROPERTIES },
+				      { "tags", DUMP_INCLUDE_TAGS } } },
 
 	{ .opt_string = &input_file_name, .name = "input" },
 	{ .opt_bool = &accumulate, .name = "accumulate" },
@@ -330,13 +329,13 @@ notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[])
 
 	if (status) {
 	    fprintf (stderr, "Error reading (gzipped) input: %s\n",
-		     gz_error_string(status, input));
+		     gz_error_string (status, input));
 	    ret = EXIT_FAILURE;
 	    goto DONE;
 	}
 
 	if ((include & DUMP_INCLUDE_CONFIG) && line_len >= 2 && line[0] == '#' && line[1] == '@') {
-	    ret = process_config_line(notmuch, line+2);
+	    ret = process_config_line (notmuch, line + 2);
 	    if (ret)
 		goto DONE;
 	}
@@ -348,8 +347,8 @@ notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[])
 
     } while ((line_len == 0) ||
 	     (line[0] == '#') ||
-	     /* the cast is safe because we checked about for line_len < 0 */
-	     (strspn (line, " \t\n") == (unsigned)line_len));
+             /* the cast is safe because we checked about for line_len < 0 */
+	     (strspn (line, " \t\n") == (unsigned) line_len));
 
     if (! ((include & DUMP_INCLUDE_TAGS) || (include & DUMP_INCLUDE_PROPERTIES))) {
 	ret = EXIT_SUCCESS;
@@ -435,14 +434,14 @@ notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[])
 	ret = EXIT_FAILURE;
     }
 
-    /* currently this should not be after DONE: since we don't 
+    /* currently this should not be after DONE: since we don't
      * know if the xregcomp was reached
      */
 
     if (input_format == DUMP_FORMAT_SUP)
 	regfree (&regex);
 
- DONE:
+  DONE:
     if (line_ctx != NULL)
 	talloc_free (line_ctx);
 
diff --git a/notmuch-search.c b/notmuch-search.c
index e3a85617..fd0b58c5 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -87,8 +87,7 @@ get_thread_query (notmuch_thread_t *thread,
 
     for (messages = notmuch_thread_get_messages (thread);
 	 notmuch_messages_valid (messages);
-	 notmuch_messages_move_to_next (messages))
-    {
+	 notmuch_messages_move_to_next (messages)) {
 	notmuch_message_t *message = notmuch_messages_get (messages);
 	const char *mid = notmuch_message_get_message_id (message);
 	/* Determine which query buffer to extend */
@@ -103,7 +102,7 @@ get_thread_query (notmuch_thread_t *thread,
 	    *buf = talloc_asprintf_append_buffer (*buf, " %s", escaped);
 	else
 	    *buf = talloc_strdup (thread, escaped);
-	if (!*buf)
+	if (! *buf)
 	    return -1;
     }
     talloc_free (escaped);
@@ -134,15 +133,14 @@ do_search_threads (search_context_t *ctx)
     }
 
     status = notmuch_query_search_threads (ctx->query, &threads);
-    if (print_status_query("notmuch search", ctx->query, status))
+    if (print_status_query ("notmuch search", ctx->query, status))
 	return 1;
 
     format->begin_list (format);
 
     for (i = 0;
 	 notmuch_threads_valid (threads) && (ctx->limit < 0 || i < ctx->offset + ctx->limit);
-	 notmuch_threads_move_to_next (threads), i++)
-    {
+	 notmuch_threads_move_to_next (threads), i++) {
 	thread = notmuch_threads_get (threads);
 
 	if (i < ctx->offset) {
@@ -176,23 +174,23 @@ do_search_threads (search_context_t *ctx)
 	    relative_date = notmuch_time_relative_date (ctx_quote, date);
 
 	    if (format->is_text_printer) {
-                /* Special case for the text formatter */
+		/* Special case for the text formatter */
 		printf ("thread:%s %12s ",
 			thread_id,
 			relative_date);
 		if (total == files)
 		    printf ("[%d/%d] %s; %s (",
-			matched,
-			total,
-			sanitize_string (ctx_quote, authors),
-			sanitize_string (ctx_quote, subject));
+			    matched,
+			    total,
+			    sanitize_string (ctx_quote, authors),
+			    sanitize_string (ctx_quote, subject));
 		else
 		    printf ("[%d/%d(%d)] %s; %s (",
-			matched,
-			total,
-			files,
-			sanitize_string (ctx_quote, authors),
-			sanitize_string (ctx_quote, subject));
+			    matched,
+			    total,
+			    files,
+			    sanitize_string (ctx_quote, authors),
+			    sanitize_string (ctx_quote, subject));
 
 	    } else { /* Structured Output */
 		format->map_key (format, "thread");
@@ -237,12 +235,11 @@ do_search_threads (search_context_t *ctx)
 
 	    for (tags = notmuch_thread_get_tags (thread);
 		 notmuch_tags_valid (tags);
-		 notmuch_tags_move_to_next (tags))
-	    {
+		 notmuch_tags_move_to_next (tags)) {
 		const char *tag = notmuch_tags_get (tags);
 
 		if (format->is_text_printer) {
-                  /* Special case for the text formatter */
+		    /* Special case for the text formatter */
 		    if (first_tag)
 			first_tag = false;
 		    else
@@ -269,7 +266,8 @@ do_search_threads (search_context_t *ctx)
     return 0;
 }
 
-static mailbox_t *new_mailbox (void *ctx, const char *name, const char *addr)
+static mailbox_t *
+new_mailbox (void *ctx, const char *name, const char *addr)
 {
     mailbox_t *mailbox;
 
@@ -284,7 +282,8 @@ static mailbox_t *new_mailbox (void *ctx, const char *name, const char *addr)
     return mailbox;
 }
 
-static int mailbox_compare (const void *v1, const void *v2)
+static int
+mailbox_compare (const void *v1, const void *v2)
 {
     const mailbox_t *m1 = v1, *m2 = v2;
     int ret;
@@ -488,7 +487,7 @@ print_popular (const search_context_t *ctx, GList *list)
     }
 
     if (! mailbox)
-	INTERNAL_ERROR("Empty list in address hash table\n");
+	INTERNAL_ERROR ("Empty list in address hash table\n");
 
     /* The original count is no longer needed, so overwrite. */
     mailbox->count = total;
@@ -522,8 +521,8 @@ _count_filenames (notmuch_message_t *message)
     filenames = notmuch_message_get_filenames (message);
 
     while (notmuch_filenames_valid (filenames)) {
-        notmuch_filenames_move_to_next (filenames);
-        i++;
+	notmuch_filenames_move_to_next (filenames);
+	i++;
     }
 
     notmuch_filenames_destroy (filenames);
@@ -561,8 +560,7 @@ do_search_messages (search_context_t *ctx)
 
     for (i = 0;
 	 notmuch_messages_valid (messages) && (ctx->limit < 0 || i < ctx->offset + ctx->limit);
-	 notmuch_messages_move_to_next (messages), i++)
-    {
+	 notmuch_messages_move_to_next (messages), i++) {
 	if (i < ctx->offset)
 	    continue;
 
@@ -574,24 +572,23 @@ do_search_messages (search_context_t *ctx)
 
 	    for (j = 1;
 		 notmuch_filenames_valid (filenames);
-		 notmuch_filenames_move_to_next (filenames), j++)
-	    {
+		 notmuch_filenames_move_to_next (filenames), j++) {
 		if (ctx->dupe < 0 || ctx->dupe == j) {
 		    format->string (format, notmuch_filenames_get (filenames));
 		    format->separator (format);
 		}
 	    }
-	    
-	    notmuch_filenames_destroy( filenames );
+
+	    notmuch_filenames_destroy ( filenames );
 
 	} else if (ctx->output == OUTPUT_MESSAGES) {
-            /* special case 1 for speed */
-            if (ctx->dupe <= 1 || ctx->dupe <= _count_filenames (message)) {
-                format->set_prefix (format, "id");
-                format->string (format,
-                                notmuch_message_get_message_id (message));
-                format->separator (format);
-            }
+	    /* special case 1 for speed */
+	    if (ctx->dupe <= 1 || ctx->dupe <= _count_filenames (message)) {
+		format->set_prefix (format, "id");
+		format->string (format,
+				notmuch_message_get_message_id (message));
+		format->separator (format);
+	    }
 	} else {
 	    if (ctx->output & OUTPUT_SENDER) {
 		const char *addrs;
@@ -657,8 +654,7 @@ do_search_tags (const search_context_t *ctx)
 
     for (;
 	 notmuch_tags_valid (tags);
-	 notmuch_tags_move_to_next (tags))
-    {
+	 notmuch_tags_move_to_next (tags)) {
 	tag = notmuch_tags_get (tags);
 
 	format->string (format, tag);
@@ -702,7 +698,7 @@ _notmuch_search_prepare (search_context_t *ctx, notmuch_config_t *config, int ar
 	break;
     default:
 	/* this should never happen */
-	INTERNAL_ERROR("no output format selected");
+	INTERNAL_ERROR ("no output format selected");
     }
 
     notmuch_exit_if_unsupported_format ();
@@ -791,15 +787,15 @@ static search_context_t search_context = {
 
 static const notmuch_opt_desc_t common_options[] = {
     { .opt_keyword = &search_context.sort, .name = "sort", .keywords =
-      (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
-			      { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
-			      { 0, 0 } } },
+	  (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
+				  { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
+				  { 0, 0 } } },
     { .opt_keyword = &search_context.format_sel, .name = "format", .keywords =
-      (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
-			      { "sexp", NOTMUCH_FORMAT_SEXP },
-			      { "text", NOTMUCH_FORMAT_TEXT },
-			      { "text0", NOTMUCH_FORMAT_TEXT0 },
-			      { 0, 0 } } },
+	  (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
+				  { "sexp", NOTMUCH_FORMAT_SEXP },
+				  { "text", NOTMUCH_FORMAT_TEXT },
+				  { "text0", NOTMUCH_FORMAT_TEXT0 },
+				  { 0, 0 } } },
     { .opt_int = &notmuch_format_version, .name = "format-version" },
     { }
 };
@@ -812,18 +808,18 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
 
     notmuch_opt_desc_t options[] = {
 	{ .opt_keyword = &ctx->output, .name = "output", .keywords =
-	  (notmuch_keyword_t []){ { "summary", OUTPUT_SUMMARY },
-				  { "threads", OUTPUT_THREADS },
-				  { "messages", OUTPUT_MESSAGES },
-				  { "files", OUTPUT_FILES },
-				  { "tags", OUTPUT_TAGS },
-				  { 0, 0 } } },
-        { .opt_keyword = &ctx->exclude, .name = "exclude", .keywords =
-          (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
-                                  { "false", NOTMUCH_EXCLUDE_FALSE },
-                                  { "flag", NOTMUCH_EXCLUDE_FLAG },
-                                  { "all", NOTMUCH_EXCLUDE_ALL },
-                                  { 0, 0 } } },
+	      (notmuch_keyword_t []){ { "summary", OUTPUT_SUMMARY },
+				      { "threads", OUTPUT_THREADS },
+				      { "messages", OUTPUT_MESSAGES },
+				      { "files", OUTPUT_FILES },
+				      { "tags", OUTPUT_TAGS },
+				      { 0, 0 } } },
+	{ .opt_keyword = &ctx->exclude, .name = "exclude", .keywords =
+	      (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
+				      { "false", NOTMUCH_EXCLUDE_FALSE },
+				      { "flag", NOTMUCH_EXCLUDE_FLAG },
+				      { "all", NOTMUCH_EXCLUDE_ALL },
+				      { 0, 0 } } },
 	{ .opt_int = &ctx->offset, .name = "offset" },
 	{ .opt_int = &ctx->limit, .name = "limit" },
 	{ .opt_int = &ctx->dupe, .name = "duplicate" },
@@ -841,8 +837,8 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
 
     if (ctx->output != OUTPUT_FILES && ctx->output != OUTPUT_MESSAGES &&
 	ctx->dupe != -1) {
-        fprintf (stderr, "Error: --duplicate=N is only supported with --output=files and --output=messages.\n");
-        return EXIT_FAILURE;
+	fprintf (stderr, "Error: --duplicate=N is only supported with --output=files and --output=messages.\n");
+	return EXIT_FAILURE;
     }
 
     if (_notmuch_search_prepare (ctx, config,
@@ -878,20 +874,20 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])
 
     notmuch_opt_desc_t options[] = {
 	{ .opt_flags = &ctx->output, .name = "output", .keywords =
-	  (notmuch_keyword_t []){ { "sender", OUTPUT_SENDER },
-				  { "recipients", OUTPUT_RECIPIENTS },
-				  { "count", OUTPUT_COUNT },
-				  { "address", OUTPUT_ADDRESS },
-				  { 0, 0 } } },
+	      (notmuch_keyword_t []){ { "sender", OUTPUT_SENDER },
+				      { "recipients", OUTPUT_RECIPIENTS },
+				      { "count", OUTPUT_COUNT },
+				      { "address", OUTPUT_ADDRESS },
+				      { 0, 0 } } },
 	{ .opt_keyword = &ctx->exclude, .name = "exclude", .keywords =
-	  (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
-				  { "false", NOTMUCH_EXCLUDE_FALSE },
-				  { 0, 0 } } },
+	      (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
+				      { "false", NOTMUCH_EXCLUDE_FALSE },
+				      { 0, 0 } } },
 	{ .opt_keyword = &ctx->dedup, .name = "deduplicate", .keywords =
-	  (notmuch_keyword_t []){ { "no", DEDUP_NONE },
-				  { "mailbox", DEDUP_MAILBOX },
-				  { "address", DEDUP_ADDRESS },
-				  { 0, 0 } } },
+	      (notmuch_keyword_t []){ { "no", DEDUP_NONE },
+				      { "mailbox", DEDUP_MAILBOX },
+				      { "address", DEDUP_ADDRESS },
+				      { 0, 0 } } },
 	{ .opt_inherit = common_options },
 	{ .opt_inherit = notmuch_shared_options },
 	{ }
diff --git a/notmuch-setup.c b/notmuch-setup.c
index 81419ccf..cd1a52ff 100644
--- a/notmuch-setup.c
+++ b/notmuch-setup.c
@@ -47,50 +47,51 @@ static void
 welcome_message_pre_setup (void)
 {
     printf (
-"Welcome to notmuch!\n\n"
-
-"The goal of notmuch is to help you manage and search your collection of\n"
-"email, and to efficiently keep up with the flow of email as it comes in.\n\n"
-
-"Notmuch needs to know a few things about you such as your name and email\n"
-"address, as well as the directory that contains your email. This is where\n"
-"you already have mail stored and where messages will be delivered in the\n"
-"future. This directory can contain any number of sub-directories. Regular\n"
-"files in these directories should be individual email messages. If there\n"
-"are other, non-email files (such as indexes maintained by other email\n"
-"programs) then notmuch will do its best to detect those and ignore them.\n\n"
-
-"If you already have your email being delivered to directories in either\n"
-"maildir or mh format, then that's perfect. Mail storage that uses mbox\n"
-"format, (where one mbox file contains many messages), will not work with\n"
-"notmuch. If that's how your mail is currently stored, we recommend you\n"
-"first convert it to maildir format with a utility such as mb2md. You can\n"
-"continue configuring notmuch now, but be sure to complete the conversion\n"
-"before you run \"notmuch new\" for the first time.\n\n");
+	"Welcome to notmuch!\n\n"
+
+	"The goal of notmuch is to help you manage and search your collection of\n"
+	"email, and to efficiently keep up with the flow of email as it comes in.\n\n"
+
+	"Notmuch needs to know a few things about you such as your name and email\n"
+	"address, as well as the directory that contains your email. This is where\n"
+	"you already have mail stored and where messages will be delivered in the\n"
+	"future. This directory can contain any number of sub-directories. Regular\n"
+	"files in these directories should be individual email messages. If there\n"
+	"are other, non-email files (such as indexes maintained by other email\n"
+	"programs) then notmuch will do its best to detect those and ignore them.\n\n"
+
+	"If you already have your email being delivered to directories in either\n"
+	"maildir or mh format, then that's perfect. Mail storage that uses mbox\n"
+	"format, (where one mbox file contains many messages), will not work with\n"
+	"notmuch. If that's how your mail is currently stored, we recommend you\n"
+	"first convert it to maildir format with a utility such as mb2md. You can\n"
+	"continue configuring notmuch now, but be sure to complete the conversion\n"
+	"before you run \"notmuch new\" for the first time.\n\n");
 }
 
 static void
 welcome_message_post_setup (void)
 {
     printf ("\n"
-"Notmuch is now configured, and the configuration settings are saved in\n"
-"a file in your home directory named .notmuch-config . If you'd like to\n"
-"change the configuration in the future, you can either edit that file\n"
-"directly or run \"notmuch setup\".  To choose an alternate configuration\n"
-"location, set ${NOTMUCH_CONFIG}.\n\n"
-
-"The next step is to run \"notmuch new\" which will create a database\n"
-"that indexes all of your mail. Depending on the amount of mail you have\n"
-"the initial indexing process can take a long time, so expect that.\n"
-"Also, the resulting database will require roughly the same amount of\n"
-"storage space as your current collection of email. So please ensure you\n"
-"have sufficient storage space available now.\n\n");
+	    "Notmuch is now configured, and the configuration settings are saved in\n"
+	    "a file in your home directory named .notmuch-config . If you'd like to\n"
+	    "change the configuration in the future, you can either edit that file\n"
+	    "directly or run \"notmuch setup\".  To choose an alternate configuration\n"
+	    "location, set ${NOTMUCH_CONFIG}.\n\n"
+
+	    "The next step is to run \"notmuch new\" which will create a database\n"
+	    "that indexes all of your mail. Depending on the amount of mail you have\n"
+	    "the initial indexing process can take a long time, so expect that.\n"
+	    "Also, the resulting database will require roughly the same amount of\n"
+	    "storage space as your current collection of email. So please ensure you\n"
+	    "have sufficient storage space available now.\n\n");
 }
 
 static void
 print_tag_list (const char **tags, size_t tags_len)
 {
     unsigned int i;
+
     for (i = 0; i < tags_len; i++) {
 	if (i != 0)
 	    printf (" ");
@@ -134,15 +135,15 @@ notmuch_setup_command (notmuch_config_t *config,
     const char **search_exclude_tags;
     size_t search_exclude_tags_len;
 
-#define prompt(format, ...)					\
-    do {							\
-	printf (format, ##__VA_ARGS__);				\
-	fflush (stdout);					\
-	if (getline (&response, &response_size, stdin) < 0) {	\
-	    printf ("Exiting.\n");				\
-	    exit (EXIT_FAILURE);				\
-	}							\
-	chomp_newline (response);				\
+#define prompt(format, ...)                                     \
+    do {                                                        \
+	printf (format, ##__VA_ARGS__);                         \
+	fflush (stdout);                                        \
+	if (getline (&response, &response_size, stdin) < 0) {   \
+	    printf ("Exiting.\n");                              \
+	    exit (EXIT_FAILURE);                                \
+	}                                                       \
+	chomp_newline (response);                               \
     } while (0)
 
     if (notmuch_minimal_options ("setup", argc, argv) < 0)
@@ -167,14 +168,14 @@ notmuch_setup_command (notmuch_config_t *config,
     other_emails = g_ptr_array_new ();
 
     old_other_emails = notmuch_config_get_user_other_email (config,
-					     &old_other_emails_len);
+							    &old_other_emails_len);
     for (i = 0; i < old_other_emails_len; i++) {
 	prompt ("Additional email address [%s]: ", old_other_emails[i]);
 	if (strlen (response))
 	    g_ptr_array_add (other_emails, talloc_strdup (config, response));
 	else
 	    g_ptr_array_add (other_emails, talloc_strdup (config,
-							 old_other_emails[i]));
+							  old_other_emails[i]));
     }
 
     do {
diff --git a/notmuch-show.c b/notmuch-show.c
index bce7d827..9779cfa5 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -37,8 +37,7 @@ _get_tags_as_string (const void *ctx, notmuch_message_t *message)
 
     for (tags = notmuch_message_get_tags (message);
 	 notmuch_tags_valid (tags);
-	 notmuch_tags_move_to_next (tags))
-    {
+	 notmuch_tags_move_to_next (tags)) {
 	tag = notmuch_tags_get (tags);
 
 	result = talloc_asprintf_append (result, "%s%s",
@@ -69,12 +68,13 @@ _get_one_line_summary (const void *ctx, notmuch_message_t *message)
 			    from, relative_date, tags);
 }
 
-static const char *_get_disposition(GMimeObject *meta)
+static const char *
+_get_disposition (GMimeObject *meta)
 {
     GMimeContentDisposition *disposition;
 
     disposition = g_mime_object_get_content_disposition (meta);
-    if (!disposition)
+    if (! disposition)
 	return NULL;
 
     return g_mime_content_disposition_get_disposition (disposition);
@@ -170,7 +170,7 @@ _extract_email_address (const void *ctx, const char *from)
 	g_object_unref (addresses);
 
     return email;
-   }
+}
 
 /* Return 1 if 'line' is an mbox From_ line---that is, a line
  * beginning with zero or more '>' characters followed by the
@@ -290,7 +290,7 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
     charset = g_mime_object_get_content_type_parameter (part, "charset");
     charset = charset ? g_mime_charset_canon_name (charset) : NULL;
     wrapper = g_mime_part_get_content (GMIME_PART (part));
-    if (wrapper && charset && !g_ascii_strncasecmp (charset, "iso-8859-", 9)) {
+    if (wrapper && charset && ! g_ascii_strncasecmp (charset, "iso-8859-", 9)) {
 	GMimeStream *null_stream = NULL;
 	GMimeStream *null_stream_filter = NULL;
 
@@ -298,10 +298,10 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
 	null_stream = g_mime_stream_null_new ();
 	null_stream_filter = g_mime_stream_filter_new (null_stream);
 	windows_filter = g_mime_filter_windows_new (charset);
-	g_mime_stream_filter_add(GMIME_STREAM_FILTER (null_stream_filter),
-				 windows_filter);
+	g_mime_stream_filter_add (GMIME_STREAM_FILTER (null_stream_filter),
+				  windows_filter);
 	g_mime_data_wrapper_write_to_stream (wrapper, null_stream_filter);
-	charset = g_mime_filter_windows_real_charset(
+	charset = g_mime_filter_windows_real_charset (
 	    (GMimeFilterWindows *) windows_filter);
 
 	if (null_stream_filter)
@@ -314,8 +314,8 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
 
     stream_filter = g_mime_stream_filter_new (stream_out);
     crlf_filter = g_mime_filter_dos2unix_new (false);
-    g_mime_stream_filter_add(GMIME_STREAM_FILTER (stream_filter),
-			     crlf_filter);
+    g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter),
+			      crlf_filter);
     g_object_unref (crlf_filter);
 
     if (charset) {
@@ -345,12 +345,12 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
     if (wrapper && stream_filter)
 	g_mime_data_wrapper_write_to_stream (wrapper, stream_filter);
     if (stream_filter)
-	g_object_unref(stream_filter);
+	g_object_unref (stream_filter);
     if (windows_filter)
 	g_object_unref (windows_filter);
 }
 
-static const char*
+static const char *
 signature_status_to_string (GMimeSignatureStatus status)
 {
     if (g_mime_signature_status_bad (status))
@@ -368,12 +368,13 @@ signature_status_to_string (GMimeSignatureStatus status)
 /* Print signature flags */
 struct key_map_struct {
     GMimeSignatureStatus bit;
-    const char * string;
+    const char *string;
 };
 
 static void
 do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
-			    unsigned int array_map_len, GMimeSignatureStatus errors) {
+			    unsigned int array_map_len, GMimeSignatureStatus errors)
+{
     sp->map_key (sp, "errors");
     sp->begin_map (sp);
 
@@ -392,22 +393,22 @@ format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
 {
     GMimeSignatureStatus errors = g_mime_signature_get_status (signature);
 
-    if (!(errors & GMIME_SIGNATURE_STATUS_ERROR_MASK))
+    if (! (errors & GMIME_SIGNATURE_STATUS_ERROR_MASK))
 	return;
 
     struct key_map_struct key_map[] = {
-	{ GMIME_SIGNATURE_STATUS_KEY_REVOKED, "key-revoked"},
-	{ GMIME_SIGNATURE_STATUS_KEY_EXPIRED, "key-expired"},
+	{ GMIME_SIGNATURE_STATUS_KEY_REVOKED, "key-revoked" },
+	{ GMIME_SIGNATURE_STATUS_KEY_EXPIRED, "key-expired" },
 	{ GMIME_SIGNATURE_STATUS_SIG_EXPIRED, "sig-expired" },
-	{ GMIME_SIGNATURE_STATUS_KEY_MISSING, "key-missing"},
-	{ GMIME_SIGNATURE_STATUS_CRL_MISSING, "crl-missing"},
-	{ GMIME_SIGNATURE_STATUS_CRL_TOO_OLD, "crl-too-old"},
-	{ GMIME_SIGNATURE_STATUS_BAD_POLICY, "bad-policy"},
-	{ GMIME_SIGNATURE_STATUS_SYS_ERROR, "sys-error"},
-	{ GMIME_SIGNATURE_STATUS_TOFU_CONFLICT, "tofu-conflict"},
+	{ GMIME_SIGNATURE_STATUS_KEY_MISSING, "key-missing" },
+	{ GMIME_SIGNATURE_STATUS_CRL_MISSING, "crl-missing" },
+	{ GMIME_SIGNATURE_STATUS_CRL_TOO_OLD, "crl-too-old" },
+	{ GMIME_SIGNATURE_STATUS_BAD_POLICY, "bad-policy" },
+	{ GMIME_SIGNATURE_STATUS_SYS_ERROR, "sys-error" },
+	{ GMIME_SIGNATURE_STATUS_TOFU_CONFLICT, "tofu-conflict" },
     };
 
-    do_format_signature_errors (sp, key_map, ARRAY_SIZE(key_map), errors);
+    do_format_signature_errors (sp, key_map, ARRAY_SIZE (key_map), errors);
 }
 
 /* Signature status sprinter */
@@ -419,7 +420,7 @@ format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist)
 
     sp->begin_list (sp);
 
-    if (!siglist) {
+    if (! siglist) {
 	sp->end (sp);
 	return;
     }
@@ -479,7 +480,7 @@ format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist)
 	}
 
 	sp->end (sp);
-     }
+    }
 
     sp->end (sp);
 }
@@ -555,8 +556,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
 	g_mime_stream_printf (stream, "Date: %s\n", date_string);
 	g_mime_stream_printf (stream, "\fheader}\n");
 
-	if (!params->output_body)
-	{
+	if (! params->output_body) {
 	    g_mime_stream_printf (stream, "\f%s}\n", part_type);
 	    return NOTMUCH_STATUS_SUCCESS;
 	}
@@ -566,8 +566,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
     if (leaf) {
 	if (g_mime_content_type_is_type (content_type, "text", "*") &&
 	    (params->include_html ||
-	     ! g_mime_content_type_is_type (content_type, "text", "html")))
-	{
+	     ! g_mime_content_type_is_type (content_type, "text", "html"))) {
 	    show_text_part_content (node->part, stream, 0);
 	} else {
 	    char *content_string = g_mime_content_type_get_mime_type (content_type);
@@ -751,8 +750,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
 	 */
 	if (g_mime_content_type_is_type (content_type, "text", "*") &&
 	    (include_html ||
-	     ! g_mime_content_type_is_type (content_type, "text", "html")))
-	{
+	     ! g_mime_content_type_is_type (content_type, "text", "html"))) {
 	    GMimeStream *stream_memory = g_mime_stream_mem_new ();
 	    GByteArray *part_content;
 	    show_text_part_content (node->part, stream_memory, 0);
@@ -824,7 +822,7 @@ format_part_mbox (const void *ctx, unused (sprinter_t *sp), mime_node_t *node,
     ssize_t line_size;
     ssize_t line_len;
 
-    if (!message)
+    if (! message)
 	INTERNAL_ERROR ("format_part_mbox requires a root part");
 
     filename = notmuch_message_get_filename (message);
@@ -883,7 +881,7 @@ format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),
 	}
 
 	while (! g_mime_stream_eos (stream)) {
-	    ssize = g_mime_stream_read (stream, buf, sizeof(buf));
+	    ssize = g_mime_stream_read (stream, buf, sizeof (buf));
 	    if (ssize < 0) {
 		fprintf (stderr, "Error: Read failed from %s\n", filename);
 		goto DONE;
@@ -898,7 +896,7 @@ format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),
 	ret = NOTMUCH_STATUS_SUCCESS;
 
 	/* XXX This DONE is just for the special case of a node in a single file */
-    DONE:
+      DONE:
 	if (stream)
 	    g_object_unref (stream);
 
@@ -967,7 +965,7 @@ show_message (void *ctx,
 	    }
 	}
     }
-  DONE:
+    DONE :
     talloc_free (local);
     return status;
 }
@@ -990,8 +988,7 @@ show_messages (void *ctx,
 
     for (;
 	 notmuch_messages_valid (messages);
-	 notmuch_messages_move_to_next (messages))
-    {
+	 notmuch_messages_move_to_next (messages)) {
 	sp->begin_list (sp);
 
 	message = notmuch_messages_get (messages);
@@ -1001,9 +998,9 @@ show_messages (void *ctx,
 
 	next_indent = indent;
 
-	if ((match && (!excluded || !params->omit_excluded)) || params->entire_thread) {
+	if ((match && (! excluded || ! params->omit_excluded)) || params->entire_thread) {
 	    status = show_message (ctx, format, sp, message, indent, params);
-	    if (status && !res)
+	    if (status && ! res)
 		res = status;
 	    next_indent = indent + 1;
 	} else {
@@ -1015,7 +1012,7 @@ show_messages (void *ctx,
 				notmuch_message_get_replies (message),
 				next_indent,
 				params);
-	if (status && !res)
+	if (status && ! res)
 	    res = status;
 
 	notmuch_message_destroy (message);
@@ -1064,7 +1061,7 @@ do_show_single (void *ctx,
     notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH, 1);
 
     return show_message (ctx, format, sp, message, 0, params)
-	!= NOTMUCH_STATUS_SUCCESS;
+	   != NOTMUCH_STATUS_SUCCESS;
 }
 
 /* Formatted output of threads */
@@ -1080,16 +1077,15 @@ do_show (void *ctx,
     notmuch_messages_t *messages;
     notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;
 
-    status= notmuch_query_search_threads (query, &threads);
+    status = notmuch_query_search_threads (query, &threads);
     if (print_status_query ("notmuch show", query, status))
 	return 1;
 
     sp->begin_list (sp);
 
-    for ( ;
+    for (;
 	 notmuch_threads_valid (threads);
-	 notmuch_threads_move_to_next (threads))
-    {
+	 notmuch_threads_move_to_next (threads)) {
 	thread = notmuch_threads_get (threads);
 
 	messages = notmuch_thread_get_toplevel_messages (thread);
@@ -1099,7 +1095,7 @@ do_show (void *ctx,
 			    notmuch_thread_get_thread_id (thread));
 
 	status = show_messages (ctx, format, sp, messages, 0, params);
-	if (status && !res)
+	if (status && ! res)
 	    res = status;
 
 	notmuch_thread_destroy (thread);
@@ -1175,24 +1171,24 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
 
     notmuch_opt_desc_t options[] = {
 	{ .opt_keyword = &format, .name = "format", .keywords =
-	  (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
-				  { "text", NOTMUCH_FORMAT_TEXT },
-				  { "sexp", NOTMUCH_FORMAT_SEXP },
-				  { "mbox", NOTMUCH_FORMAT_MBOX },
-				  { "raw", NOTMUCH_FORMAT_RAW },
-				  { 0, 0 } } },
+	      (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
+				      { "text", NOTMUCH_FORMAT_TEXT },
+				      { "sexp", NOTMUCH_FORMAT_SEXP },
+				      { "mbox", NOTMUCH_FORMAT_MBOX },
+				      { "raw", NOTMUCH_FORMAT_RAW },
+				      { 0, 0 } } },
 	{ .opt_int = &notmuch_format_version, .name = "format-version" },
 	{ .opt_bool = &exclude, .name = "exclude" },
 	{ .opt_bool = &params.entire_thread, .name = "entire-thread",
 	  .present = &entire_thread_set },
 	{ .opt_int = &params.part, .name = "part" },
-	{ .opt_keyword = (int*)(&params.crypto.decrypt), .name = "decrypt",
+	{ .opt_keyword = (int *) (&params.crypto.decrypt), .name = "decrypt",
 	  .keyword_no_arg_value = "true", .keywords =
-	  (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE },
-				  { "auto", NOTMUCH_DECRYPT_AUTO },
-				  { "true", NOTMUCH_DECRYPT_NOSTASH },
-				  { "stash", NOTMUCH_DECRYPT_TRUE },
-				  { 0, 0 } } },
+	      (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE },
+				      { "auto", NOTMUCH_DECRYPT_AUTO },
+				      { "true", NOTMUCH_DECRYPT_NOSTASH },
+				      { "stash", NOTMUCH_DECRYPT_TRUE },
+				      { 0, 0 } } },
 	{ .opt_bool = &params.crypto.verify, .name = "verify" },
 	{ .opt_bool = &params.output_body, .name = "body" },
 	{ .opt_bool = &params.include_html, .name = "include-html" },
@@ -1240,7 +1236,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
 	(format == NOTMUCH_FORMAT_JSON || format == NOTMUCH_FORMAT_SEXP))
 	params.entire_thread = true;
 
-    if (!params.output_body) {
+    if (! params.output_body) {
 	if (params.part > 0) {
 	    fprintf (stderr, "Warning: --body=false is incompatible with --part > 0. Disabling.\n");
 	    params.output_body = true;
@@ -1254,13 +1250,13 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
     }
 
     if (params.include_html &&
-        (format != NOTMUCH_FORMAT_TEXT &&
+	(format != NOTMUCH_FORMAT_TEXT &&
 	 format != NOTMUCH_FORMAT_JSON &&
 	 format != NOTMUCH_FORMAT_SEXP)) {
 	fprintf (stderr, "Warning: --include-html only implemented for format=text, format=json and format=sexp\n");
     }
 
-    query_string = query_string_from_args (config, argc-opt_index, argv+opt_index);
+    query_string = query_string_from_args (config, argc - opt_index, argv + opt_index);
     if (query_string == NULL) {
 	fprintf (stderr, "Out of memory\n");
 	return EXIT_FAILURE;
@@ -1288,7 +1284,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
 
     /* Create structure printer. */
     formatter = formatters[format];
-    sprinter = formatter->new_sprinter(config, stdout);
+    sprinter = formatter->new_sprinter (config, stdout);
 
     params.out_stream = g_mime_stream_stdout_new ();
 
@@ -1305,7 +1301,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
 	notmuch_status_t status;
 
 	search_exclude_tags = notmuch_config_get_search_exclude_tags
-	    (config, &search_exclude_tags_length);
+				  (config, &search_exclude_tags_length);
 
 	for (i = 0; i < search_exclude_tags_length; i++) {
 	    status = notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
@@ -1324,7 +1320,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
 	ret = do_show (config, query, formatter, sprinter, &params);
     }
 
- DONE:
+    DONE :
     g_mime_stream_flush (params.out_stream);
     g_object_unref (params.out_stream);
 
diff --git a/notmuch-time.c b/notmuch-time.c
index 2734b36a..cc7ffc23 100644
--- a/notmuch-time.c
+++ b/notmuch-time.c
@@ -39,14 +39,14 @@
  *
  */
 #define MINUTE (60)
-#define HOUR (60 * MINUTE)
-#define DAY (24 * HOUR)
+#define HOUR (60 *MINUTE)
+#define DAY (24 *HOUR)
 #define RELATIVE_DATE_MAX 20
 const char *
 notmuch_time_relative_date (const void *ctx, time_t then)
 {
     struct tm tm_now, tm_then;
-    time_t now = time(NULL);
+    time_t now = time (NULL);
     time_t delta;
     char *result;
 
@@ -76,26 +76,25 @@ notmuch_time_relative_date (const void *ctx, time_t then)
 
     if (delta <= 7 * DAY) {
 	if (tm_then.tm_wday == tm_now.tm_wday &&
-	    delta < DAY)
-	{
+	    delta < DAY) {
 	    strftime (result, RELATIVE_DATE_MAX,
-		      "Today %R", &tm_then); /* Today 12:30 */
+		      "Today %R", &tm_then);    /* Today 12:30 */
 	    return result;
 	} else if ((tm_now.tm_wday + 7 - tm_then.tm_wday) % 7 == 1) {
 	    strftime (result, RELATIVE_DATE_MAX,
-		      "Yest. %R", &tm_then); /* Yest. 12:30 */
+		      "Yest. %R", &tm_then);    /* Yest. 12:30 */
 	    return result;
 	} else {
 	    if (tm_then.tm_wday != tm_now.tm_wday) {
 		strftime (result, RELATIVE_DATE_MAX,
-			  "%a. %R", &tm_then); /* Mon. 12:30 */
+			  "%a. %R", &tm_then);  /* Mon. 12:30 */
 		return result;
 	    }
 	}
     }
 
     strftime (result, RELATIVE_DATE_MAX,
-	      "%B %d", &tm_then); /* October 12 */
+	      "%B %d", &tm_then);               /* October 12 */
     return result;
 }
 #undef MINUTE
diff --git a/notmuch.c b/notmuch.c
index 2ddc8fbc..4ef1484f 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -61,9 +61,10 @@ const notmuch_opt_desc_t notmuch_shared_options [] = {
  * notmuch_process_shared_options (subcommand_name);
  */
 void
-notmuch_process_shared_options (const char *subcommand_name) {
+notmuch_process_shared_options (const char *subcommand_name)
+{
     if (print_version) {
-	printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");
+	printf ("notmuch " STRINGIFY (NOTMUCH_VERSION) "\n");
 	exit (EXIT_SUCCESS);
     }
 
@@ -76,8 +77,9 @@ notmuch_process_shared_options (const char *subcommand_name) {
 /* This is suitable for subcommands that do not actually open the
  * database.
  */
-int notmuch_minimal_options (const char *subcommand_name,
-				  int argc, char **argv)
+int
+notmuch_minimal_options (const char *subcommand_name,
+			 int argc, char **argv)
 {
     int opt_index;
 
@@ -98,14 +100,14 @@ int notmuch_minimal_options (const char *subcommand_name,
 
 
 struct _notmuch_client_indexing_cli_choices indexing_cli_choices = { };
-const notmuch_opt_desc_t  notmuch_shared_indexing_options [] = {
+const notmuch_opt_desc_t notmuch_shared_indexing_options [] = {
     { .opt_keyword = &indexing_cli_choices.decrypt_policy,
       .present = &indexing_cli_choices.decrypt_policy_set, .keywords =
-      (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE },
-			      { "true", NOTMUCH_DECRYPT_TRUE },
-			      { "auto", NOTMUCH_DECRYPT_AUTO },
-			      { "nostash", NOTMUCH_DECRYPT_NOSTASH },
-			      { 0, 0 } },
+	  (notmuch_keyword_t []){ { "false", NOTMUCH_DECRYPT_FALSE },
+				  { "true", NOTMUCH_DECRYPT_TRUE },
+				  { "auto", NOTMUCH_DECRYPT_AUTO },
+				  { "nostash", NOTMUCH_DECRYPT_NOSTASH },
+				  { 0, 0 } },
       .name = "decrypt" },
     { }
 };
@@ -192,7 +194,7 @@ find_command (const char *name)
     size_t i;
 
     for (i = 0; i < ARRAY_SIZE (commands); i++)
-	if ((!name && !commands[i].name) ||
+	if ((! name && ! commands[i].name) ||
 	    (name && commands[i].name && strcmp (name, commands[i].name) == 0))
 	    return &commands[i];
 
@@ -270,11 +272,11 @@ notmuch_exit_if_unmatched_db_uuid (notmuch_database_t *notmuch)
 {
     const char *uuid = NULL;
 
-    if (!notmuch_requested_db_uuid)
+    if (! notmuch_requested_db_uuid)
 	return;
     IGNORE_RESULT (notmuch_database_get_revision (notmuch, &uuid));
 
-    if (strcmp (notmuch_requested_db_uuid, uuid) != 0){
+    if (strcmp (notmuch_requested_db_uuid, uuid) != 0) {
 	fprintf (stderr, "Error: requested database revision %s does not match %s\n",
 		 notmuch_requested_db_uuid, uuid);
 	exit (1);
@@ -297,7 +299,7 @@ _help_for (const char *topic_name)
     help_topic_t *topic;
     unsigned int i;
 
-    if (!topic_name) {
+    if (! topic_name) {
 	printf ("The notmuch mail system.\n\n");
 	usage (stdout);
 	return EXIT_SUCCESS;
@@ -333,7 +335,7 @@ _help_for (const char *topic_name)
 }
 
 static int
-notmuch_help_command (unused (notmuch_config_t * config), int argc, char *argv[])
+notmuch_help_command (unused (notmuch_config_t *config), int argc, char *argv[])
 {
     int opt_index;
 
@@ -342,8 +344,8 @@ notmuch_help_command (unused (notmuch_config_t * config), int argc, char *argv[]
 	return EXIT_FAILURE;
 
     /* skip at least subcommand argument */
-    argc-= opt_index;
-    argv+= opt_index;
+    argc -= opt_index;
+    argv += opt_index;
 
     if (argc == 0) {
 	return _help_for (NULL);
@@ -417,7 +419,8 @@ notmuch_command (notmuch_config_t *config,
  * executed. Return true if external command is not found. Return
  * false on errors.
  */
-static bool try_external_command(char *argv[])
+static bool
+try_external_command (char *argv[])
 {
     char *old_argv0 = argv[0];
     bool ret = true;
@@ -431,7 +434,7 @@ static bool try_external_command(char *argv[])
     execvp (argv[0], argv);
     if (errno != ENOENT) {
 	fprintf (stderr, "Error: Running external command '%s' failed: %s\n",
-		 argv[0], strerror(errno));
+		 argv[0], strerror (errno));
 	ret = false;
     }
 
@@ -464,7 +467,7 @@ main (int argc, char *argv[])
     local = talloc_new (NULL);
 
     g_mime_init ();
-#if !GLIB_CHECK_VERSION(2, 35, 1)
+#if ! GLIB_CHECK_VERSION (2, 35, 1)
     g_type_init ();
 #endif
 
@@ -484,9 +487,9 @@ main (int argc, char *argv[])
 
     command = find_command (command_name);
     /* if command->function is NULL, try external command */
-    if (!command || !command->function) {
+    if (! command || ! command->function) {
 	/* This won't return if the external command is found. */
-	if (try_external_command(argv + opt_index))
+	if (try_external_command (argv + opt_index))
 	    fprintf (stderr, "Error: Unknown command '%s' (see \"notmuch help\")\n",
 		     command_name);
 	ret = EXIT_FAILURE;
@@ -494,7 +497,7 @@ main (int argc, char *argv[])
     }
 
     config = notmuch_config_open (local, config_file_name, command->config_mode);
-    if (!config) {
+    if (! config) {
 	ret = EXIT_FAILURE;
 	goto DONE;
     }
diff --git a/sprinter.h b/sprinter.h
index 9d2e9b6f..182b1a8b 100644
--- a/sprinter.h
+++ b/sprinter.h
@@ -13,15 +13,15 @@ typedef struct sprinter {
      * a sequence of alternating calls to map_key and one of the
      * value-printing functions until the map is ended by end.
      */
-    void (*begin_map) (struct sprinter *);
+    void (*begin_map)(struct sprinter *);
 
     /* Start a new list/array structure.
      */
-    void (*begin_list) (struct sprinter *);
+    void (*begin_list)(struct sprinter *);
 
     /* End the last opened list or map structure.
      */
-    void (*end) (struct sprinter *);
+    void (*end)(struct sprinter *);
 
     /* Print one string/integer/boolean/null element (possibly inside
      * a list or map, followed or preceded by separators).  For string
@@ -31,16 +31,16 @@ typedef struct sprinter {
      * string (but not string_len) the string pointer passed may be
      * NULL.
      */
-    void (*string) (struct sprinter *, const char *);
-    void (*string_len) (struct sprinter *, const char *, size_t);
-    void (*integer) (struct sprinter *, int);
-    void (*boolean) (struct sprinter *, bool);
-    void (*null) (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 *, bool);
+    void (*null)(struct sprinter *);
 
     /* Print the key of a map's key/value pair. The char * must be UTF-8
      * encoded.
      */
-    void (*map_key) (struct sprinter *, const char *);
+    void (*map_key)(struct sprinter *, const char *);
 
     /* Insert a separator (usually extra whitespace). For the text
      * printers, this is a syntactic separator. For the structured
@@ -48,13 +48,13 @@ typedef struct sprinter {
      * the abstract syntax of the structure being printed. For JSON,
      * this could simply be a line break.
      */
-    void (*separator) (struct sprinter *);
+    void (*separator)(struct sprinter *);
 
     /* Set the current string prefix. This only affects the text
      * printer, which will print this string, followed by a colon,
      * before any string. For other printers, this does nothing.
      */
-    void (*set_prefix) (struct sprinter *, const char *);
+    void (*set_prefix)(struct sprinter *, const char *);
 
     /* True if this is the special-cased plain text printer.
      */
diff --git a/status.c b/status.c
index 01fd8c99..d0ae47f4 100644
--- a/status.c
+++ b/status.c
@@ -42,8 +42,8 @@ print_status_message (const char *loc,
 
 notmuch_status_t
 print_status_database (const char *loc,
-		    const notmuch_database_t *notmuch,
-		    notmuch_status_t status)
+		       const notmuch_database_t *notmuch,
+		       notmuch_status_t status)
 {
     if (status) {
 	const char *msg;
diff --git a/tag-util.h b/tag-util.h
index ba0d98c8..bbe54d99 100644
--- a/tag-util.h
+++ b/tag-util.h
@@ -8,25 +8,25 @@ typedef struct _tag_op_list_t tag_op_list_t;
 
 /* Use powers of 2 */
 typedef enum {
-    TAG_FLAG_NONE = 0,
+    TAG_FLAG_NONE		= 0,
 
     /* Operations are synced to maildir, if possible.
      */
-    TAG_FLAG_MAILDIR_SYNC = (1 << 0),
+    TAG_FLAG_MAILDIR_SYNC	= (1 << 0),
 
     /* Remove all tags from message before applying list.
      */
-    TAG_FLAG_REMOVE_ALL = (1 << 1),
+    TAG_FLAG_REMOVE_ALL		= (1 << 1),
 
     /* Don't try to avoid database operations. Useful when we
      * know that message passed needs these operations.
      */
-    TAG_FLAG_PRE_OPTIMIZED = (1 << 2),
+    TAG_FLAG_PRE_OPTIMIZED	= (1 << 2),
 
     /* Accept strange tags that might be user error;
      * intended for use by notmuch-restore.
      */
-    TAG_FLAG_BE_GENEROUS = (1 << 3)
+    TAG_FLAG_BE_GENEROUS	= (1 << 3)
 
 } tag_op_flag_t;
 
@@ -34,16 +34,16 @@ typedef enum {
  * skipped lines are positive.
  */
 typedef enum {
-    TAG_PARSE_OUT_OF_MEMORY = -1,
+    TAG_PARSE_OUT_OF_MEMORY	= -1,
 
     /* Line parsed successfully. */
-    TAG_PARSE_SUCCESS = 0,
+    TAG_PARSE_SUCCESS		= 0,
 
     /* Line has a syntax error */
-    TAG_PARSE_INVALID = 1,
+    TAG_PARSE_INVALID		= 1,
 
     /* Line was blank or a comment */
-    TAG_PARSE_SKIPPED = 2
+    TAG_PARSE_SKIPPED		= 2
 
 } tag_parse_status_t;
 
-- 
2.20.1

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

Thread: