unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Cc: uncrustify <david@tethera.net>
Subject: [PATCH 1/4] lib: run uncrustify
Date: Fri, 12 Mar 2021 08:09:52 -0400	[thread overview]
Message-ID: <20210312120955.2712730-2-david@tethera.net> (raw)
In-Reply-To: <20210312120955.2712730-1-david@tethera.net>

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

  reply	other threads:[~2021-03-12 12:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 12:09 uncrustify all the things David Bremner
2021-03-12 12:09 ` David Bremner [this message]
2021-03-12 12:09 ` [PATCH 2/4] util: run uncrustify 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210312120955.2712730-2-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).