unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* uncrustify all the things
@ 2021-03-12 12:09 David Bremner
  2021-03-12 12:09 ` [PATCH 1/4] lib: run uncrustify David Bremner
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: David Bremner @ 2021-03-12 12:09 UTC (permalink / raw)
  To: notmuch

This replaces and expands id:20210307171658.1084026-1-david@tethera.net

There has been some style drift in the intervening ~ 2 years since we
last did these. The addition of a line length limit also triggers some
changes.

compat and parse-date-time are unchanged since the last uncrustify run.

I did ignore a couple of suggestions from uncrustify. One is aligning

foo->bar->
   flub->gub

as

foo->bar->
flub->gub


The other is line breaks in the table of status-codes in
lib/notmuch-private.h. I'm not sure the best approach to the latter.

I'll probabably apply these relatively quickly to minimimize the
amount of pain for people (like me) rebasing patch series against
master.


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

* [PATCH 1/4] lib: run uncrustify
  2021-03-12 12:09 uncrustify all the things David Bremner
@ 2021-03-12 12:09 ` David Bremner
  2021-03-12 12:09 ` [PATCH 2/4] util: " David Bremner
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2021-03-12 12:09 UTC (permalink / raw)
  To: notmuch; +Cc: uncrustify

From: uncrustify <david@tethera.net>

This is the result of running

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

in the lib directory
---
 lib/config.cc           | 72 +++++++++++++++++++++++++----------------
 lib/database.cc         | 24 ++++++++------
 lib/directory.cc        |  4 ++-
 lib/features.cc         |  2 +-
 lib/index.cc            | 28 ++++++++++------
 lib/indexopts.c         |  1 +
 lib/message-file.c      |  5 +--
 lib/message-property.cc |  2 ++
 lib/message.cc          | 21 +++++++-----
 lib/notmuch-private.h   |  8 ++---
 lib/notmuch.h           |  7 ++--
 lib/open.cc             | 14 ++++----
 lib/parse-time-vrp.cc   |  4 +--
 lib/prefix.cc           |  4 +--
 lib/string-map.c        |  6 ++--
 lib/thread-fp.cc        |  6 ++--
 lib/thread.cc           |  3 +-
 17 files changed, 130 insertions(+), 81 deletions(-)

diff --git a/lib/config.cc b/lib/config.cc
index 948751bc..e6b660a9 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);
     }
@@ -152,7 +152,8 @@ notmuch_database_get_config_list (notmuch_database_t *notmuch,
 	talloc_set_destructor (list, _notmuch_config_list_destroy);
 
     } catch (const Xapian::Error &error) {
-	_notmuch_database_log (notmuch, "A Xapian exception occurred getting metadata iterator: %s.\n",
+	_notmuch_database_log (notmuch,
+			       "A Xapian exception occurred getting metadata iterator: %s.\n",
 			       error.get_msg ().c_str ());
 	notmuch->exception_reported = true;
 	status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
@@ -167,7 +168,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 +184,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 +242,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 +270,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 +282,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 +301,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 +321,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,14 +343,14 @@ _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;
     }
 
     for (groups = g_key_file_get_groups (file, NULL); *groups; groups++) {
 	for (keys = g_key_file_get_keys (file, *groups, NULL, NULL); *keys; keys++) {
-	    char *absolute_key = talloc_asprintf(notmuch, "%s.%s", *groups,  *keys);
+	    char *absolute_key = talloc_asprintf (notmuch, "%s.%s", *groups,  *keys);
 	    val = g_key_file_get_value (file, *groups, *keys, NULL);
 	    if (! val) {
 		status = NOTMUCH_STATUS_FILE_ERROR;
@@ -355,7 +363,7 @@ _notmuch_config_load_from_file (notmuch_database_t *notmuch,
 	}
     }
 
- DONE:
+  DONE:
     return status;
 }
 
@@ -386,7 +394,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";
@@ -412,7 +421,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) {
@@ -439,39 +449,45 @@ _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);
 
 	val = _notmuch_string_map_get (notmuch->config, key_string);
 	if (! val) {
-	    _notmuch_string_map_set (notmuch->config, key_string, _notmuch_config_default (notmuch, key));
+	    _notmuch_string_map_set (notmuch->config, key_string, _notmuch_config_default (notmuch,
+											   key));
 	}
     }
     return NOTMUCH_STATUS_SUCCESS;
 }
 
 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..f27616da 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,
@@ -506,7 +507,8 @@ notmuch_database_close (notmuch_database_t *notmuch)
 	} catch (const Xapian::Error &error) {
 	    status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
 	    if (! notmuch->exception_reported) {
-		_notmuch_database_log (notmuch, "Error: A Xapian exception occurred closing database: %s\n",
+		_notmuch_database_log (notmuch,
+				       "Error: A Xapian exception occurred closing database: %s\n",
 				       error.get_msg ().c_str ());
 	    }
 	}
@@ -627,10 +629,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;
@@ -692,7 +695,8 @@ notmuch_database_compact_db (notmuch_database_t *notmuch,
 
     try {
 	NotmuchCompactor compactor (status_cb, closure);
-	notmuch->xapian_db->compact (compact_xapian_path, Xapian::DBCOMPACT_NO_RENUMBER, 0, compactor);
+	notmuch->xapian_db->compact (compact_xapian_path, Xapian::DBCOMPACT_NO_RENUMBER, 0,
+				     compactor);
     } catch (const Xapian::Error &error) {
 	_notmuch_database_log (notmuch, "Error while compacting: %s\n", error.get_msg ().c_str ());
 	ret = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
@@ -840,8 +844,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);
@@ -1065,7 +1069,8 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
 	    if (private_status) {
 		_notmuch_database_log (notmuch,
 				       "Upgrade failed while creating ghost messages.\n");
-		status = COERCE_STATUS (private_status, "Unexpected status from _notmuch_message_initialize_ghost");
+		status = COERCE_STATUS (private_status,
+					"Unexpected status from _notmuch_message_initialize_ghost");
 		goto DONE;
 	    }
 
@@ -1498,7 +1503,8 @@ notmuch_database_find_message_by_filename (notmuch_database_t *notmuch,
 		status = NOTMUCH_STATUS_OUT_OF_MEMORY;
 	}
     } catch (const Xapian::Error &error) {
-	_notmuch_database_log (notmuch, "Error: A Xapian exception occurred finding message by filename: %s\n",
+	_notmuch_database_log (notmuch,
+			       "Error: A Xapian exception occurred finding message by filename: %s\n",
 			       error.get_msg ().c_str ());
 	notmuch->exception_reported = true;
 	status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
diff --git a/lib/directory.cc b/lib/directory.cc
index eee8254e..5cf64d7f 100644
--- a/lib/directory.cc
+++ b/lib/directory.cc
@@ -52,8 +52,10 @@ struct _notmuch_directory {
 #define LOG_XAPIAN_EXCEPTION(directory, error) _log_xapian_exception (__location__, directory, error)
 
 static void
-_log_xapian_exception (const char *where, notmuch_directory_t *dir,  const Xapian::Error error) {
+_log_xapian_exception (const char *where, notmuch_directory_t *dir,  const Xapian::Error error)
+{
     notmuch_database_t *notmuch = dir->notmuch;
+
     _notmuch_database_log (notmuch,
 			   "A Xapian exception occurred at %s: %s\n",
 			   where,
diff --git a/lib/features.cc b/lib/features.cc
index 8def2461..cf0196c8 100644
--- a/lib/features.cc
+++ b/lib/features.cc
@@ -64,7 +64,7 @@ _notmuch_database_print_features (const void *ctx, unsigned int features)
  */
 _notmuch_features
 _notmuch_database_parse_features (const void *ctx, const char *features, unsigned int version,
-		 char mode, char **incompat_out)
+				  char mode, char **incompat_out)
 {
     _notmuch_features res = static_cast<_notmuch_features>(0);
     unsigned int namelen, i;
diff --git a/lib/index.cc b/lib/index.cc
index 826aa341..55c8372e 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -260,7 +260,8 @@ notmuch_filter_discard_non_term_new (GMimeContentType *content_type)
 	    .value_table = NULL,
 	};
 
-	type = g_type_register_static (GMIME_TYPE_FILTER, "NotmuchFilterDiscardNonTerm", &info, (GTypeFlags) 0);
+	type = g_type_register_static (GMIME_TYPE_FILTER, "NotmuchFilterDiscardNonTerm", &info,
+				       (GTypeFlags) 0);
     }
 
     filter = (NotmuchFilterDiscardNonTerm *) g_object_new (type, NULL);
@@ -455,7 +456,8 @@ _index_mime_part (notmuch_message_t *message,
 		msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL) {
 		toindex = _notmuch_repair_crypto_payload_skip_legacy_display (child);
 		if (toindex != child)
-		    notmuch_message_add_property (message, "index.repaired", "skip-protected-headers-legacy-display");
+		    notmuch_message_add_property (message, "index.repaired",
+						  "skip-protected-headers-legacy-display");
 	    }
 	    _index_mime_part (message, indexopts, toindex, msg_crypto);
 	}
@@ -467,7 +469,8 @@ _index_mime_part (notmuch_message_t *message,
 
 	mime_message = g_mime_message_part_get_message (GMIME_MESSAGE_PART (part));
 
-	_index_mime_part (message, indexopts, g_mime_message_get_mime_part (mime_message), msg_crypto);
+	_index_mime_part (message, indexopts, g_mime_message_get_mime_part (mime_message),
+			  msg_crypto);
 
 	goto DONE;
     }
@@ -567,6 +570,7 @@ _index_encrypted_mime_part (notmuch_message_t *message,
     bool attempted = false;
     GMimeDecryptResult *decrypt_result = NULL;
     bool get_sk = (notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
+
     clear = _notmuch_crypto_decrypt (&attempted, notmuch_indexopts_get_decrypt_policy (indexopts),
 				     message, encrypted_data, get_sk ? &decrypt_result : NULL, &err);
     if (! attempted)
@@ -595,7 +599,8 @@ _index_encrypted_mime_part (notmuch_message_t *message,
 					  notmuch_status_to_string (status));
 	if (get_sk) {
 	    status = notmuch_message_add_property (message, "session-key",
-						   g_mime_decrypt_result_get_session_key (decrypt_result));
+						   g_mime_decrypt_result_get_session_key (
+						       decrypt_result));
 	    if (status)
 		_notmuch_database_log (notmuch, "failed to add session-key "
 				       "property (%d)\n", status);
@@ -603,11 +608,14 @@ _index_encrypted_mime_part (notmuch_message_t *message,
 	g_object_unref (decrypt_result);
     }
     GMimeObject *toindex = clear;
-    if (_notmuch_message_crypto_potential_payload (msg_crypto, clear, encrypted_data, GMIME_MULTIPART_ENCRYPTED_CONTENT) &&
+
+    if (_notmuch_message_crypto_potential_payload (msg_crypto, clear, encrypted_data,
+						   GMIME_MULTIPART_ENCRYPTED_CONTENT) &&
 	msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL) {
 	toindex = _notmuch_repair_crypto_payload_skip_legacy_display (clear);
 	if (toindex != clear)
-	    notmuch_message_add_property (message, "index.repaired", "skip-protected-headers-legacy-display");
+	    notmuch_message_add_property (message, "index.repaired",
+					  "skip-protected-headers-legacy-display");
     }
     _index_mime_part (message, indexopts, toindex, msg_crypto);
     g_object_unref (clear);
@@ -640,7 +648,8 @@ _index_pkcs7_part (notmuch_message_t *message,
     if (p7type == GMIME_SECURE_MIME_TYPE_SIGNED_DATA) {
 	sigs = g_mime_application_pkcs7_mime_verify (pkcs7, GMIME_VERIFY_NONE, &mimeobj, &err);
 	if (sigs == NULL) {
-	    _notmuch_database_log (notmuch, "Failed to verify PKCS#7 SignedData during indexing. (%d:%d) [%s]\n",
+	    _notmuch_database_log (notmuch,
+				   "Failed to verify PKCS#7 SignedData during indexing. (%d:%d) [%s]\n",
 				   err->domain, err->code, err->message);
 	    g_error_free (err);
 	    goto DONE;
@@ -651,7 +660,8 @@ _index_pkcs7_part (notmuch_message_t *message,
 	    msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL) {
 	    toindex = _notmuch_repair_crypto_payload_skip_legacy_display (mimeobj);
 	    if (toindex != mimeobj)
-		notmuch_message_add_property (message, "index.repaired", "skip-protected-headers-legacy-display");
+		notmuch_message_add_property (message, "index.repaired",
+					      "skip-protected-headers-legacy-display");
 	}
 	_index_mime_part (message, indexopts, toindex, msg_crypto);
     } else if (p7type == GMIME_SECURE_MIME_TYPE_ENVELOPED_DATA) {
@@ -663,7 +673,7 @@ _index_pkcs7_part (notmuch_message_t *message,
 	_notmuch_database_log (notmuch, "Cannot currently handle PKCS#7 smime-type '%s'\n",
 			       g_mime_object_get_content_type_parameter (part, "smime-type"));
     }
- DONE:
+  DONE:
     if (mimeobj)
 	g_object_unref (mimeobj);
     if (sigs)
diff --git a/lib/indexopts.c b/lib/indexopts.c
index 82a0026f..4a860858 100644
--- a/lib/indexopts.c
+++ b/lib/indexopts.c
@@ -31,6 +31,7 @@ notmuch_database_get_default_indexopts (notmuch_database_t *db)
 
     char *decrypt_policy;
     notmuch_status_t err = notmuch_database_get_config (db, "index.decrypt", &decrypt_policy);
+
     if (err)
 	return NULL;
 
diff --git a/lib/message-file.c b/lib/message-file.c
index 311bd478..15b0bfad 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -65,11 +65,12 @@ _notmuch_message_file_open_ctx (notmuch_database_t *notmuch,
 	return NULL;
 
     const char *prefix = notmuch_database_get_path (notmuch);
+
     if (prefix == NULL)
 	goto FAIL;
 
     if (*filename == '/') {
-	if (strncmp (filename, prefix, strlen(prefix)) != 0) {
+	if (strncmp (filename, prefix, strlen (prefix)) != 0) {
 	    _notmuch_database_log (notmuch, "Error opening %s: path outside mail root\n",
 				   filename);
 	    errno = 0;
@@ -77,7 +78,7 @@ _notmuch_message_file_open_ctx (notmuch_database_t *notmuch,
 	}
 	message->filename = talloc_strdup (message, filename);
     } else {
-	message->filename = talloc_asprintf(message, "%s/%s", prefix, filename);
+	message->filename = talloc_asprintf (message, "%s/%s", prefix, filename);
     }
 
     if (message->filename == NULL)
diff --git a/lib/message-property.cc b/lib/message-property.cc
index ecf7e140..d5afa30c 100644
--- a/lib/message-property.cc
+++ b/lib/message-property.cc
@@ -43,11 +43,13 @@ notmuch_message_count_properties (notmuch_message_t *message, const char *key, u
 	return NOTMUCH_STATUS_NULL_POINTER;
 
     notmuch_string_map_t *map;
+
     map = _notmuch_message_property_map (message);
     if (! map)
 	return NOTMUCH_STATUS_NULL_POINTER;
 
     notmuch_string_map_iterator_t *matcher = _notmuch_string_map_iterator_create (map, key, true);
+
     if (! matcher)
 	return NOTMUCH_STATUS_OUT_OF_MEMORY;
 
diff --git a/lib/message.cc b/lib/message.cc
index fca99082..dc4b47dc 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -93,8 +93,10 @@ _notmuch_message_destructor (notmuch_message_t *message)
 #define LOG_XAPIAN_EXCEPTION(message, error) _log_xapian_exception (__location__, message, error)
 
 static void
-_log_xapian_exception (const char *where, notmuch_message_t *message,  const Xapian::Error error) {
+_log_xapian_exception (const char *where, notmuch_message_t *message,  const Xapian::Error error)
+{
     notmuch_database_t *notmuch = notmuch_message_get_database (message);
+
     _notmuch_database_log (notmuch,
 			   "A Xapian exception occurred at %s: %s\n",
 			   where,
@@ -286,7 +288,8 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch,
 
 	doc_id = _notmuch_database_generate_doc_id (notmuch);
     } catch (const Xapian::Error &error) {
-	_notmuch_database_log (notmuch_message_get_database (message), "A Xapian exception occurred creating message: %s\n",
+	_notmuch_database_log (notmuch_message_get_database (message),
+			       "A Xapian exception occurred creating message: %s\n",
 			       error.get_msg ().c_str ());
 	notmuch->exception_reported = true;
 	*status_ret = NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION;
@@ -318,6 +321,7 @@ _notmuch_message_get_term (notmuch_message_t *message,
 	return NULL;
 
     const std::string &term = *i;
+
     if (strncmp (term.c_str (), prefix, prefix_len))
 	return NULL;
 
@@ -1765,6 +1769,7 @@ notmuch_message_has_maildir_flag (notmuch_message_t *message, char flag)
 {
     notmuch_status_t status;
     notmuch_bool_t ret;
+
     status = notmuch_message_has_maildir_flag_st (message, flag, &ret);
     if (status)
 	return FALSE;
@@ -1778,14 +1783,14 @@ notmuch_message_has_maildir_flag_st (notmuch_message_t *message,
 				     notmuch_bool_t *is_set)
 {
     notmuch_status_t status;
-    
+
     if (! is_set)
 	return NOTMUCH_STATUS_NULL_POINTER;
 
     status = _ensure_maildir_flags (message, false);
     if (status)
 	return status;
-    
+
     *is_set =  message->maildir_flags && (strchr (message->maildir_flags, flag) != NULL);
     return NOTMUCH_STATUS_SUCCESS;
 }
@@ -2079,8 +2084,8 @@ notmuch_message_remove_all_tags (notmuch_message_t *message)
 	private_status = _notmuch_message_remove_term (message, "tag", tag);
 	if (private_status) {
 	    return COERCE_STATUS (private_status,
-				   "_notmuch_message_remove_term return unexpected value: %d\n",
-				   private_status);
+				  "_notmuch_message_remove_term return unexpected value: %d\n",
+				  private_status);
 	}
     }
 
@@ -2202,8 +2207,8 @@ notmuch_message_reindex (notmuch_message_t *message,
     orig_thread_id = notmuch_message_get_thread_id (message);
     if (! orig_thread_id) {
 	/* the following is correct as long as there is only one reason
-	   n_m_get_thread_id returns NULL
-	*/
+	 * n_m_get_thread_id returns NULL
+	 */
 	return NOTMUCH_STATUS_XAPIAN_EXCEPTION;
     }
 
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 750a242c..3c52cfc2 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -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..58c568d5 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);
 
@@ -2403,7 +2403,8 @@ notmuch_database_get_config (notmuch_database_t *db, const char *key, char **val
  * @since libnotmuch 4.4 (notmuch 0.23)
  */
 notmuch_status_t
-notmuch_database_get_config_list (notmuch_database_t *db, const char *prefix, notmuch_config_list_t **out);
+notmuch_database_get_config_list (notmuch_database_t *db, const char *prefix,
+				  notmuch_config_list_t **out);
 
 /**
  * Is 'config_list' iterator valid (i.e. _key, _value, _move_to_next can be called).
diff --git a/lib/open.cc b/lib/open.cc
index 3b86065b..6b717c1c 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;
 }
@@ -161,7 +161,7 @@ _choose_database_path (const char *config_path,
 {
     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;
@@ -319,8 +319,10 @@ notmuch_database_open_with_config (const char *database_path,
 	notmuch->term_gen = new Xapian::TermGenerator;
 	notmuch->term_gen->set_stemmer (Xapian::Stem ("english"));
 	notmuch->value_range_processor = new Xapian::NumberRangeProcessor (NOTMUCH_VALUE_TIMESTAMP);
-	notmuch->date_range_processor = new ParseTimeRangeProcessor (NOTMUCH_VALUE_TIMESTAMP, "date:");
-	notmuch->last_mod_range_processor = new Xapian::NumberRangeProcessor (NOTMUCH_VALUE_LAST_MOD, "lastmod:");
+	notmuch->date_range_processor = new ParseTimeRangeProcessor (NOTMUCH_VALUE_TIMESTAMP,
+								     "date:");
+	notmuch->last_mod_range_processor = new Xapian::NumberRangeProcessor (NOTMUCH_VALUE_LAST_MOD,
+									      "lastmod:");
 	notmuch->query_parser->set_default_op (Xapian::Query::OP_AND);
 	notmuch->query_parser->set_database (*notmuch->xapian_db);
 	notmuch->query_parser->set_stemmer (Xapian::Stem ("english"));
diff --git a/lib/parse-time-vrp.cc b/lib/parse-time-vrp.cc
index 10809aa3..22bf2ab5 100644
--- a/lib/parse-time-vrp.cc
+++ b/lib/parse-time-vrp.cc
@@ -35,14 +35,14 @@ ParseTimeRangeProcessor::operator() (const std::string &begin, const std::string
     if (time (&now) == (time_t) -1)
 	throw Xapian::QueryParserError ("unable to get current time");
 
-    if (!begin.empty ()) {
+    if (! begin.empty ()) {
 	if (parse_time_string (begin.c_str (), &parsed_time, &now, PARSE_TIME_ROUND_DOWN))
 	    throw Xapian::QueryParserError ("Didn't understand date specification '" + begin + "'");
 	else
 	    from = (double) parsed_time;
     }
 
-    if (!end.empty ()) {
+    if (! end.empty ()) {
 	if (end == "!" && ! begin.empty ())
 	    str = begin;
 	else
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/lib/thread-fp.cc b/lib/thread-fp.cc
index 97a65211..06708ef2 100644
--- a/lib/thread-fp.cc
+++ b/lib/thread-fp.cc
@@ -40,11 +40,13 @@ ThreadFieldProcessor::operator() (const std::string & str)
 	    std::set<std::string> terms;
 
 	    if (! subquery)
-		throw Xapian::QueryParserError ("failed to create subquery for '" + subquery_str + "'");
+		throw Xapian::QueryParserError ("failed to create subquery for '" + subquery_str +
+						"'");
 
 	    status = notmuch_query_search_messages (subquery, &messages);
 	    if (status)
-		throw Xapian::QueryParserError ("failed to search messages for '" + subquery_str + "'");
+		throw Xapian::QueryParserError ("failed to search messages for '" + subquery_str +
+						"'");
 
 	    for (; notmuch_messages_valid (messages); notmuch_messages_move_to_next (messages)) {
 		std::string term = thread_prefix;
diff --git a/lib/thread.cc b/lib/thread.cc
index 17346008..46a50e80 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -505,7 +505,8 @@ _resolve_thread_relationships (notmuch_thread_t *thread)
 	 notmuch_messages_valid (roots);
 	 notmuch_messages_move_to_next (roots)) {
 	notmuch_message_t *message = notmuch_messages_get (roots);
-	if (_notmuch_messages_has_next (roots) || ! _notmuch_message_list_empty (thread->toplevel_list))
+	if (_notmuch_messages_has_next (roots) || ! _notmuch_message_list_empty (
+		thread->toplevel_list))
 	    _parent_or_toplevel (thread, message);
 	else
 	    _notmuch_message_list_add_message (thread->toplevel_list, message);
-- 
2.30.1

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

* [PATCH 2/4] util: run uncrustify
  2021-03-12 12:09 uncrustify all the things David Bremner
  2021-03-12 12:09 ` [PATCH 1/4] lib: run uncrustify David Bremner
@ 2021-03-12 12:09 ` David Bremner
  2021-03-12 12:09 ` [PATCH 3/4] test: " David Bremner
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2021-03-12 12:09 UTC (permalink / raw)
  To: notmuch; +Cc: uncrustify

From: uncrustify <david@tethera.net>

This is the result of running

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

in the util directory
---
 util/crypto.c      | 18 ++++++++++++------
 util/crypto.h      |  6 ++++--
 util/gmime-extra.c |  1 +
 util/repair.c      | 14 ++++++++------
 util/string-util.c |  3 ++-
 util/zlib-extra.c  |  3 ++-
 util/zlib-extra.h  |  2 +-
 7 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/util/crypto.c b/util/crypto.c
index c09f467b..156a6550 100644
--- a/util/crypto.c
+++ b/util/crypto.c
@@ -48,7 +48,8 @@ _notmuch_crypto_decrypt (bool *attempted,
 	notmuch_message_properties_t *list = NULL;
 
 	for (list = notmuch_message_get_properties (message, "session-key", TRUE);
-	     notmuch_message_properties_valid (list); notmuch_message_properties_move_to_next (list)) {
+	     notmuch_message_properties_valid (list); notmuch_message_properties_move_to_next (
+		 list)) {
 	    if (err && *err) {
 		g_error_free (*err);
 		*err = NULL;
@@ -61,12 +62,13 @@ _notmuch_crypto_decrypt (bool *attempted,
 							  notmuch_message_properties_value (list),
 							  decrypt_result, err);
 	    } else if (GMIME_IS_APPLICATION_PKCS7_MIME (part)) {
-	        GMimeApplicationPkcs7Mime *pkcs7 = GMIME_APPLICATION_PKCS7_MIME (part);
+		GMimeApplicationPkcs7Mime *pkcs7 = GMIME_APPLICATION_PKCS7_MIME (part);
 		GMimeSecureMimeType type = g_mime_application_pkcs7_mime_get_smime_type (pkcs7);
 		if (type == GMIME_SECURE_MIME_TYPE_ENVELOPED_DATA) {
 		    ret = g_mime_application_pkcs7_mime_decrypt (pkcs7,
 								 GMIME_DECRYPT_NONE,
-								 notmuch_message_properties_value (list),
+								 notmuch_message_properties_value (
+								     list),
 								 decrypt_result, err);
 		}
 	    }
@@ -90,6 +92,7 @@ _notmuch_crypto_decrypt (bool *attempted,
     if (attempted)
 	*attempted = true;
     GMimeDecryptFlags flags = GMIME_DECRYPT_NONE;
+
     if (decrypt == NOTMUCH_DECRYPT_TRUE && decrypt_result)
 	flags |= GMIME_DECRYPT_EXPORT_SESSION_KEY;
     if (GMIME_IS_MULTIPART_ENCRYPTED (part)) {
@@ -128,7 +131,8 @@ _notmuch_message_crypto_new (void *ctx)
 }
 
 notmuch_status_t
-_notmuch_message_crypto_potential_sig_list (_notmuch_message_crypto_t *msg_crypto, GMimeSignatureList *sigs)
+_notmuch_message_crypto_potential_sig_list (_notmuch_message_crypto_t *msg_crypto,
+					    GMimeSignatureList *sigs)
 {
     if (! msg_crypto)
 	return NOTMUCH_STATUS_NULL_POINTER;
@@ -157,7 +161,8 @@ _notmuch_message_crypto_potential_sig_list (_notmuch_message_crypto_t *msg_crypt
 
 
 bool
-_notmuch_message_crypto_potential_payload (_notmuch_message_crypto_t *msg_crypto, GMimeObject *part, GMimeObject *parent, int childnum)
+_notmuch_message_crypto_potential_payload (_notmuch_message_crypto_t *msg_crypto, GMimeObject *part,
+					   GMimeObject *parent, int childnum)
 {
     const char *protected_headers = NULL;
     const char *forwarded = NULL;
@@ -175,7 +180,8 @@ _notmuch_message_crypto_potential_payload (_notmuch_message_crypto_t *msg_crypto
      * encryption protocol should be "control information" metadata,
      * not payload.  So we skip it. (see
      * https://tools.ietf.org/html/rfc1847#page-8) */
-    if (parent && GMIME_IS_MULTIPART_ENCRYPTED (parent) && childnum == GMIME_MULTIPART_ENCRYPTED_VERSION) {
+    if (parent && GMIME_IS_MULTIPART_ENCRYPTED (parent) && childnum ==
+	GMIME_MULTIPART_ENCRYPTED_VERSION) {
 	const char *enc_type = g_mime_object_get_content_type_parameter (parent, "protocol");
 	GMimeContentType *ct = g_mime_object_get_content_type (part);
 	if (ct && enc_type) {
diff --git a/util/crypto.h b/util/crypto.h
index 4fa5599c..3c5d384b 100644
--- a/util/crypto.h
+++ b/util/crypto.h
@@ -80,7 +80,8 @@ _notmuch_message_crypto_new (void *ctx);
  * consider a particular signature as relevant for the message.
  */
 notmuch_status_t
-_notmuch_message_crypto_potential_sig_list (_notmuch_message_crypto_t *msg_crypto, GMimeSignatureList *sigs);
+_notmuch_message_crypto_potential_sig_list (_notmuch_message_crypto_t *msg_crypto,
+					    GMimeSignatureList *sigs);
 
 /* call successful_decryption during a depth-first-search on a message
  * to indicate that a part was successfully decrypted.
@@ -95,7 +96,8 @@ _notmuch_message_crypto_successful_decryption (_notmuch_message_crypto_t *msg_cr
  * this message.
  */
 bool
-_notmuch_message_crypto_potential_payload (_notmuch_message_crypto_t *msg_crypto, GMimeObject *part, GMimeObject *parent, int childnum);
+_notmuch_message_crypto_potential_payload (_notmuch_message_crypto_t *msg_crypto, GMimeObject *part,
+					   GMimeObject *parent, int childnum);
 
 
 #ifdef __cplusplus
diff --git a/util/gmime-extra.c b/util/gmime-extra.c
index 04d8ed3d..81a5b174 100644
--- a/util/gmime-extra.c
+++ b/util/gmime-extra.c
@@ -101,6 +101,7 @@ g_mime_certificate_get_valid_userid (GMimeCertificate *cert)
     if (uid == NULL)
 	return uid;
     GMimeValidity validity = g_mime_certificate_get_id_validity (cert);
+
     if (validity == GMIME_VALIDITY_FULL || validity == GMIME_VALIDITY_ULTIMATE)
 	return uid;
     return NULL;
diff --git a/util/repair.c b/util/repair.c
index 5a64e001..5b0dfdf4 100644
--- a/util/repair.c
+++ b/util/repair.c
@@ -32,7 +32,8 @@ _notmuch_crypto_payload_has_legacy_display (GMimeObject *payload)
     if (! g_mime_content_type_is_type (g_mime_object_get_content_type (payload),
 				       "multipart", "mixed"))
 	return false;
-    protected_header_parameter = g_mime_object_get_content_type_parameter (payload, "protected-headers");
+    protected_header_parameter = g_mime_object_get_content_type_parameter (payload,
+									   "protected-headers");
     if ((! protected_header_parameter) || strcmp (protected_header_parameter, "v1"))
 	return false;
     if (! GMIME_IS_MULTIPART (payload))
@@ -44,15 +45,16 @@ _notmuch_crypto_payload_has_legacy_display (GMimeObject *payload)
 	return false;
     first = g_mime_multipart_get_part (mpayload, 0);
     /* Early implementations that generated "Legacy Display" parts used
-       Content-Type: text/rfc822-headers, but text/plain is more widely
-       rendered, so it is now the standard choice.  We accept either as a
-       Legacy Display part. */
+     * Content-Type: text/rfc822-headers, but text/plain is more widely
+     * rendered, so it is now the standard choice.  We accept either as a
+     * Legacy Display part. */
     if (! (g_mime_content_type_is_type (g_mime_object_get_content_type (first),
 					"text", "plain") ||
 	   g_mime_content_type_is_type (g_mime_object_get_content_type (first),
 					"text", "rfc822-headers")))
 	return false;
-    protected_header_parameter = g_mime_object_get_content_type_parameter (first, "protected-headers");
+    protected_header_parameter = g_mime_object_get_content_type_parameter (first,
+									   "protected-headers");
     if ((! protected_header_parameter) || strcmp (protected_header_parameter, "v1"))
 	return false;
     if (! GMIME_IS_TEXT_PART (first))
@@ -77,7 +79,7 @@ static bool
 _notmuch_is_mixed_up_mangled (GMimeObject *part)
 {
     GMimeMultipart *mpart = NULL;
-    GMimeObject *parts[3] = {NULL, NULL, NULL};
+    GMimeObject *parts[3] = { NULL, NULL, NULL };
     GMimeContentType *type = NULL;
     char *prelude_string = NULL;
     bool prelude_is_empty;
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);
diff --git a/util/zlib-extra.c b/util/zlib-extra.c
index 3a75e504..1f5f9dbe 100644
--- a/util/zlib-extra.c
+++ b/util/zlib-extra.c
@@ -87,8 +87,9 @@ gz_error_string (util_status_t status, gzFile file)
 }
 
 const char *
-gzerror_str(gzFile file)
+gzerror_str (gzFile file)
 {
     int dummy;
+
     return gzerror (file, &dummy);
 }
diff --git a/util/zlib-extra.h b/util/zlib-extra.h
index e9925c98..7532339b 100644
--- a/util/zlib-extra.h
+++ b/util/zlib-extra.h
@@ -30,7 +30,7 @@ gz_error_string (util_status_t status, gzFile stream);
 /* Call gzerror with a dummy errno argument, the docs don't promise to
  * support the NULL case */
 const char *
-gzerror_str(gzFile file);
+gzerror_str (gzFile file);
 
 #ifdef __cplusplus
 }
-- 
2.30.1

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

* [PATCH 3/4] test: run uncrustify
  2021-03-12 12:09 uncrustify all the things David Bremner
  2021-03-12 12:09 ` [PATCH 1/4] lib: run uncrustify David Bremner
  2021-03-12 12:09 ` [PATCH 2/4] util: " David Bremner
@ 2021-03-12 12:09 ` David Bremner
  2021-03-12 12:09 ` [PATCH 4/4] cli: " David Bremner
  2021-03-13 16:06 ` uncrustify all the things David Bremner
  4 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2021-03-12 12:09 UTC (permalink / raw)
  To: notmuch; +Cc: uncrustify

From: uncrustify <david@tethera.net>

This is the result of running:

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

in the test directory.
---
 test/ghost-report.cc    | 1 +
 test/make-db-version.cc | 1 +
 test/random-corpus.c    | 1 +
 3 files changed, 3 insertions(+)

diff --git a/test/ghost-report.cc b/test/ghost-report.cc
index fad9a71d..9d9e7a7f 100644
--- a/test/ghost-report.cc
+++ b/test/ghost-report.cc
@@ -12,5 +12,6 @@ main (int argc, char **argv)
     }
 
     Xapian::Database db (argv[1]);
+
     std::cout << db.get_termfreq ("Tghost") << std::endl;
 }
diff --git a/test/make-db-version.cc b/test/make-db-version.cc
index 78feaf72..238584e2 100644
--- a/test/make-db-version.cc
+++ b/test/make-db-version.cc
@@ -17,6 +17,7 @@ main (int argc, char **argv)
     }
 
     std::string nmpath (argv[1]);
+
     nmpath += "/.notmuch";
     if (mkdir (nmpath.c_str (), 0777) < 0) {
 	perror (("failed to create " + nmpath).c_str ());
diff --git a/test/random-corpus.c b/test/random-corpus.c
index ff413252..d0354e35 100644
--- a/test/random-corpus.c
+++ b/test/random-corpus.c
@@ -190,6 +190,7 @@ main (int argc, char **argv)
     srandom (seed);
 
     int count;
+
     for (count = 0; count < num_messages; count++) {
 	int j;
 	/* explicitly allow zero tags */
-- 
2.30.1

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

* [PATCH 4/4] cli: run uncrustify
  2021-03-12 12:09 uncrustify all the things David Bremner
                   ` (2 preceding siblings ...)
  2021-03-12 12:09 ` [PATCH 3/4] test: " David Bremner
@ 2021-03-12 12:09 ` David Bremner
  2021-03-13 16:06 ` uncrustify all the things David Bremner
  4 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2021-03-12 12:09 UTC (permalink / raw)
  To: notmuch; +Cc: uncrustify

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

Line breaks were then adjusted manually to keep argc and argv
together.
---
 command-line-arguments.c | 18 ++++++++++-----
 gmime-filter-reply.h     | 16 +++++++++-----
 mime-node.c              | 24 +++++++++++++-------
 notmuch-client.h         | 47 ++++++++++++++++++++++++++--------------
 notmuch-compact.c        |  3 ++-
 notmuch-config.c         |  7 ++++--
 notmuch-count.c          | 13 ++++++-----
 notmuch-dump.c           |  5 +++--
 notmuch-insert.c         |  3 ++-
 notmuch-new.c            | 21 +++++++++++-------
 notmuch-reindex.c        |  3 ++-
 notmuch-reply.c          |  7 ++++--
 notmuch-restore.c        | 10 ++++++---
 notmuch-search.c         |  9 +++++---
 notmuch-show.c           | 37 +++++++++++++++++++++----------
 notmuch-tag.c            |  3 ++-
 notmuch-time.c           |  4 ++--
 notmuch.c                | 33 ++++++++++++++++++----------
 sprinter-json.c          |  2 +-
 sprinter-sexp.c          |  2 +-
 sprinter-text.c          |  2 +-
 21 files changed, 177 insertions(+), 92 deletions(-)

diff --git a/command-line-arguments.c b/command-line-arguments.c
index 169b12a3..5dea8281 100644
--- a/command-line-arguments.c
+++ b/command-line-arguments.c
@@ -47,17 +47,23 @@ _process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next,
 		continue;
 
 	    *arg_desc->opt_keyword = keywords->value;
-	    fprintf (stderr, "Warning: No known keyword option given for \"%s\", choosing value \"%s\"."
-		     "  Please specify the argument explicitly!\n", arg_desc->name, arg_desc->keyword_no_arg_value);
+	    fprintf (stderr,
+		     "Warning: No known keyword option given for \"%s\", choosing value \"%s\"."
+		     "  Please specify the argument explicitly!\n", arg_desc->name,
+		     arg_desc->keyword_no_arg_value);
 
 	    return OPT_GIVEBACK;
 	}
-	fprintf (stderr, "No matching keyword for option \"%s\" and default value \"%s\" is invalid.\n", arg_str, arg_desc->name);
+	fprintf (stderr,
+		 "No matching keyword for option \"%s\" and default value \"%s\" is invalid.\n",
+		 arg_str,
+		 arg_desc->name);
 	return OPT_FAILED;
     }
 
     if (next != '\0')
-	fprintf (stderr, "Unknown keyword argument \"%s\" for option \"%s\".\n", arg_str, arg_desc->name);
+	fprintf (stderr, "Unknown keyword argument \"%s\" for option \"%s\".\n", arg_str,
+		 arg_desc->name);
     else
 	fprintf (stderr, "Option \"%s\" needs a keyword argument.\n", arg_desc->name);
     return OPT_FAILED;
@@ -74,7 +80,8 @@ _process_boolean_arg (const notmuch_opt_desc_t *arg_desc, char next,
     } else if (strcmp (arg_str, "false") == 0) {
 	value = false;
     } else {
-	fprintf (stderr, "Unknown argument \"%s\" for (boolean) option \"%s\".\n", arg_str, arg_desc->name);
+	fprintf (stderr, "Unknown argument \"%s\" for (boolean) option \"%s\".\n", arg_str,
+		 arg_desc->name);
 	return OPT_FAILED;
     }
 
@@ -202,6 +209,7 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
     const notmuch_opt_desc_t *try;
 
     const char *next_arg = NULL;
+
     if (opt_index < argc - 1  && strncmp (argv[opt_index + 1], "--", 2) != 0)
 	next_arg = argv[opt_index + 1];
 
diff --git a/gmime-filter-reply.h b/gmime-filter-reply.h
index 5a1e606e..7cdefcd1 100644
--- a/gmime-filter-reply.h
+++ b/gmime-filter-reply.h
@@ -24,11 +24,17 @@
 G_BEGIN_DECLS
 
 #define GMIME_TYPE_FILTER_REPLY            (g_mime_filter_reply_get_type ())
-#define GMIME_FILTER_REPLY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMIME_TYPE_FILTER_REPLY, GMimeFilterReply))
-#define GMIME_FILTER_REPLY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMIME_TYPE_FILTER_REPLY, GMimeFilterReplyClass))
-#define GMIME_IS_FILTER_REPLY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMIME_TYPE_FILTER_REPLY))
-#define GMIME_IS_FILTER_REPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMIME_TYPE_FILTER_REPLY))
-#define GMIME_FILTER_REPLY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GMIME_TYPE_FILTER_REPLY, GMimeFilterReplyClass))
+#define GMIME_FILTER_REPLY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+									GMIME_TYPE_FILTER_REPLY, \
+									GMimeFilterReply))
+#define GMIME_FILTER_REPLY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMIME_TYPE_FILTER_REPLY, \
+								     GMimeFilterReplyClass))
+#define GMIME_IS_FILTER_REPLY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+									GMIME_TYPE_FILTER_REPLY))
+#define GMIME_IS_FILTER_REPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+								     GMIME_TYPE_FILTER_REPLY))
+#define GMIME_FILTER_REPLY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GMIME_TYPE_FILTER_REPLY, \
+								       GMimeFilterReplyClass))
 
 typedef struct _GMimeFilterReply GMimeFilterReply;
 typedef struct _GMimeFilterReplyClass GMimeFilterReplyClass;
diff --git a/mime-node.c b/mime-node.c
index f552e03a..d29c4e48 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -243,7 +243,8 @@ node_verify (mime_node_t *node, GMimeObject *part)
 
     status = _notmuch_message_crypto_potential_sig_list (node->ctx->msg_crypto, node->sig_list);
     if (status) /* this is a warning, not an error */
-	fprintf (stderr, "Warning: failed to note signature status: %s.\n", notmuch_status_to_string (status));
+	fprintf (stderr, "Warning: failed to note signature status: %s.\n", notmuch_status_to_string (
+		     status));
 }
 
 /* Decrypt and optionally verify an encrypted mime node */
@@ -278,7 +279,8 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part)
     node->decrypt_success = true;
     status = _notmuch_message_crypto_successful_decryption (node->ctx->msg_crypto);
     if (status) /* this is a warning, not an error */
-	fprintf (stderr, "Warning: failed to note decryption status: %s.\n", notmuch_status_to_string (status));
+	fprintf (stderr, "Warning: failed to note decryption status: %s.\n",
+		 notmuch_status_to_string (status));
 
     if (decrypt_result) {
 	/* This may be NULL if the part is not signed. */
@@ -287,9 +289,11 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part)
 	    node->verify_attempted = true;
 	    g_object_ref (node->sig_list);
 	    set_signature_list_destructor (node);
-	    status = _notmuch_message_crypto_potential_sig_list (node->ctx->msg_crypto, node->sig_list);
+	    status = _notmuch_message_crypto_potential_sig_list (node->ctx->msg_crypto,
+								 node->sig_list);
 	    if (status) /* this is a warning, not an error */
-		fprintf (stderr, "Warning: failed to note signature status: %s.\n", notmuch_status_to_string (status));
+		fprintf (stderr, "Warning: failed to note signature status: %s.\n",
+			 notmuch_status_to_string (status));
 	}
 
 	if (node->ctx->crypto->decrypt == NOTMUCH_DECRYPT_TRUE && message) {
@@ -366,7 +370,8 @@ _mime_node_set_up_part (mime_node_t *node, GMimeObject *part, int numchild)
     }
 
     /* Handle PGP/MIME parts (by definition not cryptographic payload parts) */
-    if (GMIME_IS_MULTIPART_ENCRYPTED (part) && (node->ctx->crypto->decrypt != NOTMUCH_DECRYPT_FALSE)) {
+    if (GMIME_IS_MULTIPART_ENCRYPTED (part) && (node->ctx->crypto->decrypt !=
+						NOTMUCH_DECRYPT_FALSE)) {
 	if (node->nchildren != 2) {
 	    /* this violates RFC 3156 section 4, so we won't bother with it. */
 	    fprintf (stderr, "Error: %d part(s) for a multipart/encrypted "
@@ -385,19 +390,22 @@ _mime_node_set_up_part (mime_node_t *node, GMimeObject *part, int numchild)
 	    node_verify (node, part);
 	}
     } else if (GMIME_IS_APPLICATION_PKCS7_MIME (part) &&
-	       GMIME_SECURE_MIME_TYPE_SIGNED_DATA == g_mime_application_pkcs7_mime_get_smime_type (GMIME_APPLICATION_PKCS7_MIME (part))) {
+	       GMIME_SECURE_MIME_TYPE_SIGNED_DATA == g_mime_application_pkcs7_mime_get_smime_type (
+		   GMIME_APPLICATION_PKCS7_MIME (part))) {
 	/* If node->ctx->crypto->verify is false, it would be better
 	 * to just unwrap (instead of verifying), but
 	 * https://github.com/jstedfast/gmime/issues/67 */
 	node_verify (node, part);
     } else if (GMIME_IS_APPLICATION_PKCS7_MIME (part) &&
-	       GMIME_SECURE_MIME_TYPE_ENVELOPED_DATA == g_mime_application_pkcs7_mime_get_smime_type (GMIME_APPLICATION_PKCS7_MIME (part)) &&
+	       GMIME_SECURE_MIME_TYPE_ENVELOPED_DATA == g_mime_application_pkcs7_mime_get_smime_type (
+		   GMIME_APPLICATION_PKCS7_MIME (part)) &&
 	       (node->ctx->crypto->decrypt != NOTMUCH_DECRYPT_FALSE)) {
 	node_decrypt_and_verify (node, part);
 	if (node->unwrapped_child && node->nchildren == 0)
 	    node->nchildren = 1;
     } else {
-	if (_notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, node->parent ? node->parent->part : NULL, numchild) &&
+	if (_notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, node->parent ?
+						       node->parent->part : NULL, numchild) &&
 	    node->ctx->msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL) {
 	    GMimeObject *clean_payload = _notmuch_repair_crypto_payload_skip_legacy_display (part);
 	    if (clean_payload != part) {
diff --git a/notmuch-client.h b/notmuch-client.h
index f60f5406..70458629 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -171,46 +171,60 @@ void
 notmuch_exit_if_unsupported_format (void);
 
 int
-notmuch_count_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_count_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+		       int argc, char *argv[]);
 
 int
-notmuch_dump_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_dump_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+		      int argc, char *argv[]);
 
 int
-notmuch_new_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_new_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+		     int argc, char *argv[]);
 
 int
-notmuch_insert_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_insert_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+			int argc, char *argv[]);
 
 int
-notmuch_reindex_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_reindex_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+			 int argc, char *argv[]);
 
 int
-notmuch_reply_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_reply_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+		       int argc, char *argv[]);
 
 int
-notmuch_restore_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_restore_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+			 int argc, char *argv[]);
 
 int
-notmuch_search_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_search_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+			int argc, char *argv[]);
 
 int
-notmuch_address_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_address_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+			 int argc, char *argv[]);
 
 int
-notmuch_setup_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_setup_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+		       int argc, char *argv[]);
 
 int
-notmuch_show_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_show_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+		      int argc, char *argv[]);
 
 int
-notmuch_tag_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_tag_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+		     int argc, char *argv[]);
 
 int
-notmuch_config_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_config_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+			int argc, char *argv[]);
 
 int
-notmuch_compact_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+notmuch_compact_command (notmuch_config_t *config, notmuch_database_t *notmuch,
+			 int argc, char *argv[]);
 
 const char *
 notmuch_time_relative_date (const void *ctx, time_t then);
@@ -503,9 +517,10 @@ print_status_gzbytes (const char *loc,
 		      int bytes);
 
 /* the __location__ macro is defined in talloc.h */
-#define ASSERT_GZBYTES(file, bytes) ((print_status_gzbytes (__location__, file, bytes)) ? exit (1) : 0)
+#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-compact.c b/notmuch-compact.c
index 361583db..cc45afa1 100644
--- a/notmuch-compact.c
+++ b/notmuch-compact.c
@@ -27,7 +27,8 @@ status_update_cb (const char *msg, unused (void *closure))
 }
 
 int
-notmuch_compact_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_compact_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
+			 int argc, char *argv[])
 {
     const char *backup_path = NULL;
     notmuch_status_t ret;
diff --git a/notmuch-config.c b/notmuch-config.c
index 0193401f..e1a583e6 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.
@@ -1105,7 +1107,8 @@ notmuch_config_command_list (notmuch_config_t *config)
 }
 
 int
-notmuch_config_command (notmuch_config_t *config, unused(notmuch_database_t *notmuch), int argc, char *argv[])
+notmuch_config_command (notmuch_config_t *config, unused(notmuch_database_t *notmuch),
+			int argc, char *argv[])
 {
     int ret;
     int opt_index;
diff --git a/notmuch-count.c b/notmuch-count.c
index 048b1f44..bfa0363a 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:
@@ -151,7 +151,8 @@ count_file (notmuch_database_t *notmuch, FILE *input, notmuch_config_values_t *e
 }
 
 int
-notmuch_count_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_count_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
+		       int argc, char *argv[])
 {
     char *query_str;
     int opt_index;
diff --git a/notmuch-dump.c b/notmuch-dump.c
index d7017929..04ecd6a3 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,8 @@ 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..cc5aeefc 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -444,7 +444,8 @@ 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..223d68bb 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -673,8 +673,9 @@ add_files (notmuch_database_t *notmuch,
 		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);
+		    printf (
+			"(D) add_files, pass 2: queuing passed directory %s for deletion from database\n",
+			absolute);
 
 		_filename_list_add (state->removed_directories, absolute);
 	    }
@@ -756,8 +757,9 @@ add_files (notmuch_database_t *notmuch,
 					  notmuch_filenames_get (db_subdirs));
 
 	if (state->debug)
-	    printf ("(D) add_files, pass 3: queuing leftover directory %s for deletion from database\n",
-		    absolute);
+	    printf (
+		"(D) add_files, pass 3: queuing leftover directory %s for deletion from database\n",
+		absolute);
 
 	_filename_list_add (state->removed_directories, absolute);
 
@@ -1043,7 +1045,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);
@@ -1094,7 +1097,8 @@ _maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state) {
 }
 
 int
-notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
+		     int argc, char *argv[])
 {
     add_files_state_t add_files_state = {
 	.verbosity = VERBOSITY_NORMAL,
@@ -1155,7 +1159,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);
@@ -1233,7 +1237,8 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu
 	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,
+				    tv_start, add_files_state.removed_messages +
+				    add_files_state.renamed_messages,
 				    add_files_state.removed_files->count);
 	}
     }
diff --git a/notmuch-reindex.c b/notmuch-reindex.c
index fa84d4fc..df566a7c 100644
--- a/notmuch-reindex.c
+++ b/notmuch-reindex.c
@@ -83,7 +83,8 @@ reindex_query (notmuch_database_t *notmuch, const char *query_string,
 }
 
 int
-notmuch_reindex_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_reindex_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
+			 int argc, char *argv[])
 {
     char *query_string = NULL;
     struct sigaction action;
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 700f3397..b40ce96b 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -639,7 +639,9 @@ do_reply (notmuch_database_t *notmuch,
 	    return 1;
 
 	if (count != 1) {
-	    fprintf (stderr, "Error: search term did not match precisely one message (matched %u messages).\n", count);
+	    fprintf (stderr,
+		     "Error: search term did not match precisely one message (matched %u messages).\n",
+		     count);
 	    return 1;
 	}
 
@@ -703,7 +705,8 @@ do_reply (notmuch_database_t *notmuch,
 }
 
 int
-notmuch_reply_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_reply_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
+		       int argc, char *argv[])
 {
     notmuch_query_t *query;
     char *query_string;
diff --git a/notmuch-restore.c b/notmuch-restore.c
index ce07f89d..081b504c 100644
--- a/notmuch-restore.c
+++ b/notmuch-restore.c
@@ -219,7 +219,8 @@ parse_sup_line (void *ctx, char *line,
 }
 
 int
-notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
+			 int argc, char *argv[])
 {
     bool accumulate = false;
     tag_op_flag_t flags = 0;
@@ -343,7 +344,8 @@ notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *n
 	    if (ret)
 		goto DONE;
 	}
-	if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] == '=') {
+	if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] ==
+	    '=') {
 	    ret = process_properties_line (notmuch, line + 2);
 	    if (ret)
 		goto DONE;
@@ -360,6 +362,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;
@@ -382,7 +385,8 @@ notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *n
 
 	line_ctx = talloc_new (notmuch);
 
-	if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] == '=') {
+	if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] ==
+	    '=') {
 	    ret = process_properties_line (notmuch, line + 2);
 	    if (ret)
 		goto DONE;
diff --git a/notmuch-search.c b/notmuch-search.c
index aba22799..a5c49477 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -794,7 +794,8 @@ static const notmuch_opt_desc_t common_options[] = {
 };
 
 int
-notmuch_search_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_search_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
+			int argc, char *argv[])
 {
     search_context_t *ctx = &search_context;
     int opt_index, ret;
@@ -831,7 +832,8 @@ notmuch_search_command (unused(notmuch_config_t *config), notmuch_database_t *no
 
     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");
+	fprintf (stderr,
+		 "Error: --duplicate=N is only supported with --output=files and --output=messages.\n");
 	return EXIT_FAILURE;
     }
 
@@ -860,7 +862,8 @@ notmuch_search_command (unused(notmuch_config_t *config), notmuch_database_t *no
 }
 
 int
-notmuch_address_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_address_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
+			 int argc, char *argv[])
 {
     search_context_t *ctx = &search_context;
     int opt_index, ret;
diff --git a/notmuch-show.c b/notmuch-show.c
index c3c42caa..b6b53991 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);
 
@@ -668,7 +671,8 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
 		    sp->map_key (sp, "decrypted");
 		    sp->begin_map (sp);
 		    sp->map_key (sp, "status");
-		    sp->string (sp, msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL ? "full" : "partial");
+		    sp->string (sp, msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL ?
+				"full" : "partial");
 
 		    if (msg_crypto->payload_subject) {
 			const char *subject = g_mime_message_get_subject GMIME_MESSAGE (node->part);
@@ -965,7 +969,8 @@ show_message (void *ctx,
     notmuch_status_t session_key_count_error = NOTMUCH_STATUS_SUCCESS;
 
     if (params->crypto.decrypt == NOTMUCH_DECRYPT_TRUE)
-	session_key_count_error = notmuch_message_count_properties (message, "session-key", &session_keys);
+	session_key_count_error = notmuch_message_count_properties (message, "session-key",
+								    &session_keys);
 
     status = mime_node_open (local, message, &(params->crypto), &root);
     if (status)
@@ -973,12 +978,15 @@ show_message (void *ctx,
     part = mime_node_seek_dfs (root, (params->part < 0 ? 0 : params->part));
     if (part)
 	status = format->part (local, sp, part, indent, params);
-    if (params->crypto.decrypt == NOTMUCH_DECRYPT_TRUE && session_key_count_error == NOTMUCH_STATUS_SUCCESS) {
+    if (params->crypto.decrypt == NOTMUCH_DECRYPT_TRUE && session_key_count_error ==
+	NOTMUCH_STATUS_SUCCESS) {
 	unsigned int new_session_keys = 0;
-	if (notmuch_message_count_properties (message, "session-key", &new_session_keys) == NOTMUCH_STATUS_SUCCESS &&
+	if (notmuch_message_count_properties (message, "session-key", &new_session_keys) ==
+	    NOTMUCH_STATUS_SUCCESS &&
 	    new_session_keys > session_keys) {
 	    /* try a quiet re-indexing */
-	    notmuch_indexopts_t *indexopts = notmuch_database_get_default_indexopts (notmuch_message_get_database (message));
+	    notmuch_indexopts_t *indexopts = notmuch_database_get_default_indexopts (
+		notmuch_message_get_database (message));
 	    if (indexopts) {
 		notmuch_indexopts_set_decrypt_policy (indexopts, NOTMUCH_DECRYPT_AUTO);
 		print_status_message ("Error re-indexing message with --decrypt=stash",
@@ -1064,7 +1072,9 @@ do_show_single (void *ctx,
 	return 1;
 
     if (count != 1) {
-	fprintf (stderr, "Error: search term did not match precisely one message (matched %u messages).\n", count);
+	fprintf (stderr,
+		 "Error: search term did not match precisely one message (matched %u messages).\n",
+		 count);
 	return 1;
     }
 
@@ -1157,9 +1167,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);
@@ -1215,7 +1225,8 @@ static const notmuch_show_format_t *formatters[] = {
 };
 
 int
-notmuch_show_command (notmuch_config_t *config, unused(notmuch_database_t *notmuch), int argc, char *argv[])
+notmuch_show_command (notmuch_config_t *config, unused(notmuch_database_t *notmuch),
+		      int argc, char *argv[])
 {
     notmuch_database_t *notmuch;
     notmuch_query_t *query;
@@ -1321,10 +1332,12 @@ notmuch_show_command (notmuch_config_t *config, unused(notmuch_database_t *notmu
 	(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");
+	fprintf (stderr,
+		 "Warning: --include-html only implemented for format=text, format=json and format=sexp\n");
     }
 
     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/notmuch-tag.c b/notmuch-tag.c
index 464874b4..9c3d4f8b 100644
--- a/notmuch-tag.c
+++ b/notmuch-tag.c
@@ -187,7 +187,8 @@ tag_file (void *ctx, notmuch_database_t *notmuch, tag_op_flag_t flags,
 }
 
 int
-notmuch_tag_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
+notmuch_tag_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
+		     int argc, char *argv[])
 {
     tag_op_list_t *tag_ops = NULL;
     char *query_string = NULL;
diff --git a/notmuch-time.c b/notmuch-time.c
index cc7ffc23..cd45818b 100644
--- a/notmuch-time.c
+++ b/notmuch-time.c
@@ -39,8 +39,8 @@
  *
  */
 #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)
diff --git a/notmuch.c b/notmuch.c
index 7360e0e6..5e56209b 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -31,7 +31,8 @@
  * Each subcommand should be passed either a config object, or an open
  * database
  */
-typedef int (*command_function_t) (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
+typedef int (*command_function_t) (notmuch_config_t *config, notmuch_database_t *notmuch,
+				   int argc, char *argv[]);
 
 typedef struct command {
     const char *name;
@@ -125,7 +126,8 @@ notmuch_process_shared_indexing_options (notmuch_database_t *notmuch)
 	notmuch_status_t status;
 	if (indexing_cli_choices.opts == NULL)
 	    return NOTMUCH_STATUS_OUT_OF_MEMORY;
-	status = notmuch_indexopts_set_decrypt_policy (indexing_cli_choices.opts, indexing_cli_choices.decrypt_policy);
+	status = notmuch_indexopts_set_decrypt_policy (indexing_cli_choices.opts,
+						       indexing_cli_choices.decrypt_policy);
 	if (status != NOTMUCH_STATUS_SUCCESS) {
 	    fprintf (stderr, "Error: Failed to set index decryption policy to %d. (%s)\n",
 		     indexing_cli_choices.decrypt_policy, notmuch_status_to_string (status));
@@ -144,9 +146,11 @@ static command_t commands[] = {
     { "setup", notmuch_setup_command, NOTMUCH_COMMAND_CONFIG_OPEN | NOTMUCH_COMMAND_CONFIG_CREATE,
       "Interactively set up notmuch for first use." },
     { "new", notmuch_new_command,
-      NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE | NOTMUCH_COMMAND_DATABASE_CREATE,
+      NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE |
+      NOTMUCH_COMMAND_DATABASE_CREATE,
       "Find and import new messages to the notmuch database." },
-    { "insert", notmuch_insert_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE,
+    { "insert", notmuch_insert_command, NOTMUCH_COMMAND_DATABASE_EARLY |
+      NOTMUCH_COMMAND_DATABASE_WRITE,
       "Add a new message into the maildir and notmuch database." },
     { "search", notmuch_search_command, NOTMUCH_COMMAND_DATABASE_EARLY,
       "Search for messages matching the given search terms." },
@@ -162,11 +166,14 @@ static command_t commands[] = {
       "Add/remove tags for all messages matching the search terms." },
     { "dump", notmuch_dump_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE,
       "Create a plain-text dump of the tags for each message." },
-    { "restore", notmuch_restore_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE,
+    { "restore", notmuch_restore_command, NOTMUCH_COMMAND_DATABASE_EARLY |
+      NOTMUCH_COMMAND_DATABASE_WRITE,
       "Restore the tags from the given dump file (see 'dump')." },
-    { "compact", notmuch_compact_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE,
+    { "compact", notmuch_compact_command, NOTMUCH_COMMAND_DATABASE_EARLY |
+      NOTMUCH_COMMAND_DATABASE_WRITE,
       "Compact the notmuch database." },
-    { "reindex", notmuch_reindex_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE,
+    { "reindex", notmuch_reindex_command, NOTMUCH_COMMAND_DATABASE_EARLY |
+      NOTMUCH_COMMAND_DATABASE_WRITE,
       "Re-index all messages matching the search terms." },
     { "config", notmuch_config_command, NOTMUCH_COMMAND_CONFIG_OPEN,
       "Get or set settings in the notmuch configuration file." },
@@ -248,14 +255,16 @@ void
 notmuch_exit_if_unsupported_format (void)
 {
     if (notmuch_format_version > NOTMUCH_FORMAT_CUR) {
-	fprintf (stderr, "\
+	fprintf (stderr,
+		 "\
 A caller requested output format version %d, but the installed notmuch\n\
 CLI only supports up to format version %d.  You may need to upgrade your\n\
 notmuch CLI.\n",
 		 notmuch_format_version, NOTMUCH_FORMAT_CUR);
 	exit (NOTMUCH_EXIT_FORMAT_TOO_NEW);
     } else if (notmuch_format_version < NOTMUCH_FORMAT_MIN) {
-	fprintf (stderr, "\
+	fprintf (stderr,
+		 "\
 A caller requested output format version %d, which is no longer supported\n\
 by the notmuch CLI (it requires at least version %d).  You may need to\n\
 upgrade your notmuch front-end.\n",
@@ -265,7 +274,8 @@ upgrade your notmuch front-end.\n",
 	/* Warn about old version requests so compatibility issues are
 	 * less likely when we drop support for a deprecated format
 	 * versions. */
-	fprintf (stderr, "\
+	fprintf (stderr,
+		 "\
 A caller requested deprecated output format version %d, which may not\n\
 be supported in the future.\n", notmuch_format_version);
     }
@@ -339,7 +349,8 @@ _help_for (const char *topic_name)
 }
 
 static int
-notmuch_help_command (unused (notmuch_config_t *config), unused(notmuch_database_t *notmuch), int argc, char *argv[])
+notmuch_help_command (unused (notmuch_config_t *config), unused(notmuch_database_t *notmuch), int
+		      argc, char *argv[])
 {
     int opt_index;
 
diff --git a/sprinter-json.c b/sprinter-json.c
index 273bdeca..c7f4851c 100644
--- a/sprinter-json.c
+++ b/sprinter-json.c
@@ -129,7 +129,7 @@ json_integer (struct sprinter *sp, int64_t val)
 {
     struct sprinter_json *spj = json_begin_value (sp);
 
-    fprintf (spj->stream, "%"PRId64, val);
+    fprintf (spj->stream, "%" PRId64, val);
 }
 
 static void
diff --git a/sprinter-sexp.c b/sprinter-sexp.c
index 35c007d5..63b25428 100644
--- a/sprinter-sexp.c
+++ b/sprinter-sexp.c
@@ -166,7 +166,7 @@ sexp_integer (struct sprinter *sp, int64_t val)
 {
     struct sprinter_sexp *sps = sexp_begin_value (sp);
 
-    fprintf (sps->stream, "%"PRId64, val);
+    fprintf (sps->stream, "%" PRId64, val);
 }
 
 static void
diff --git a/sprinter-text.c b/sprinter-text.c
index 7b68f98c..c75ec5be 100644
--- a/sprinter-text.c
+++ b/sprinter-text.c
@@ -49,7 +49,7 @@ text_integer (struct sprinter *sp, int64_t val)
 {
     struct sprinter_text *sptxt = (struct sprinter_text *) sp;
 
-    fprintf (sptxt->stream, "%"PRId64, val);
+    fprintf (sptxt->stream, "%" PRId64, val);
 }
 
 static void
-- 
2.30.1

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

* Re: uncrustify all the things
  2021-03-12 12:09 uncrustify all the things David Bremner
                   ` (3 preceding siblings ...)
  2021-03-12 12:09 ` [PATCH 4/4] cli: " David Bremner
@ 2021-03-13 16:06 ` David Bremner
  4 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2021-03-13 16:06 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:
> I'll probabably apply these relatively quickly to minimimize the
> amount of pain for people (like me) rebasing patch series against
> master.

As promised, applied to master. Further cleanup welcome, preferably in a
form that survives re-running uncrustify.

d

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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-12 12:09 uncrustify all the things David Bremner
2021-03-12 12:09 ` [PATCH 1/4] lib: run uncrustify David Bremner
2021-03-12 12:09 ` [PATCH 2/4] util: " David Bremner
2021-03-12 12:09 ` [PATCH 3/4] test: " David Bremner
2021-03-12 12:09 ` [PATCH 4/4] cli: " David Bremner
2021-03-13 16:06 ` uncrustify all the things David Bremner

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

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

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