unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] run uncrustify.
@ 2021-03-06 17:22 David Bremner
  2021-03-07 17:16 ` David Bremner
  0 siblings, 1 reply; 2+ messages in thread
From: David Bremner @ 2021-03-06 17:22 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

This is mainly fixing up style problems that crept in with the first
merged config handling series. It also takes a few other suggestions
from uncrustify as this makes it easier to detect future style
problems.
---
 this is on top of id:20210306134934.491249-1-david@tethera.net

 lib/config.cc         | 68 ++++++++++++++++++++++++++-----------------
 lib/database.cc       | 12 ++++----
 lib/notmuch-private.h | 40 ++++++++++++-------------
 lib/notmuch.h         |  4 +--
 lib/open.cc           | 10 +++----
 lib/prefix.cc         |  4 +--
 lib/string-map.c      |  6 ++--
 notmuch-client.h      |  2 +-
 notmuch-config.c      |  4 ++-
 notmuch-count.c       | 10 +++----
 notmuch-dump.c        |  4 +--
 notmuch-insert.c      |  2 +-
 notmuch-new.c         |  5 ++--
 notmuch-restore.c     |  1 +
 notmuch-show.c        | 12 +++++---
 util/string-util.c    |  3 +-
 16 files changed, 106 insertions(+), 81 deletions(-)

diff --git a/lib/config.cc b/lib/config.cc
index 6ace6e52..43c5ddec 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -38,7 +38,7 @@ struct _notmuch_config_values {
     void *children; /* talloc_context */
 };
 
-static const char * _notmuch_config_key_to_string (notmuch_config_key_t key);
+static const char *_notmuch_config_key_to_string (notmuch_config_key_t key);
 
 static int
 _notmuch_config_list_destroy (notmuch_config_list_t *list)
@@ -104,7 +104,7 @@ notmuch_database_get_config (notmuch_database_t *notmuch,
 			     const char *key,
 			     char **value)
 {
-    const char* stored_val;
+    const char *stored_val;
     notmuch_status_t status;
 
     if (! notmuch->config) {
@@ -119,7 +119,7 @@ notmuch_database_get_config (notmuch_database_t *notmuch,
     if (! stored_val) {
 	/* XXX in principle this API should be fixed so empty string
 	 * is distinguished from not found */
-	*value = strdup("");
+	*value = strdup ("");
     } else {
 	*value = strdup (stored_val);
     }
@@ -167,7 +167,7 @@ notmuch_database_get_config_list (notmuch_database_t *notmuch,
 	    if (status != NOTMUCH_STATUS_XAPIAN_EXCEPTION)
 		_notmuch_config_list_destroy (list);
 	}
-    }  else {
+    } else {
 	talloc_set_destructor (list, _notmuch_config_list_destroy);
     }
 
@@ -183,7 +183,9 @@ notmuch_config_list_valid (notmuch_config_list_t *metadata)
     return true;
 }
 
-static inline char * _key_from_iterator (notmuch_config_list_t *list) {
+static inline char *
+_key_from_iterator (notmuch_config_list_t *list)
+{
     return talloc_strdup (list, (*list->iterator).c_str () + CONFIG_PREFIX.length ());
 }
 
@@ -239,7 +241,7 @@ _notmuch_config_load_from_database (notmuch_database_t *notmuch)
     if (notmuch->config == NULL)
 	notmuch->config = _notmuch_string_map_create (notmuch);
 
-    if (unlikely(notmuch->config == NULL))
+    if (unlikely (notmuch->config == NULL))
 	return NOTMUCH_STATUS_OUT_OF_MEMORY;
 
     status = notmuch_database_get_config_list (notmuch, "", &list);
@@ -267,7 +269,7 @@ notmuch_config_get_values (notmuch_database_t *notmuch, notmuch_config_key_t key
 	goto DONE;
 
     values = talloc (notmuch, notmuch_config_values_t);
-    if (unlikely(! values))
+    if (unlikely (! values))
 	goto DONE;
 
     values->children = talloc_new (values);
@@ -279,17 +281,18 @@ notmuch_config_get_values (notmuch_database_t *notmuch, notmuch_config_key_t key
     values->iterator = strsplit_len (values->string, ';', &(values->tok_len));
     ok = true;
 
- DONE:
-    if (!ok) {
+  DONE:
+    if (! ok) {
 	if (values)
-	    talloc_free(values);
+	    talloc_free (values);
 	return NULL;
     }
     return values;
 }
 
 notmuch_bool_t
-notmuch_config_values_valid (notmuch_config_values_t *values) {
+notmuch_config_values_valid (notmuch_config_values_t *values)
+{
     if (! values)
 	return false;
 
@@ -297,12 +300,14 @@ notmuch_config_values_valid (notmuch_config_values_t *values) {
 }
 
 const char *
-notmuch_config_values_get (notmuch_config_values_t *values) {
+notmuch_config_values_get (notmuch_config_values_t *values)
+{
     return talloc_strndup (values, values->iterator, values->tok_len);
 }
 
 void
-notmuch_config_values_start (notmuch_config_values_t *values) {
+notmuch_config_values_start (notmuch_config_values_t *values)
+{
     if (values == NULL)
 	return;
     if (values->children) {
@@ -315,13 +320,15 @@ notmuch_config_values_start (notmuch_config_values_t *values) {
 }
 
 void
-notmuch_config_values_move_to_next (notmuch_config_values_t *values) {
+notmuch_config_values_move_to_next (notmuch_config_values_t *values)
+{
     values->iterator += values->tok_len;
     values->iterator = strsplit_len (values->iterator, ';', &(values->tok_len));
 }
 
 void
-notmuch_config_values_destroy (notmuch_config_values_t *values) {
+notmuch_config_values_destroy (notmuch_config_values_t *values)
+{
     talloc_free (values);
 }
 
@@ -335,16 +342,16 @@ _notmuch_config_load_from_file (notmuch_database_t *notmuch,
     if (notmuch->config == NULL)
 	notmuch->config = _notmuch_string_map_create (notmuch);
 
-    if (unlikely(notmuch->config == NULL)) {
+    if (unlikely (notmuch->config == NULL)) {
 	status = NOTMUCH_STATUS_OUT_OF_MEMORY;
 	goto DONE;
     }
 
     groups = g_key_file_get_groups (file, NULL);
-    for (gchar **grp=groups; *grp; grp++) {
+    for (gchar **grp = groups; *grp; grp++) {
 	keys = g_key_file_get_keys (file, *grp, NULL, NULL);
 	for (gchar **keys_p = keys; *keys_p; keys_p++) {
-	    char *absolute_key = talloc_asprintf(notmuch, "%s.%s", *grp,  *keys_p);
+	    char *absolute_key = talloc_asprintf (notmuch, "%s.%s", *grp,  *keys_p);
 	    val = g_key_file_get_value (file, *grp, *keys_p, NULL);
 	    if (! val) {
 		status = NOTMUCH_STATUS_FILE_ERROR;
@@ -359,7 +366,7 @@ _notmuch_config_load_from_file (notmuch_database_t *notmuch,
 	g_strfreev (keys);
     }
 
- DONE:
+  DONE:
     if (groups)
 	g_strfreev (groups);
 
@@ -393,7 +400,8 @@ notmuch_config_get_bool (notmuch_database_t *notmuch, notmuch_config_key_t key,
 }
 
 static const char *
-_notmuch_config_key_to_string (notmuch_config_key_t key) {
+_notmuch_config_key_to_string (notmuch_config_key_t key)
+{
     switch (key) {
     case NOTMUCH_CONFIG_DATABASE_PATH:
 	return "database.path";
@@ -419,7 +427,8 @@ _notmuch_config_key_to_string (notmuch_config_key_t key) {
 }
 
 static const char *
-_notmuch_config_default (void *ctx, notmuch_config_key_t key) {
+_notmuch_config_default (void *ctx, notmuch_config_key_t key)
+{
     char *path;
 
     switch (key) {
@@ -446,15 +455,17 @@ _notmuch_config_default (void *ctx, notmuch_config_key_t key) {
     default:
     case NOTMUCH_CONFIG_LAST:
 	INTERNAL_ERROR ("illegal key enum %d", key);
-   }
+    }
 }
 
 notmuch_status_t
-_notmuch_config_load_defaults (notmuch_database_t *notmuch) {
+_notmuch_config_load_defaults (notmuch_database_t *notmuch)
+{
     notmuch_config_key_t key;
+
     for (key = NOTMUCH_CONFIG_FIRST;
 	 key < NOTMUCH_CONFIG_LAST;
-	 key = notmuch_config_key_t(key + 1)) {
+	 key = notmuch_config_key_t (key + 1)) {
 	const char *val = notmuch_config_get (notmuch, key);
 	const char *key_string = _notmuch_config_key_to_string (key);
 
@@ -467,18 +478,21 @@ _notmuch_config_load_defaults (notmuch_database_t *notmuch) {
 }
 
 const char *
-notmuch_config_get (notmuch_database_t *notmuch, notmuch_config_key_t key) {
+notmuch_config_get (notmuch_database_t *notmuch, notmuch_config_key_t key)
+{
 
     return _notmuch_string_map_get (notmuch->config, _notmuch_config_key_to_string (key));
 }
 
 notmuch_status_t
-notmuch_config_set (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val) {
+notmuch_config_set (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val)
+{
 
     return notmuch_database_set_config (notmuch, _notmuch_config_key_to_string (key), val);
 }
 
 void
-_notmuch_config_cache (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val) {
+_notmuch_config_cache (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val)
+{
     _notmuch_string_map_set (notmuch->config, _notmuch_config_key_to_string (key), val);
 }
diff --git a/lib/database.cc b/lib/database.cc
index f96ba7c0..b4e536b9 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -49,7 +49,8 @@ typedef struct {
 #define LOG_XAPIAN_EXCEPTION(message, error) _log_xapian_exception (__location__, message, error)
 
 static void
-_log_xapian_exception (const char *where, notmuch_database_t *notmuch,  const Xapian::Error error) {
+_log_xapian_exception (const char *where, notmuch_database_t *notmuch,  const Xapian::Error error)
+{
     _notmuch_database_log (notmuch,
 			   "A Xapian exception occurred at %s: %s\n",
 			   where,
@@ -627,10 +628,11 @@ notmuch_status_t
 notmuch_database_compact_db (notmuch_database_t *notmuch,
 			     const char *backup_path,
 			     notmuch_compact_status_cb_t status_cb,
-			     void *closure) {
+			     void *closure)
+{
     void *local;
     char *notmuch_path, *xapian_path, *compact_xapian_path;
-    const char* path;
+    const char *path;
     notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
     struct stat statbuf;
     bool keep_backup;
@@ -840,8 +842,8 @@ handle_sigalrm (unused (int signal))
  */
 notmuch_status_t
 notmuch_database_upgrade (notmuch_database_t *notmuch,
-			  void (*progress_notify) (void *closure,
-						   double progress),
+			  void (*progress_notify)(void *closure,
+						  double progress),
 			  void *closure)
 {
     void *local = talloc_new (NULL);
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 750a242c..e47badbc 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -123,21 +123,21 @@ typedef enum {
 
 typedef enum _notmuch_private_status {
     /* First, copy all the public status values. */
-    NOTMUCH_PRIVATE_STATUS_SUCCESS			= NOTMUCH_STATUS_SUCCESS,
-    NOTMUCH_PRIVATE_STATUS_OUT_OF_MEMORY		= NOTMUCH_STATUS_OUT_OF_MEMORY,
-    NOTMUCH_PRIVATE_STATUS_READ_ONLY_DATABASE		= NOTMUCH_STATUS_READ_ONLY_DATABASE,
-    NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION		= NOTMUCH_STATUS_XAPIAN_EXCEPTION,
-    NOTMUCH_PRIVATE_STATUS_FILE_ERROR			= NOTMUCH_STATUS_FILE_ERROR,
-    NOTMUCH_PRIVATE_STATUS_FILE_NOT_EMAIL		= NOTMUCH_STATUS_FILE_NOT_EMAIL,
-    NOTMUCH_PRIVATE_STATUS_NULL_POINTER			= NOTMUCH_STATUS_NULL_POINTER,
-    NOTMUCH_PRIVATE_STATUS_TAG_TOO_LONG			= NOTMUCH_STATUS_TAG_TOO_LONG,
-    NOTMUCH_PRIVATE_STATUS_UNBALANCED_FREEZE_THAW	= NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW,
-    NOTMUCH_PRIVATE_STATUS_UNBALANCED_ATOMIC		= NOTMUCH_STATUS_UNBALANCED_ATOMIC,
-    NOTMUCH_PRIVATE_STATUS_UNSUPPORTED_OPERATION	= NOTMUCH_STATUS_UNSUPPORTED_OPERATION,
-    NOTMUCH_PRIVATE_STATUS_UPGRADE_REQUIRED		= NOTMUCH_STATUS_UPGRADE_REQUIRED,
-    NOTMUCH_PRIVATE_STATUS_PATH_ERROR			= NOTMUCH_STATUS_PATH_ERROR,
-    NOTMUCH_PRIVATE_STATUS_IGNORED			= NOTMUCH_STATUS_IGNORED,
-    NOTMUCH_PRIVATE_STATUS_ILLEGAL_ARGUMENT		= NOTMUCH_STATUS_ILLEGAL_ARGUMENT,
+    NOTMUCH_PRIVATE_STATUS_SUCCESS				= NOTMUCH_STATUS_SUCCESS,
+    NOTMUCH_PRIVATE_STATUS_OUT_OF_MEMORY			= NOTMUCH_STATUS_OUT_OF_MEMORY,
+    NOTMUCH_PRIVATE_STATUS_READ_ONLY_DATABASE			= NOTMUCH_STATUS_READ_ONLY_DATABASE,
+    NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION			= NOTMUCH_STATUS_XAPIAN_EXCEPTION,
+    NOTMUCH_PRIVATE_STATUS_FILE_ERROR				= NOTMUCH_STATUS_FILE_ERROR,
+    NOTMUCH_PRIVATE_STATUS_FILE_NOT_EMAIL			= NOTMUCH_STATUS_FILE_NOT_EMAIL,
+    NOTMUCH_PRIVATE_STATUS_NULL_POINTER				= NOTMUCH_STATUS_NULL_POINTER,
+    NOTMUCH_PRIVATE_STATUS_TAG_TOO_LONG				= NOTMUCH_STATUS_TAG_TOO_LONG,
+    NOTMUCH_PRIVATE_STATUS_UNBALANCED_FREEZE_THAW		= NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW,
+    NOTMUCH_PRIVATE_STATUS_UNBALANCED_ATOMIC			= NOTMUCH_STATUS_UNBALANCED_ATOMIC,
+    NOTMUCH_PRIVATE_STATUS_UNSUPPORTED_OPERATION		= NOTMUCH_STATUS_UNSUPPORTED_OPERATION,
+    NOTMUCH_PRIVATE_STATUS_UPGRADE_REQUIRED			= NOTMUCH_STATUS_UPGRADE_REQUIRED,
+    NOTMUCH_PRIVATE_STATUS_PATH_ERROR				= NOTMUCH_STATUS_PATH_ERROR,
+    NOTMUCH_PRIVATE_STATUS_IGNORED				= NOTMUCH_STATUS_IGNORED,
+    NOTMUCH_PRIVATE_STATUS_ILLEGAL_ARGUMENT			= NOTMUCH_STATUS_ILLEGAL_ARGUMENT,
     NOTMUCH_PRIVATE_STATUS_MALFORMED_CRYPTO_PROTOCOL		= NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL,
     NOTMUCH_PRIVATE_STATUS_FAILED_CRYPTO_CONTEXT_CREATION	= NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION,
     NOTMUCH_PRIVATE_STATUS_UNKNOWN_CRYPTO_PROTOCOL		= NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL,
@@ -145,7 +145,7 @@ typedef enum _notmuch_private_status {
     NOTMUCH_PRIVATE_STATUS_DATABASE_EXISTS			= NOTMUCH_STATUS_DATABASE_EXISTS,
 
     /* Then add our own private values. */
-    NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG		= NOTMUCH_STATUS_LAST_STATUS,
+    NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG			= NOTMUCH_STATUS_LAST_STATUS,
     NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND,
     NOTMUCH_PRIVATE_STATUS_BAD_PREFIX,
 
@@ -716,16 +716,16 @@ struct _notmuch_indexopts {
 
 /* config.cc */
 notmuch_status_t
-_notmuch_config_load_from_database (notmuch_database_t * db);
+_notmuch_config_load_from_database (notmuch_database_t *db);
 
 notmuch_status_t
-_notmuch_config_load_from_file (notmuch_database_t * db, GKeyFile *file);
+_notmuch_config_load_from_file (notmuch_database_t *db, GKeyFile *file);
 
 notmuch_status_t
-_notmuch_config_load_defaults (notmuch_database_t * db);
+_notmuch_config_load_defaults (notmuch_database_t *db);
 
 void
-_notmuch_config_cache (notmuch_database_t *db, notmuch_config_key_t key, const char* val);
+_notmuch_config_cache (notmuch_database_t *db, notmuch_config_key_t key, const char *val);
 
 NOTMUCH_END_DECLS
 
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 5a5d99c0..70f4f517 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -1631,7 +1631,7 @@ typedef enum _notmuch_message_flag {
  * @deprecated Deprecated as of libnotmuch 5.3 (notmuch 0.31). Please
  * use notmuch_message_get_flag_st instead.
  */
-NOTMUCH_DEPRECATED(5,3)
+NOTMUCH_DEPRECATED (5, 3)
 notmuch_bool_t
 notmuch_message_get_flag (notmuch_message_t *message,
 			  notmuch_message_flag_t flag);
@@ -1826,7 +1826,7 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message);
  * @returns FALSE in case of error
  * @deprecated libnotmuch 5.3 (notmuch 0.31)
  */
-NOTMUCH_DEPRECATED(5, 3)
+NOTMUCH_DEPRECATED (5, 3)
 notmuch_bool_t
 notmuch_message_has_maildir_flag (notmuch_message_t *message, char flag);
 
diff --git a/lib/open.cc b/lib/open.cc
index a5211746..edf46d32 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -85,7 +85,7 @@ _choose_hook_dir (notmuch_database_t *notmuch,
 
     config = _xdg_dir (notmuch, "XDG_CONFIG_HOME", ".config", profile);
     if (! config)
-	return  NOTMUCH_STATUS_PATH_ERROR;
+	return NOTMUCH_STATUS_PATH_ERROR;
 
     hook_dir = talloc_asprintf (notmuch, "%s/hooks", config);
 
@@ -125,7 +125,7 @@ _load_key_file (const char *path,
 
 	if (dir) {
 	    path = talloc_asprintf (local, "%s/config", dir);
-	    if (access (path, R_OK) !=0)
+	    if (access (path, R_OK) != 0)
 		path = NULL;
 	}
     }
@@ -147,7 +147,7 @@ _load_key_file (const char *path,
 	status = NOTMUCH_STATUS_NO_CONFIG;
     }
 
-DONE:
+  DONE:
     talloc_free (local);
     return status;
 }
@@ -162,14 +162,14 @@ _choose_database_path (void *ctx,
 {
     notmuch_status_t status;
 
-    status =_load_key_file (config_path, profile, key_file);
+    status = _load_key_file (config_path, profile, key_file);
     if (status) {
 	*message = strdup ("Error: cannot load config file.\n");
 	return status;
     }
 
     if (! *database_path && *key_file) {
-	char *path  = g_key_file_get_value (*key_file, "database", "path", NULL);
+	char *path = g_key_file_get_value (*key_file, "database", "path", NULL);
 	if (path) {
 	    *database_path = talloc_strdup (ctx, path);
 	    g_free (path);
diff --git a/lib/prefix.cc b/lib/prefix.cc
index 71a76991..0d92bdd7 100644
--- a/lib/prefix.cc
+++ b/lib/prefix.cc
@@ -133,8 +133,8 @@ _setup_query_field (const prefix_t *prefix, notmuch_database_t *notmuch)
 	Xapian::FieldProcessor *fp;
 
 	if (STRNCMP_LITERAL (prefix->name, "date") == 0)
-	    fp = (new DateFieldProcessor(NOTMUCH_VALUE_TIMESTAMP))->release ();
-	else if (STRNCMP_LITERAL(prefix->name, "query") == 0)
+	    fp = (new DateFieldProcessor (NOTMUCH_VALUE_TIMESTAMP))->release ();
+	else if (STRNCMP_LITERAL (prefix->name, "query") == 0)
 	    fp = (new QueryFieldProcessor (*notmuch->query_parser, notmuch))->release ();
 	else if (STRNCMP_LITERAL (prefix->name, "thread") == 0)
 	    fp = (new ThreadFieldProcessor (*notmuch->query_parser, notmuch))->release ();
diff --git a/lib/string-map.c b/lib/string-map.c
index 71eac634..e3a81b4f 100644
--- a/lib/string-map.c
+++ b/lib/string-map.c
@@ -154,10 +154,10 @@ _notmuch_string_map_set (notmuch_string_map_t *map,
     _notmuch_string_map_sort (map);
     pair = bsearch_first (map->pairs, map->length, key, true);
     if (! pair)
-       _notmuch_string_map_append (map, key, val);
+	_notmuch_string_map_append (map, key, val);
     else {
-       talloc_free (pair->value);
-       pair->value = talloc_strdup (map->pairs, val);
+	talloc_free (pair->value);
+	pair->value = talloc_strdup (map->pairs, val);
     }
 }
 
diff --git a/notmuch-client.h b/notmuch-client.h
index f60f5406..354a115e 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -505,7 +505,7 @@ print_status_gzbytes (const char *loc,
 /* the __location__ macro is defined in talloc.h */
 #define ASSERT_GZBYTES(file, bytes) ((print_status_gzbytes (__location__, file, bytes)) ? exit (1) : 0)
 #define GZPRINTF(file, fmt, ...) ASSERT_GZBYTES (file, gzprintf (file, fmt, ##__VA_ARGS__));
-#define GZPUTS(file, str) ASSERT_GZBYTES(file, gzputs (file, str));
+#define GZPUTS(file, str) ASSERT_GZBYTES (file, gzputs (file, str));
 
 #include "command-line-arguments.h"
 
diff --git a/notmuch-config.c b/notmuch-config.c
index 0193401f..1a865681 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -510,7 +510,9 @@ notmuch_config_close (notmuch_config_t *config)
     talloc_free (config);
 }
 
-const char *_notmuch_config_get_path (notmuch_config_t *config) {
+const char *
+_notmuch_config_get_path (notmuch_config_t *config)
+{
     return config->filename;
 }
 /* Save any changes made to the notmuch configuration.
diff --git a/notmuch-count.c b/notmuch-count.c
index 048b1f44..8cedc18e 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -86,12 +86,12 @@ print_count (notmuch_database_t *notmuch, const char *query_str,
 
 	status = notmuch_query_add_tag_exclude (query,
 						notmuch_config_values_get (exclude_tags));
-	    if (status && status != NOTMUCH_STATUS_IGNORED) {
-		print_status_query ("notmuch count", query, status);
-		ret = -1;
-		goto DONE;
-	    }
+	if (status && status != NOTMUCH_STATUS_IGNORED) {
+	    print_status_query ("notmuch count", query, status);
+	    ret = -1;
+	    goto DONE;
 	}
+    }
 
     switch (output) {
     case OUTPUT_MESSAGES:
diff --git a/notmuch-dump.c b/notmuch-dump.c
index d7017929..9da39ac4 100644
--- a/notmuch-dump.c
+++ b/notmuch-dump.c
@@ -339,7 +339,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 	output = NULL;
 	goto DONE;
     } else
-        output = NULL;
+	output = NULL;
 
     if (output_file_name) {
 	ret = rename (tempname, output_file_name);
@@ -361,7 +361,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 }
 
 int
-notmuch_dump_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch , int argc, char *argv[])
+notmuch_dump_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
 {
     const char *query_str = NULL;
     int ret;
diff --git a/notmuch-insert.c b/notmuch-insert.c
index 0f272e2e..00505552 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -444,7 +444,7 @@ add_file (notmuch_database_t *notmuch, const char *path, tag_op_list_t *tag_ops,
 }
 
 int
-notmuch_insert_command (unused(notmuch_config_t *config),notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_insert_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
 {
     notmuch_status_t status, close_status;
     struct sigaction action;
diff --git a/notmuch-new.c b/notmuch-new.c
index 21e66af1..e0590a57 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -1043,7 +1043,8 @@ print_results (const add_files_state_t *state)
 }
 
 static int
-_maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state) {
+_maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state)
+{
     if (notmuch_database_needs_upgrade (notmuch)) {
 	time_t now = time (NULL);
 	struct tm *gm_time = gmtime (&now);
@@ -1155,7 +1156,7 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu
     for (notmuch_config_values_start (add_files_state.new_tags);
 	 notmuch_config_values_valid (add_files_state.new_tags);
 	 notmuch_config_values_move_to_next (add_files_state.new_tags)) {
-	const char *tag,*error_msg;
+	const char *tag, *error_msg;
 
 	tag = notmuch_config_values_get (add_files_state.new_tags);
 	error_msg = illegal_tag (tag, false);
diff --git a/notmuch-restore.c b/notmuch-restore.c
index ce07f89d..d3eea903 100644
--- a/notmuch-restore.c
+++ b/notmuch-restore.c
@@ -360,6 +360,7 @@ notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *n
     }
 
     char *p;
+
     for (p = line; (input_format == DUMP_FORMAT_AUTO) && *p; p++) {
 	if (*p == '(')
 	    input_format = DUMP_FORMAT_SUP;
diff --git a/notmuch-show.c b/notmuch-show.c
index c3c42caa..2c474682 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -80,14 +80,16 @@ _get_disposition (GMimeObject *meta)
     return g_mime_content_disposition_get_disposition (disposition);
 }
 
-static bool _get_message_flag (notmuch_message_t *message, notmuch_message_flag_t flag) {
+static bool
+_get_message_flag (notmuch_message_t *message, notmuch_message_flag_t flag)
+{
     notmuch_bool_t is_set;
     notmuch_status_t status;
 
     status = notmuch_message_get_flag_st (message, flag, &is_set);
 
     if (print_status_message ("notmuch show", message, status))
-	INTERNAL_ERROR("unexpected error getting message flag\n");
+	INTERNAL_ERROR ("unexpected error getting message flag\n");
 
     return is_set;
 }
@@ -438,6 +440,7 @@ format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist)
     }
 
     int i;
+
     for (i = 0; i < g_mime_signature_list_length (siglist); i++) {
 	GMimeSignature *signature = g_mime_signature_list_get_signature (siglist, i);
 
@@ -1157,9 +1160,9 @@ do_show_unthreaded (void *ctx,
 	notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH, TRUE);
 	excluded = _get_message_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED);
 
-	if (!excluded || !params->omit_excluded) {
+	if (! excluded || ! params->omit_excluded) {
 	    status = show_message (ctx, format, sp, message, 0, params);
-	    if (status && !res)
+	    if (status && ! res)
 		res = status;
 	} else {
 	    sp->null (sp);
@@ -1325,6 +1328,7 @@ notmuch_show_command (notmuch_config_t *config, unused(notmuch_database_t *notmu
     }
 
     notmuch_database_mode_t mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
+
     if (params.crypto.decrypt == NOTMUCH_DECRYPT_TRUE)
 	mode = NOTMUCH_DATABASE_MODE_READ_WRITE;
     if (notmuch_database_open_with_config (NULL,
diff --git a/util/string-util.c b/util/string-util.c
index 27f8a26b..9c46a81a 100644
--- a/util/string-util.c
+++ b/util/string-util.c
@@ -53,7 +53,7 @@ strsplit_len (const char *s, char delim, size_t *len)
 	count++;
     }
 
-    if (count==0)
+    if (count == 0)
 	return NULL;
 
     *len = count;
@@ -183,6 +183,7 @@ parse_boolean_term (void *ctx, const char *str,
     /* Parse prefix */
     str = skip_space (str);
     const char *pos = strchr (str, ':');
+
     if (! pos || pos == str)
 	goto FAIL;
     *prefix_out = talloc_strndup (ctx, str, pos - str);
-- 
2.30.1

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

* [PATCH] run uncrustify.
  2021-03-06 17:22 [PATCH] run uncrustify David Bremner
@ 2021-03-07 17:16 ` David Bremner
  0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2021-03-07 17:16 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

This is mainly fixing up style problems that crept in with the first
merged config handling series. It also takes a few other suggestions
from uncrustify as this makes it easier to detect future style
problems.

Break lines for calls to _choose_database_path manually.
---

Add a couple of manual line breaks

 lib/config.cc         | 68 ++++++++++++++++++++++++++-----------------
 lib/database.cc       | 12 ++++----
 lib/notmuch-private.h | 40 ++++++++++++-------------
 lib/notmuch.h         |  4 +--
 lib/open.cc           | 16 +++++-----
 lib/prefix.cc         |  4 +--
 lib/string-map.c      |  6 ++--
 notmuch-client.h      |  2 +-
 notmuch-config.c      |  4 ++-
 notmuch-count.c       | 10 +++----
 notmuch-dump.c        |  4 +--
 notmuch-insert.c      |  2 +-
 notmuch-new.c         |  5 ++--
 notmuch-restore.c     |  1 +
 notmuch-show.c        | 12 +++++---
 util/string-util.c    |  3 +-
 16 files changed, 110 insertions(+), 83 deletions(-)

diff --git a/lib/config.cc b/lib/config.cc
index 6ace6e52..43c5ddec 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -38,7 +38,7 @@ struct _notmuch_config_values {
     void *children; /* talloc_context */
 };
 
-static const char * _notmuch_config_key_to_string (notmuch_config_key_t key);
+static const char *_notmuch_config_key_to_string (notmuch_config_key_t key);
 
 static int
 _notmuch_config_list_destroy (notmuch_config_list_t *list)
@@ -104,7 +104,7 @@ notmuch_database_get_config (notmuch_database_t *notmuch,
 			     const char *key,
 			     char **value)
 {
-    const char* stored_val;
+    const char *stored_val;
     notmuch_status_t status;
 
     if (! notmuch->config) {
@@ -119,7 +119,7 @@ notmuch_database_get_config (notmuch_database_t *notmuch,
     if (! stored_val) {
 	/* XXX in principle this API should be fixed so empty string
 	 * is distinguished from not found */
-	*value = strdup("");
+	*value = strdup ("");
     } else {
 	*value = strdup (stored_val);
     }
@@ -167,7 +167,7 @@ notmuch_database_get_config_list (notmuch_database_t *notmuch,
 	    if (status != NOTMUCH_STATUS_XAPIAN_EXCEPTION)
 		_notmuch_config_list_destroy (list);
 	}
-    }  else {
+    } else {
 	talloc_set_destructor (list, _notmuch_config_list_destroy);
     }
 
@@ -183,7 +183,9 @@ notmuch_config_list_valid (notmuch_config_list_t *metadata)
     return true;
 }
 
-static inline char * _key_from_iterator (notmuch_config_list_t *list) {
+static inline char *
+_key_from_iterator (notmuch_config_list_t *list)
+{
     return talloc_strdup (list, (*list->iterator).c_str () + CONFIG_PREFIX.length ());
 }
 
@@ -239,7 +241,7 @@ _notmuch_config_load_from_database (notmuch_database_t *notmuch)
     if (notmuch->config == NULL)
 	notmuch->config = _notmuch_string_map_create (notmuch);
 
-    if (unlikely(notmuch->config == NULL))
+    if (unlikely (notmuch->config == NULL))
 	return NOTMUCH_STATUS_OUT_OF_MEMORY;
 
     status = notmuch_database_get_config_list (notmuch, "", &list);
@@ -267,7 +269,7 @@ notmuch_config_get_values (notmuch_database_t *notmuch, notmuch_config_key_t key
 	goto DONE;
 
     values = talloc (notmuch, notmuch_config_values_t);
-    if (unlikely(! values))
+    if (unlikely (! values))
 	goto DONE;
 
     values->children = talloc_new (values);
@@ -279,17 +281,18 @@ notmuch_config_get_values (notmuch_database_t *notmuch, notmuch_config_key_t key
     values->iterator = strsplit_len (values->string, ';', &(values->tok_len));
     ok = true;
 
- DONE:
-    if (!ok) {
+  DONE:
+    if (! ok) {
 	if (values)
-	    talloc_free(values);
+	    talloc_free (values);
 	return NULL;
     }
     return values;
 }
 
 notmuch_bool_t
-notmuch_config_values_valid (notmuch_config_values_t *values) {
+notmuch_config_values_valid (notmuch_config_values_t *values)
+{
     if (! values)
 	return false;
 
@@ -297,12 +300,14 @@ notmuch_config_values_valid (notmuch_config_values_t *values) {
 }
 
 const char *
-notmuch_config_values_get (notmuch_config_values_t *values) {
+notmuch_config_values_get (notmuch_config_values_t *values)
+{
     return talloc_strndup (values, values->iterator, values->tok_len);
 }
 
 void
-notmuch_config_values_start (notmuch_config_values_t *values) {
+notmuch_config_values_start (notmuch_config_values_t *values)
+{
     if (values == NULL)
 	return;
     if (values->children) {
@@ -315,13 +320,15 @@ notmuch_config_values_start (notmuch_config_values_t *values) {
 }
 
 void
-notmuch_config_values_move_to_next (notmuch_config_values_t *values) {
+notmuch_config_values_move_to_next (notmuch_config_values_t *values)
+{
     values->iterator += values->tok_len;
     values->iterator = strsplit_len (values->iterator, ';', &(values->tok_len));
 }
 
 void
-notmuch_config_values_destroy (notmuch_config_values_t *values) {
+notmuch_config_values_destroy (notmuch_config_values_t *values)
+{
     talloc_free (values);
 }
 
@@ -335,16 +342,16 @@ _notmuch_config_load_from_file (notmuch_database_t *notmuch,
     if (notmuch->config == NULL)
 	notmuch->config = _notmuch_string_map_create (notmuch);
 
-    if (unlikely(notmuch->config == NULL)) {
+    if (unlikely (notmuch->config == NULL)) {
 	status = NOTMUCH_STATUS_OUT_OF_MEMORY;
 	goto DONE;
     }
 
     groups = g_key_file_get_groups (file, NULL);
-    for (gchar **grp=groups; *grp; grp++) {
+    for (gchar **grp = groups; *grp; grp++) {
 	keys = g_key_file_get_keys (file, *grp, NULL, NULL);
 	for (gchar **keys_p = keys; *keys_p; keys_p++) {
-	    char *absolute_key = talloc_asprintf(notmuch, "%s.%s", *grp,  *keys_p);
+	    char *absolute_key = talloc_asprintf (notmuch, "%s.%s", *grp,  *keys_p);
 	    val = g_key_file_get_value (file, *grp, *keys_p, NULL);
 	    if (! val) {
 		status = NOTMUCH_STATUS_FILE_ERROR;
@@ -359,7 +366,7 @@ _notmuch_config_load_from_file (notmuch_database_t *notmuch,
 	g_strfreev (keys);
     }
 
- DONE:
+  DONE:
     if (groups)
 	g_strfreev (groups);
 
@@ -393,7 +400,8 @@ notmuch_config_get_bool (notmuch_database_t *notmuch, notmuch_config_key_t key,
 }
 
 static const char *
-_notmuch_config_key_to_string (notmuch_config_key_t key) {
+_notmuch_config_key_to_string (notmuch_config_key_t key)
+{
     switch (key) {
     case NOTMUCH_CONFIG_DATABASE_PATH:
 	return "database.path";
@@ -419,7 +427,8 @@ _notmuch_config_key_to_string (notmuch_config_key_t key) {
 }
 
 static const char *
-_notmuch_config_default (void *ctx, notmuch_config_key_t key) {
+_notmuch_config_default (void *ctx, notmuch_config_key_t key)
+{
     char *path;
 
     switch (key) {
@@ -446,15 +455,17 @@ _notmuch_config_default (void *ctx, notmuch_config_key_t key) {
     default:
     case NOTMUCH_CONFIG_LAST:
 	INTERNAL_ERROR ("illegal key enum %d", key);
-   }
+    }
 }
 
 notmuch_status_t
-_notmuch_config_load_defaults (notmuch_database_t *notmuch) {
+_notmuch_config_load_defaults (notmuch_database_t *notmuch)
+{
     notmuch_config_key_t key;
+
     for (key = NOTMUCH_CONFIG_FIRST;
 	 key < NOTMUCH_CONFIG_LAST;
-	 key = notmuch_config_key_t(key + 1)) {
+	 key = notmuch_config_key_t (key + 1)) {
 	const char *val = notmuch_config_get (notmuch, key);
 	const char *key_string = _notmuch_config_key_to_string (key);
 
@@ -467,18 +478,21 @@ _notmuch_config_load_defaults (notmuch_database_t *notmuch) {
 }
 
 const char *
-notmuch_config_get (notmuch_database_t *notmuch, notmuch_config_key_t key) {
+notmuch_config_get (notmuch_database_t *notmuch, notmuch_config_key_t key)
+{
 
     return _notmuch_string_map_get (notmuch->config, _notmuch_config_key_to_string (key));
 }
 
 notmuch_status_t
-notmuch_config_set (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val) {
+notmuch_config_set (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val)
+{
 
     return notmuch_database_set_config (notmuch, _notmuch_config_key_to_string (key), val);
 }
 
 void
-_notmuch_config_cache (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val) {
+_notmuch_config_cache (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val)
+{
     _notmuch_string_map_set (notmuch->config, _notmuch_config_key_to_string (key), val);
 }
diff --git a/lib/database.cc b/lib/database.cc
index f96ba7c0..b4e536b9 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -49,7 +49,8 @@ typedef struct {
 #define LOG_XAPIAN_EXCEPTION(message, error) _log_xapian_exception (__location__, message, error)
 
 static void
-_log_xapian_exception (const char *where, notmuch_database_t *notmuch,  const Xapian::Error error) {
+_log_xapian_exception (const char *where, notmuch_database_t *notmuch,  const Xapian::Error error)
+{
     _notmuch_database_log (notmuch,
 			   "A Xapian exception occurred at %s: %s\n",
 			   where,
@@ -627,10 +628,11 @@ notmuch_status_t
 notmuch_database_compact_db (notmuch_database_t *notmuch,
 			     const char *backup_path,
 			     notmuch_compact_status_cb_t status_cb,
-			     void *closure) {
+			     void *closure)
+{
     void *local;
     char *notmuch_path, *xapian_path, *compact_xapian_path;
-    const char* path;
+    const char *path;
     notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
     struct stat statbuf;
     bool keep_backup;
@@ -840,8 +842,8 @@ handle_sigalrm (unused (int signal))
  */
 notmuch_status_t
 notmuch_database_upgrade (notmuch_database_t *notmuch,
-			  void (*progress_notify) (void *closure,
-						   double progress),
+			  void (*progress_notify)(void *closure,
+						  double progress),
 			  void *closure)
 {
     void *local = talloc_new (NULL);
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 750a242c..e47badbc 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -123,21 +123,21 @@ typedef enum {
 
 typedef enum _notmuch_private_status {
     /* First, copy all the public status values. */
-    NOTMUCH_PRIVATE_STATUS_SUCCESS			= NOTMUCH_STATUS_SUCCESS,
-    NOTMUCH_PRIVATE_STATUS_OUT_OF_MEMORY		= NOTMUCH_STATUS_OUT_OF_MEMORY,
-    NOTMUCH_PRIVATE_STATUS_READ_ONLY_DATABASE		= NOTMUCH_STATUS_READ_ONLY_DATABASE,
-    NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION		= NOTMUCH_STATUS_XAPIAN_EXCEPTION,
-    NOTMUCH_PRIVATE_STATUS_FILE_ERROR			= NOTMUCH_STATUS_FILE_ERROR,
-    NOTMUCH_PRIVATE_STATUS_FILE_NOT_EMAIL		= NOTMUCH_STATUS_FILE_NOT_EMAIL,
-    NOTMUCH_PRIVATE_STATUS_NULL_POINTER			= NOTMUCH_STATUS_NULL_POINTER,
-    NOTMUCH_PRIVATE_STATUS_TAG_TOO_LONG			= NOTMUCH_STATUS_TAG_TOO_LONG,
-    NOTMUCH_PRIVATE_STATUS_UNBALANCED_FREEZE_THAW	= NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW,
-    NOTMUCH_PRIVATE_STATUS_UNBALANCED_ATOMIC		= NOTMUCH_STATUS_UNBALANCED_ATOMIC,
-    NOTMUCH_PRIVATE_STATUS_UNSUPPORTED_OPERATION	= NOTMUCH_STATUS_UNSUPPORTED_OPERATION,
-    NOTMUCH_PRIVATE_STATUS_UPGRADE_REQUIRED		= NOTMUCH_STATUS_UPGRADE_REQUIRED,
-    NOTMUCH_PRIVATE_STATUS_PATH_ERROR			= NOTMUCH_STATUS_PATH_ERROR,
-    NOTMUCH_PRIVATE_STATUS_IGNORED			= NOTMUCH_STATUS_IGNORED,
-    NOTMUCH_PRIVATE_STATUS_ILLEGAL_ARGUMENT		= NOTMUCH_STATUS_ILLEGAL_ARGUMENT,
+    NOTMUCH_PRIVATE_STATUS_SUCCESS				= NOTMUCH_STATUS_SUCCESS,
+    NOTMUCH_PRIVATE_STATUS_OUT_OF_MEMORY			= NOTMUCH_STATUS_OUT_OF_MEMORY,
+    NOTMUCH_PRIVATE_STATUS_READ_ONLY_DATABASE			= NOTMUCH_STATUS_READ_ONLY_DATABASE,
+    NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION			= NOTMUCH_STATUS_XAPIAN_EXCEPTION,
+    NOTMUCH_PRIVATE_STATUS_FILE_ERROR				= NOTMUCH_STATUS_FILE_ERROR,
+    NOTMUCH_PRIVATE_STATUS_FILE_NOT_EMAIL			= NOTMUCH_STATUS_FILE_NOT_EMAIL,
+    NOTMUCH_PRIVATE_STATUS_NULL_POINTER				= NOTMUCH_STATUS_NULL_POINTER,
+    NOTMUCH_PRIVATE_STATUS_TAG_TOO_LONG				= NOTMUCH_STATUS_TAG_TOO_LONG,
+    NOTMUCH_PRIVATE_STATUS_UNBALANCED_FREEZE_THAW		= NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW,
+    NOTMUCH_PRIVATE_STATUS_UNBALANCED_ATOMIC			= NOTMUCH_STATUS_UNBALANCED_ATOMIC,
+    NOTMUCH_PRIVATE_STATUS_UNSUPPORTED_OPERATION		= NOTMUCH_STATUS_UNSUPPORTED_OPERATION,
+    NOTMUCH_PRIVATE_STATUS_UPGRADE_REQUIRED			= NOTMUCH_STATUS_UPGRADE_REQUIRED,
+    NOTMUCH_PRIVATE_STATUS_PATH_ERROR				= NOTMUCH_STATUS_PATH_ERROR,
+    NOTMUCH_PRIVATE_STATUS_IGNORED				= NOTMUCH_STATUS_IGNORED,
+    NOTMUCH_PRIVATE_STATUS_ILLEGAL_ARGUMENT			= NOTMUCH_STATUS_ILLEGAL_ARGUMENT,
     NOTMUCH_PRIVATE_STATUS_MALFORMED_CRYPTO_PROTOCOL		= NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL,
     NOTMUCH_PRIVATE_STATUS_FAILED_CRYPTO_CONTEXT_CREATION	= NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION,
     NOTMUCH_PRIVATE_STATUS_UNKNOWN_CRYPTO_PROTOCOL		= NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL,
@@ -145,7 +145,7 @@ typedef enum _notmuch_private_status {
     NOTMUCH_PRIVATE_STATUS_DATABASE_EXISTS			= NOTMUCH_STATUS_DATABASE_EXISTS,
 
     /* Then add our own private values. */
-    NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG		= NOTMUCH_STATUS_LAST_STATUS,
+    NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG			= NOTMUCH_STATUS_LAST_STATUS,
     NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND,
     NOTMUCH_PRIVATE_STATUS_BAD_PREFIX,
 
@@ -716,16 +716,16 @@ struct _notmuch_indexopts {
 
 /* config.cc */
 notmuch_status_t
-_notmuch_config_load_from_database (notmuch_database_t * db);
+_notmuch_config_load_from_database (notmuch_database_t *db);
 
 notmuch_status_t
-_notmuch_config_load_from_file (notmuch_database_t * db, GKeyFile *file);
+_notmuch_config_load_from_file (notmuch_database_t *db, GKeyFile *file);
 
 notmuch_status_t
-_notmuch_config_load_defaults (notmuch_database_t * db);
+_notmuch_config_load_defaults (notmuch_database_t *db);
 
 void
-_notmuch_config_cache (notmuch_database_t *db, notmuch_config_key_t key, const char* val);
+_notmuch_config_cache (notmuch_database_t *db, notmuch_config_key_t key, const char *val);
 
 NOTMUCH_END_DECLS
 
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 5a5d99c0..70f4f517 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -1631,7 +1631,7 @@ typedef enum _notmuch_message_flag {
  * @deprecated Deprecated as of libnotmuch 5.3 (notmuch 0.31). Please
  * use notmuch_message_get_flag_st instead.
  */
-NOTMUCH_DEPRECATED(5,3)
+NOTMUCH_DEPRECATED (5, 3)
 notmuch_bool_t
 notmuch_message_get_flag (notmuch_message_t *message,
 			  notmuch_message_flag_t flag);
@@ -1826,7 +1826,7 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message);
  * @returns FALSE in case of error
  * @deprecated libnotmuch 5.3 (notmuch 0.31)
  */
-NOTMUCH_DEPRECATED(5, 3)
+NOTMUCH_DEPRECATED (5, 3)
 notmuch_bool_t
 notmuch_message_has_maildir_flag (notmuch_message_t *message, char flag);
 
diff --git a/lib/open.cc b/lib/open.cc
index a5211746..5336a93f 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -85,7 +85,7 @@ _choose_hook_dir (notmuch_database_t *notmuch,
 
     config = _xdg_dir (notmuch, "XDG_CONFIG_HOME", ".config", profile);
     if (! config)
-	return  NOTMUCH_STATUS_PATH_ERROR;
+	return NOTMUCH_STATUS_PATH_ERROR;
 
     hook_dir = talloc_asprintf (notmuch, "%s/hooks", config);
 
@@ -125,7 +125,7 @@ _load_key_file (const char *path,
 
 	if (dir) {
 	    path = talloc_asprintf (local, "%s/config", dir);
-	    if (access (path, R_OK) !=0)
+	    if (access (path, R_OK) != 0)
 		path = NULL;
 	}
     }
@@ -147,7 +147,7 @@ _load_key_file (const char *path,
 	status = NOTMUCH_STATUS_NO_CONFIG;
     }
 
-DONE:
+  DONE:
     talloc_free (local);
     return status;
 }
@@ -162,14 +162,14 @@ _choose_database_path (void *ctx,
 {
     notmuch_status_t status;
 
-    status =_load_key_file (config_path, profile, key_file);
+    status = _load_key_file (config_path, profile, key_file);
     if (status) {
 	*message = strdup ("Error: cannot load config file.\n");
 	return status;
     }
 
     if (! *database_path && *key_file) {
-	char *path  = g_key_file_get_value (*key_file, "database", "path", NULL);
+	char *path = g_key_file_get_value (*key_file, "database", "path", NULL);
 	if (path) {
 	    *database_path = talloc_strdup (ctx, path);
 	    g_free (path);
@@ -207,7 +207,8 @@ notmuch_database_open_with_config (const char *database_path,
     GKeyFile *key_file = NULL;
     static int initialized = 0;
 
-    if ((status = _choose_database_path (local, config_path, profile, &key_file, &database_path, &message)))
+    if ((status = _choose_database_path (local, config_path, profile,
+					 &key_file, &database_path, &message)))
 	goto DONE;
 
     if (! (notmuch_path = talloc_asprintf (local, "%s/%s", database_path, ".notmuch"))) {
@@ -434,7 +435,8 @@ notmuch_database_create_with_config (const char *database_path,
     int err;
     void *local = talloc_new (NULL);
 
-    if ((status = _choose_database_path (local, config_path, profile, &key_file, &database_path, &message)))
+    if ((status = _choose_database_path (local, config_path, profile,
+					 &key_file, &database_path, &message)))
 	goto DONE;
 
     err = stat (database_path, &st);
diff --git a/lib/prefix.cc b/lib/prefix.cc
index 71a76991..0d92bdd7 100644
--- a/lib/prefix.cc
+++ b/lib/prefix.cc
@@ -133,8 +133,8 @@ _setup_query_field (const prefix_t *prefix, notmuch_database_t *notmuch)
 	Xapian::FieldProcessor *fp;
 
 	if (STRNCMP_LITERAL (prefix->name, "date") == 0)
-	    fp = (new DateFieldProcessor(NOTMUCH_VALUE_TIMESTAMP))->release ();
-	else if (STRNCMP_LITERAL(prefix->name, "query") == 0)
+	    fp = (new DateFieldProcessor (NOTMUCH_VALUE_TIMESTAMP))->release ();
+	else if (STRNCMP_LITERAL (prefix->name, "query") == 0)
 	    fp = (new QueryFieldProcessor (*notmuch->query_parser, notmuch))->release ();
 	else if (STRNCMP_LITERAL (prefix->name, "thread") == 0)
 	    fp = (new ThreadFieldProcessor (*notmuch->query_parser, notmuch))->release ();
diff --git a/lib/string-map.c b/lib/string-map.c
index 71eac634..e3a81b4f 100644
--- a/lib/string-map.c
+++ b/lib/string-map.c
@@ -154,10 +154,10 @@ _notmuch_string_map_set (notmuch_string_map_t *map,
     _notmuch_string_map_sort (map);
     pair = bsearch_first (map->pairs, map->length, key, true);
     if (! pair)
-       _notmuch_string_map_append (map, key, val);
+	_notmuch_string_map_append (map, key, val);
     else {
-       talloc_free (pair->value);
-       pair->value = talloc_strdup (map->pairs, val);
+	talloc_free (pair->value);
+	pair->value = talloc_strdup (map->pairs, val);
     }
 }
 
diff --git a/notmuch-client.h b/notmuch-client.h
index f60f5406..354a115e 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -505,7 +505,7 @@ print_status_gzbytes (const char *loc,
 /* the __location__ macro is defined in talloc.h */
 #define ASSERT_GZBYTES(file, bytes) ((print_status_gzbytes (__location__, file, bytes)) ? exit (1) : 0)
 #define GZPRINTF(file, fmt, ...) ASSERT_GZBYTES (file, gzprintf (file, fmt, ##__VA_ARGS__));
-#define GZPUTS(file, str) ASSERT_GZBYTES(file, gzputs (file, str));
+#define GZPUTS(file, str) ASSERT_GZBYTES (file, gzputs (file, str));
 
 #include "command-line-arguments.h"
 
diff --git a/notmuch-config.c b/notmuch-config.c
index 0193401f..1a865681 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -510,7 +510,9 @@ notmuch_config_close (notmuch_config_t *config)
     talloc_free (config);
 }
 
-const char *_notmuch_config_get_path (notmuch_config_t *config) {
+const char *
+_notmuch_config_get_path (notmuch_config_t *config)
+{
     return config->filename;
 }
 /* Save any changes made to the notmuch configuration.
diff --git a/notmuch-count.c b/notmuch-count.c
index 048b1f44..8cedc18e 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -86,12 +86,12 @@ print_count (notmuch_database_t *notmuch, const char *query_str,
 
 	status = notmuch_query_add_tag_exclude (query,
 						notmuch_config_values_get (exclude_tags));
-	    if (status && status != NOTMUCH_STATUS_IGNORED) {
-		print_status_query ("notmuch count", query, status);
-		ret = -1;
-		goto DONE;
-	    }
+	if (status && status != NOTMUCH_STATUS_IGNORED) {
+	    print_status_query ("notmuch count", query, status);
+	    ret = -1;
+	    goto DONE;
 	}
+    }
 
     switch (output) {
     case OUTPUT_MESSAGES:
diff --git a/notmuch-dump.c b/notmuch-dump.c
index d7017929..9da39ac4 100644
--- a/notmuch-dump.c
+++ b/notmuch-dump.c
@@ -339,7 +339,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 	output = NULL;
 	goto DONE;
     } else
-        output = NULL;
+	output = NULL;
 
     if (output_file_name) {
 	ret = rename (tempname, output_file_name);
@@ -361,7 +361,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 }
 
 int
-notmuch_dump_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch , int argc, char *argv[])
+notmuch_dump_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
 {
     const char *query_str = NULL;
     int ret;
diff --git a/notmuch-insert.c b/notmuch-insert.c
index 0f272e2e..00505552 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -444,7 +444,7 @@ add_file (notmuch_database_t *notmuch, const char *path, tag_op_list_t *tag_ops,
 }
 
 int
-notmuch_insert_command (unused(notmuch_config_t *config),notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_insert_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
 {
     notmuch_status_t status, close_status;
     struct sigaction action;
diff --git a/notmuch-new.c b/notmuch-new.c
index 21e66af1..e0590a57 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -1043,7 +1043,8 @@ print_results (const add_files_state_t *state)
 }
 
 static int
-_maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state) {
+_maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state)
+{
     if (notmuch_database_needs_upgrade (notmuch)) {
 	time_t now = time (NULL);
 	struct tm *gm_time = gmtime (&now);
@@ -1155,7 +1156,7 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu
     for (notmuch_config_values_start (add_files_state.new_tags);
 	 notmuch_config_values_valid (add_files_state.new_tags);
 	 notmuch_config_values_move_to_next (add_files_state.new_tags)) {
-	const char *tag,*error_msg;
+	const char *tag, *error_msg;
 
 	tag = notmuch_config_values_get (add_files_state.new_tags);
 	error_msg = illegal_tag (tag, false);
diff --git a/notmuch-restore.c b/notmuch-restore.c
index ce07f89d..d3eea903 100644
--- a/notmuch-restore.c
+++ b/notmuch-restore.c
@@ -360,6 +360,7 @@ notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *n
     }
 
     char *p;
+
     for (p = line; (input_format == DUMP_FORMAT_AUTO) && *p; p++) {
 	if (*p == '(')
 	    input_format = DUMP_FORMAT_SUP;
diff --git a/notmuch-show.c b/notmuch-show.c
index c3c42caa..2c474682 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -80,14 +80,16 @@ _get_disposition (GMimeObject *meta)
     return g_mime_content_disposition_get_disposition (disposition);
 }
 
-static bool _get_message_flag (notmuch_message_t *message, notmuch_message_flag_t flag) {
+static bool
+_get_message_flag (notmuch_message_t *message, notmuch_message_flag_t flag)
+{
     notmuch_bool_t is_set;
     notmuch_status_t status;
 
     status = notmuch_message_get_flag_st (message, flag, &is_set);
 
     if (print_status_message ("notmuch show", message, status))
-	INTERNAL_ERROR("unexpected error getting message flag\n");
+	INTERNAL_ERROR ("unexpected error getting message flag\n");
 
     return is_set;
 }
@@ -438,6 +440,7 @@ format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist)
     }
 
     int i;
+
     for (i = 0; i < g_mime_signature_list_length (siglist); i++) {
 	GMimeSignature *signature = g_mime_signature_list_get_signature (siglist, i);
 
@@ -1157,9 +1160,9 @@ do_show_unthreaded (void *ctx,
 	notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH, TRUE);
 	excluded = _get_message_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED);
 
-	if (!excluded || !params->omit_excluded) {
+	if (! excluded || ! params->omit_excluded) {
 	    status = show_message (ctx, format, sp, message, 0, params);
-	    if (status && !res)
+	    if (status && ! res)
 		res = status;
 	} else {
 	    sp->null (sp);
@@ -1325,6 +1328,7 @@ notmuch_show_command (notmuch_config_t *config, unused(notmuch_database_t *notmu
     }
 
     notmuch_database_mode_t mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
+
     if (params.crypto.decrypt == NOTMUCH_DECRYPT_TRUE)
 	mode = NOTMUCH_DATABASE_MODE_READ_WRITE;
     if (notmuch_database_open_with_config (NULL,
diff --git a/util/string-util.c b/util/string-util.c
index 27f8a26b..9c46a81a 100644
--- a/util/string-util.c
+++ b/util/string-util.c
@@ -53,7 +53,7 @@ strsplit_len (const char *s, char delim, size_t *len)
 	count++;
     }
 
-    if (count==0)
+    if (count == 0)
 	return NULL;
 
     *len = count;
@@ -183,6 +183,7 @@ parse_boolean_term (void *ctx, const char *str,
     /* Parse prefix */
     str = skip_space (str);
     const char *pos = strchr (str, ':');
+
     if (! pos || pos == str)
 	goto FAIL;
     *prefix_out = talloc_strndup (ctx, str, pos - str);
-- 
2.30.1

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

end of thread, other threads:[~2021-03-07 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-06 17:22 [PATCH] run uncrustify David Bremner
2021-03-07 17:16 ` David Bremner

unofficial mirror of notmuch@notmuchmail.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/notmuch/0 notmuch/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 notmuch notmuch/ https://yhetil.org/notmuch \
		notmuch@notmuchmail.org
	public-inbox-index notmuch

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.mail.notmuch.general
	nntp://news.gmane.io/gmane.mail.notmuch.general


code repositories for project(s) associated with this inbox:

	notmuch.git.git (no URL configured)

AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git