From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 382yEpwKRWD/UgAA0tVLHw (envelope-from ) for ; Sun, 07 Mar 2021 17:17:16 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 8EMsDpwKRWAlEQAAbx9fmQ (envelope-from ) for ; Sun, 07 Mar 2021 17:17:16 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx2.migadu.com (Postfix) with ESMTPS id 718821E796 for ; Sun, 7 Mar 2021 18:17:15 +0100 (CET) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 984E726BEC; Sun, 7 Mar 2021 12:17:07 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 74854202B3 for ; Sun, 7 Mar 2021 12:17:04 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id EAA415FA96; Sun, 7 Mar 2021 12:17:01 -0500 (EST) Received: (nullmailer pid 1084148 invoked by uid 1000); Sun, 07 Mar 2021 17:17:00 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH] run uncrustify. Date: Sun, 7 Mar 2021 13:16:58 -0400 Message-Id: <20210307171658.1084026-1-david@tethera.net> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210306172256.703772-1-david@tethera.net> References: <20210306172256.703772-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: YTDOHZHGDGGI2LHDY7X4DSALDD4EMDIR X-Message-ID-Hash: YTDOHZHGDGGI2LHDY7X4DSALDD4EMDIR X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1615137435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ebKkktDsYfLwDWAtQxNMEoFz0vdStQjybo5rA5VTtyA=; b=n/gw3YSsMp9WAKFTUR9k9IcNRlU8u7NfCIUjCrTJvQW98EVzgT9xhC9A+lHKJwipPcl7CW cvfpm2QP/sDonWWp/QkDLV0FiZ/0VJ6OhV42pqLQUjCbFBO8WBYcyj4iy8HtYgS79VLi7O EmgSBAd8b96rDU4WC0h4uWYWTM6IMpDuOUlbTCSUMKdmnkhyV76dmWveB1Ymsh9rd0oJqP qfTDPU2yAtbt166l0axmr2sbJ/AGX3zyoZ7QiTremXvVXy+9Suo8zdzcSQcyVKNqclJ8NR 6aQkhGCl2O/ithtDi/wjalyMEoNJWSd7nObcy7FkCvo6MmveNMz+ypGOhHLmnw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615137435; a=rsa-sha256; cv=none; b=aSNc2zOIjwMFSy9ftxADzPIQXXTwC2wC/1N40zdWb+gW5ka1pmNP4czuY/nuTRhGOotVxH ECWX60EBCynE02h+4dR/snd7pV6t3RpYfGLkpEDtwlmxt+KA0tfD8/D/nESUjZEjRu2V6k ZhZQYTBVAuZGQyvoxa6w63VQaoVuYSwQYYGdev3w5B+TZ6XTHFsMSeYyLj6rGoZHWnGZyd OK89z/n6fgZBKe9BHAcB0D8BBrkv+Soa9Mn6rBAhC5RZCwqAzGrVlUVLkSx/oka/ZuPHEm M7gA3RsXInWpNO8heP7CVygaPIgdIE/ZG1qqzS209lyGgNnom6TXttkzsU3s+A== ARC-Authentication-Results: i=1; aspmx2.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx2.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.86 Authentication-Results: aspmx2.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx2.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 718821E796 X-Spam-Score: -0.86 X-Migadu-Scanner: scn1.migadu.com X-TUID: yEGYaJqW5QOU This is mainly fixing up style problems that crept in with the first merged config handling series. It also takes a few other suggestions from uncrustify as this makes it easier to detect future style problems. Break lines for calls to _choose_database_path manually. --- Add a couple of manual line breaks lib/config.cc | 68 ++++++++++++++++++++++++++----------------- lib/database.cc | 12 ++++---- lib/notmuch-private.h | 40 ++++++++++++------------- lib/notmuch.h | 4 +-- lib/open.cc | 16 +++++----- lib/prefix.cc | 4 +-- lib/string-map.c | 6 ++-- notmuch-client.h | 2 +- notmuch-config.c | 4 ++- notmuch-count.c | 10 +++---- notmuch-dump.c | 4 +-- notmuch-insert.c | 2 +- notmuch-new.c | 5 ++-- notmuch-restore.c | 1 + notmuch-show.c | 12 +++++--- util/string-util.c | 3 +- 16 files changed, 110 insertions(+), 83 deletions(-) diff --git a/lib/config.cc b/lib/config.cc index 6ace6e52..43c5ddec 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -38,7 +38,7 @@ struct _notmuch_config_values { void *children; /* talloc_context */ }; -static const char * _notmuch_config_key_to_string (notmuch_config_key_t key); +static const char *_notmuch_config_key_to_string (notmuch_config_key_t key); static int _notmuch_config_list_destroy (notmuch_config_list_t *list) @@ -104,7 +104,7 @@ notmuch_database_get_config (notmuch_database_t *notmuch, const char *key, char **value) { - const char* stored_val; + const char *stored_val; notmuch_status_t status; if (! notmuch->config) { @@ -119,7 +119,7 @@ notmuch_database_get_config (notmuch_database_t *notmuch, if (! stored_val) { /* XXX in principle this API should be fixed so empty string * is distinguished from not found */ - *value = strdup(""); + *value = strdup (""); } else { *value = strdup (stored_val); } @@ -167,7 +167,7 @@ notmuch_database_get_config_list (notmuch_database_t *notmuch, if (status != NOTMUCH_STATUS_XAPIAN_EXCEPTION) _notmuch_config_list_destroy (list); } - } else { + } else { talloc_set_destructor (list, _notmuch_config_list_destroy); } @@ -183,7 +183,9 @@ notmuch_config_list_valid (notmuch_config_list_t *metadata) return true; } -static inline char * _key_from_iterator (notmuch_config_list_t *list) { +static inline char * +_key_from_iterator (notmuch_config_list_t *list) +{ return talloc_strdup (list, (*list->iterator).c_str () + CONFIG_PREFIX.length ()); } @@ -239,7 +241,7 @@ _notmuch_config_load_from_database (notmuch_database_t *notmuch) if (notmuch->config == NULL) notmuch->config = _notmuch_string_map_create (notmuch); - if (unlikely(notmuch->config == NULL)) + if (unlikely (notmuch->config == NULL)) return NOTMUCH_STATUS_OUT_OF_MEMORY; status = notmuch_database_get_config_list (notmuch, "", &list); @@ -267,7 +269,7 @@ notmuch_config_get_values (notmuch_database_t *notmuch, notmuch_config_key_t key goto DONE; values = talloc (notmuch, notmuch_config_values_t); - if (unlikely(! values)) + if (unlikely (! values)) goto DONE; values->children = talloc_new (values); @@ -279,17 +281,18 @@ notmuch_config_get_values (notmuch_database_t *notmuch, notmuch_config_key_t key values->iterator = strsplit_len (values->string, ';', &(values->tok_len)); ok = true; - DONE: - if (!ok) { + DONE: + if (! ok) { if (values) - talloc_free(values); + talloc_free (values); return NULL; } return values; } notmuch_bool_t -notmuch_config_values_valid (notmuch_config_values_t *values) { +notmuch_config_values_valid (notmuch_config_values_t *values) +{ if (! values) return false; @@ -297,12 +300,14 @@ notmuch_config_values_valid (notmuch_config_values_t *values) { } const char * -notmuch_config_values_get (notmuch_config_values_t *values) { +notmuch_config_values_get (notmuch_config_values_t *values) +{ return talloc_strndup (values, values->iterator, values->tok_len); } void -notmuch_config_values_start (notmuch_config_values_t *values) { +notmuch_config_values_start (notmuch_config_values_t *values) +{ if (values == NULL) return; if (values->children) { @@ -315,13 +320,15 @@ notmuch_config_values_start (notmuch_config_values_t *values) { } void -notmuch_config_values_move_to_next (notmuch_config_values_t *values) { +notmuch_config_values_move_to_next (notmuch_config_values_t *values) +{ values->iterator += values->tok_len; values->iterator = strsplit_len (values->iterator, ';', &(values->tok_len)); } void -notmuch_config_values_destroy (notmuch_config_values_t *values) { +notmuch_config_values_destroy (notmuch_config_values_t *values) +{ talloc_free (values); } @@ -335,16 +342,16 @@ _notmuch_config_load_from_file (notmuch_database_t *notmuch, if (notmuch->config == NULL) notmuch->config = _notmuch_string_map_create (notmuch); - if (unlikely(notmuch->config == NULL)) { + if (unlikely (notmuch->config == NULL)) { status = NOTMUCH_STATUS_OUT_OF_MEMORY; goto DONE; } groups = g_key_file_get_groups (file, NULL); - for (gchar **grp=groups; *grp; grp++) { + for (gchar **grp = groups; *grp; grp++) { keys = g_key_file_get_keys (file, *grp, NULL, NULL); for (gchar **keys_p = keys; *keys_p; keys_p++) { - char *absolute_key = talloc_asprintf(notmuch, "%s.%s", *grp, *keys_p); + char *absolute_key = talloc_asprintf (notmuch, "%s.%s", *grp, *keys_p); val = g_key_file_get_value (file, *grp, *keys_p, NULL); if (! val) { status = NOTMUCH_STATUS_FILE_ERROR; @@ -359,7 +366,7 @@ _notmuch_config_load_from_file (notmuch_database_t *notmuch, g_strfreev (keys); } - DONE: + DONE: if (groups) g_strfreev (groups); @@ -393,7 +400,8 @@ notmuch_config_get_bool (notmuch_database_t *notmuch, notmuch_config_key_t key, } static const char * -_notmuch_config_key_to_string (notmuch_config_key_t key) { +_notmuch_config_key_to_string (notmuch_config_key_t key) +{ switch (key) { case NOTMUCH_CONFIG_DATABASE_PATH: return "database.path"; @@ -419,7 +427,8 @@ _notmuch_config_key_to_string (notmuch_config_key_t key) { } static const char * -_notmuch_config_default (void *ctx, notmuch_config_key_t key) { +_notmuch_config_default (void *ctx, notmuch_config_key_t key) +{ char *path; switch (key) { @@ -446,15 +455,17 @@ _notmuch_config_default (void *ctx, notmuch_config_key_t key) { default: case NOTMUCH_CONFIG_LAST: INTERNAL_ERROR ("illegal key enum %d", key); - } + } } notmuch_status_t -_notmuch_config_load_defaults (notmuch_database_t *notmuch) { +_notmuch_config_load_defaults (notmuch_database_t *notmuch) +{ notmuch_config_key_t key; + for (key = NOTMUCH_CONFIG_FIRST; key < NOTMUCH_CONFIG_LAST; - key = notmuch_config_key_t(key + 1)) { + key = notmuch_config_key_t (key + 1)) { const char *val = notmuch_config_get (notmuch, key); const char *key_string = _notmuch_config_key_to_string (key); @@ -467,18 +478,21 @@ _notmuch_config_load_defaults (notmuch_database_t *notmuch) { } const char * -notmuch_config_get (notmuch_database_t *notmuch, notmuch_config_key_t key) { +notmuch_config_get (notmuch_database_t *notmuch, notmuch_config_key_t key) +{ return _notmuch_string_map_get (notmuch->config, _notmuch_config_key_to_string (key)); } notmuch_status_t -notmuch_config_set (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val) { +notmuch_config_set (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val) +{ return notmuch_database_set_config (notmuch, _notmuch_config_key_to_string (key), val); } void -_notmuch_config_cache (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val) { +_notmuch_config_cache (notmuch_database_t *notmuch, notmuch_config_key_t key, const char *val) +{ _notmuch_string_map_set (notmuch->config, _notmuch_config_key_to_string (key), val); } diff --git a/lib/database.cc b/lib/database.cc index f96ba7c0..b4e536b9 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -49,7 +49,8 @@ typedef struct { #define LOG_XAPIAN_EXCEPTION(message, error) _log_xapian_exception (__location__, message, error) static void -_log_xapian_exception (const char *where, notmuch_database_t *notmuch, const Xapian::Error error) { +_log_xapian_exception (const char *where, notmuch_database_t *notmuch, const Xapian::Error error) +{ _notmuch_database_log (notmuch, "A Xapian exception occurred at %s: %s\n", where, @@ -627,10 +628,11 @@ notmuch_status_t notmuch_database_compact_db (notmuch_database_t *notmuch, const char *backup_path, notmuch_compact_status_cb_t status_cb, - void *closure) { + void *closure) +{ void *local; char *notmuch_path, *xapian_path, *compact_xapian_path; - const char* path; + const char *path; notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS; struct stat statbuf; bool keep_backup; @@ -840,8 +842,8 @@ handle_sigalrm (unused (int signal)) */ notmuch_status_t notmuch_database_upgrade (notmuch_database_t *notmuch, - void (*progress_notify) (void *closure, - double progress), + void (*progress_notify)(void *closure, + double progress), void *closure) { void *local = talloc_new (NULL); diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index 750a242c..e47badbc 100644 --- a/lib/notmuch-private.h +++ b/lib/notmuch-private.h @@ -123,21 +123,21 @@ typedef enum { typedef enum _notmuch_private_status { /* First, copy all the public status values. */ - NOTMUCH_PRIVATE_STATUS_SUCCESS = NOTMUCH_STATUS_SUCCESS, - NOTMUCH_PRIVATE_STATUS_OUT_OF_MEMORY = NOTMUCH_STATUS_OUT_OF_MEMORY, - NOTMUCH_PRIVATE_STATUS_READ_ONLY_DATABASE = NOTMUCH_STATUS_READ_ONLY_DATABASE, - NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION = NOTMUCH_STATUS_XAPIAN_EXCEPTION, - NOTMUCH_PRIVATE_STATUS_FILE_ERROR = NOTMUCH_STATUS_FILE_ERROR, - NOTMUCH_PRIVATE_STATUS_FILE_NOT_EMAIL = NOTMUCH_STATUS_FILE_NOT_EMAIL, - NOTMUCH_PRIVATE_STATUS_NULL_POINTER = NOTMUCH_STATUS_NULL_POINTER, - NOTMUCH_PRIVATE_STATUS_TAG_TOO_LONG = NOTMUCH_STATUS_TAG_TOO_LONG, - NOTMUCH_PRIVATE_STATUS_UNBALANCED_FREEZE_THAW = NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW, - NOTMUCH_PRIVATE_STATUS_UNBALANCED_ATOMIC = NOTMUCH_STATUS_UNBALANCED_ATOMIC, - NOTMUCH_PRIVATE_STATUS_UNSUPPORTED_OPERATION = NOTMUCH_STATUS_UNSUPPORTED_OPERATION, - NOTMUCH_PRIVATE_STATUS_UPGRADE_REQUIRED = NOTMUCH_STATUS_UPGRADE_REQUIRED, - NOTMUCH_PRIVATE_STATUS_PATH_ERROR = NOTMUCH_STATUS_PATH_ERROR, - NOTMUCH_PRIVATE_STATUS_IGNORED = NOTMUCH_STATUS_IGNORED, - NOTMUCH_PRIVATE_STATUS_ILLEGAL_ARGUMENT = NOTMUCH_STATUS_ILLEGAL_ARGUMENT, + NOTMUCH_PRIVATE_STATUS_SUCCESS = NOTMUCH_STATUS_SUCCESS, + NOTMUCH_PRIVATE_STATUS_OUT_OF_MEMORY = NOTMUCH_STATUS_OUT_OF_MEMORY, + NOTMUCH_PRIVATE_STATUS_READ_ONLY_DATABASE = NOTMUCH_STATUS_READ_ONLY_DATABASE, + NOTMUCH_PRIVATE_STATUS_XAPIAN_EXCEPTION = NOTMUCH_STATUS_XAPIAN_EXCEPTION, + NOTMUCH_PRIVATE_STATUS_FILE_ERROR = NOTMUCH_STATUS_FILE_ERROR, + NOTMUCH_PRIVATE_STATUS_FILE_NOT_EMAIL = NOTMUCH_STATUS_FILE_NOT_EMAIL, + NOTMUCH_PRIVATE_STATUS_NULL_POINTER = NOTMUCH_STATUS_NULL_POINTER, + NOTMUCH_PRIVATE_STATUS_TAG_TOO_LONG = NOTMUCH_STATUS_TAG_TOO_LONG, + NOTMUCH_PRIVATE_STATUS_UNBALANCED_FREEZE_THAW = NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW, + NOTMUCH_PRIVATE_STATUS_UNBALANCED_ATOMIC = NOTMUCH_STATUS_UNBALANCED_ATOMIC, + NOTMUCH_PRIVATE_STATUS_UNSUPPORTED_OPERATION = NOTMUCH_STATUS_UNSUPPORTED_OPERATION, + NOTMUCH_PRIVATE_STATUS_UPGRADE_REQUIRED = NOTMUCH_STATUS_UPGRADE_REQUIRED, + NOTMUCH_PRIVATE_STATUS_PATH_ERROR = NOTMUCH_STATUS_PATH_ERROR, + NOTMUCH_PRIVATE_STATUS_IGNORED = NOTMUCH_STATUS_IGNORED, + NOTMUCH_PRIVATE_STATUS_ILLEGAL_ARGUMENT = NOTMUCH_STATUS_ILLEGAL_ARGUMENT, NOTMUCH_PRIVATE_STATUS_MALFORMED_CRYPTO_PROTOCOL = NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL, NOTMUCH_PRIVATE_STATUS_FAILED_CRYPTO_CONTEXT_CREATION = NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION, NOTMUCH_PRIVATE_STATUS_UNKNOWN_CRYPTO_PROTOCOL = NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL, @@ -145,7 +145,7 @@ typedef enum _notmuch_private_status { NOTMUCH_PRIVATE_STATUS_DATABASE_EXISTS = NOTMUCH_STATUS_DATABASE_EXISTS, /* Then add our own private values. */ - NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG = NOTMUCH_STATUS_LAST_STATUS, + NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG = NOTMUCH_STATUS_LAST_STATUS, NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND, NOTMUCH_PRIVATE_STATUS_BAD_PREFIX, @@ -716,16 +716,16 @@ struct _notmuch_indexopts { /* config.cc */ notmuch_status_t -_notmuch_config_load_from_database (notmuch_database_t * db); +_notmuch_config_load_from_database (notmuch_database_t *db); notmuch_status_t -_notmuch_config_load_from_file (notmuch_database_t * db, GKeyFile *file); +_notmuch_config_load_from_file (notmuch_database_t *db, GKeyFile *file); notmuch_status_t -_notmuch_config_load_defaults (notmuch_database_t * db); +_notmuch_config_load_defaults (notmuch_database_t *db); void -_notmuch_config_cache (notmuch_database_t *db, notmuch_config_key_t key, const char* val); +_notmuch_config_cache (notmuch_database_t *db, notmuch_config_key_t key, const char *val); NOTMUCH_END_DECLS diff --git a/lib/notmuch.h b/lib/notmuch.h index 5a5d99c0..70f4f517 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -1631,7 +1631,7 @@ typedef enum _notmuch_message_flag { * @deprecated Deprecated as of libnotmuch 5.3 (notmuch 0.31). Please * use notmuch_message_get_flag_st instead. */ -NOTMUCH_DEPRECATED(5,3) +NOTMUCH_DEPRECATED (5, 3) notmuch_bool_t notmuch_message_get_flag (notmuch_message_t *message, notmuch_message_flag_t flag); @@ -1826,7 +1826,7 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message); * @returns FALSE in case of error * @deprecated libnotmuch 5.3 (notmuch 0.31) */ -NOTMUCH_DEPRECATED(5, 3) +NOTMUCH_DEPRECATED (5, 3) notmuch_bool_t notmuch_message_has_maildir_flag (notmuch_message_t *message, char flag); diff --git a/lib/open.cc b/lib/open.cc index a5211746..5336a93f 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -85,7 +85,7 @@ _choose_hook_dir (notmuch_database_t *notmuch, config = _xdg_dir (notmuch, "XDG_CONFIG_HOME", ".config", profile); if (! config) - return NOTMUCH_STATUS_PATH_ERROR; + return NOTMUCH_STATUS_PATH_ERROR; hook_dir = talloc_asprintf (notmuch, "%s/hooks", config); @@ -125,7 +125,7 @@ _load_key_file (const char *path, if (dir) { path = talloc_asprintf (local, "%s/config", dir); - if (access (path, R_OK) !=0) + if (access (path, R_OK) != 0) path = NULL; } } @@ -147,7 +147,7 @@ _load_key_file (const char *path, status = NOTMUCH_STATUS_NO_CONFIG; } -DONE: + DONE: talloc_free (local); return status; } @@ -162,14 +162,14 @@ _choose_database_path (void *ctx, { notmuch_status_t status; - status =_load_key_file (config_path, profile, key_file); + status = _load_key_file (config_path, profile, key_file); if (status) { *message = strdup ("Error: cannot load config file.\n"); return status; } if (! *database_path && *key_file) { - char *path = g_key_file_get_value (*key_file, "database", "path", NULL); + char *path = g_key_file_get_value (*key_file, "database", "path", NULL); if (path) { *database_path = talloc_strdup (ctx, path); g_free (path); @@ -207,7 +207,8 @@ notmuch_database_open_with_config (const char *database_path, GKeyFile *key_file = NULL; static int initialized = 0; - if ((status = _choose_database_path (local, config_path, profile, &key_file, &database_path, &message))) + if ((status = _choose_database_path (local, config_path, profile, + &key_file, &database_path, &message))) goto DONE; if (! (notmuch_path = talloc_asprintf (local, "%s/%s", database_path, ".notmuch"))) { @@ -434,7 +435,8 @@ notmuch_database_create_with_config (const char *database_path, int err; void *local = talloc_new (NULL); - if ((status = _choose_database_path (local, config_path, profile, &key_file, &database_path, &message))) + if ((status = _choose_database_path (local, config_path, profile, + &key_file, &database_path, &message))) goto DONE; err = stat (database_path, &st); diff --git a/lib/prefix.cc b/lib/prefix.cc index 71a76991..0d92bdd7 100644 --- a/lib/prefix.cc +++ b/lib/prefix.cc @@ -133,8 +133,8 @@ _setup_query_field (const prefix_t *prefix, notmuch_database_t *notmuch) Xapian::FieldProcessor *fp; if (STRNCMP_LITERAL (prefix->name, "date") == 0) - fp = (new DateFieldProcessor(NOTMUCH_VALUE_TIMESTAMP))->release (); - else if (STRNCMP_LITERAL(prefix->name, "query") == 0) + fp = (new DateFieldProcessor (NOTMUCH_VALUE_TIMESTAMP))->release (); + else if (STRNCMP_LITERAL (prefix->name, "query") == 0) fp = (new QueryFieldProcessor (*notmuch->query_parser, notmuch))->release (); else if (STRNCMP_LITERAL (prefix->name, "thread") == 0) fp = (new ThreadFieldProcessor (*notmuch->query_parser, notmuch))->release (); diff --git a/lib/string-map.c b/lib/string-map.c index 71eac634..e3a81b4f 100644 --- a/lib/string-map.c +++ b/lib/string-map.c @@ -154,10 +154,10 @@ _notmuch_string_map_set (notmuch_string_map_t *map, _notmuch_string_map_sort (map); pair = bsearch_first (map->pairs, map->length, key, true); if (! pair) - _notmuch_string_map_append (map, key, val); + _notmuch_string_map_append (map, key, val); else { - talloc_free (pair->value); - pair->value = talloc_strdup (map->pairs, val); + talloc_free (pair->value); + pair->value = talloc_strdup (map->pairs, val); } } diff --git a/notmuch-client.h b/notmuch-client.h index f60f5406..354a115e 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -505,7 +505,7 @@ print_status_gzbytes (const char *loc, /* the __location__ macro is defined in talloc.h */ #define ASSERT_GZBYTES(file, bytes) ((print_status_gzbytes (__location__, file, bytes)) ? exit (1) : 0) #define GZPRINTF(file, fmt, ...) ASSERT_GZBYTES (file, gzprintf (file, fmt, ##__VA_ARGS__)); -#define GZPUTS(file, str) ASSERT_GZBYTES(file, gzputs (file, str)); +#define GZPUTS(file, str) ASSERT_GZBYTES (file, gzputs (file, str)); #include "command-line-arguments.h" diff --git a/notmuch-config.c b/notmuch-config.c index 0193401f..1a865681 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -510,7 +510,9 @@ notmuch_config_close (notmuch_config_t *config) talloc_free (config); } -const char *_notmuch_config_get_path (notmuch_config_t *config) { +const char * +_notmuch_config_get_path (notmuch_config_t *config) +{ return config->filename; } /* Save any changes made to the notmuch configuration. diff --git a/notmuch-count.c b/notmuch-count.c index 048b1f44..8cedc18e 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -86,12 +86,12 @@ print_count (notmuch_database_t *notmuch, const char *query_str, status = notmuch_query_add_tag_exclude (query, notmuch_config_values_get (exclude_tags)); - if (status && status != NOTMUCH_STATUS_IGNORED) { - print_status_query ("notmuch count", query, status); - ret = -1; - goto DONE; - } + if (status && status != NOTMUCH_STATUS_IGNORED) { + print_status_query ("notmuch count", query, status); + ret = -1; + goto DONE; } + } switch (output) { case OUTPUT_MESSAGES: diff --git a/notmuch-dump.c b/notmuch-dump.c index d7017929..9da39ac4 100644 --- a/notmuch-dump.c +++ b/notmuch-dump.c @@ -339,7 +339,7 @@ notmuch_database_dump (notmuch_database_t *notmuch, output = NULL; goto DONE; } else - output = NULL; + output = NULL; if (output_file_name) { ret = rename (tempname, output_file_name); @@ -361,7 +361,7 @@ notmuch_database_dump (notmuch_database_t *notmuch, } int -notmuch_dump_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch , int argc, char *argv[]) +notmuch_dump_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[]) { const char *query_str = NULL; int ret; diff --git a/notmuch-insert.c b/notmuch-insert.c index 0f272e2e..00505552 100644 --- a/notmuch-insert.c +++ b/notmuch-insert.c @@ -444,7 +444,7 @@ add_file (notmuch_database_t *notmuch, const char *path, tag_op_list_t *tag_ops, } int -notmuch_insert_command (unused(notmuch_config_t *config),notmuch_database_t *notmuch, int argc, char *argv[]) +notmuch_insert_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[]) { notmuch_status_t status, close_status; struct sigaction action; diff --git a/notmuch-new.c b/notmuch-new.c index 21e66af1..e0590a57 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -1043,7 +1043,8 @@ print_results (const add_files_state_t *state) } static int -_maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state) { +_maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state) +{ if (notmuch_database_needs_upgrade (notmuch)) { time_t now = time (NULL); struct tm *gm_time = gmtime (&now); @@ -1155,7 +1156,7 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu for (notmuch_config_values_start (add_files_state.new_tags); notmuch_config_values_valid (add_files_state.new_tags); notmuch_config_values_move_to_next (add_files_state.new_tags)) { - const char *tag,*error_msg; + const char *tag, *error_msg; tag = notmuch_config_values_get (add_files_state.new_tags); error_msg = illegal_tag (tag, false); diff --git a/notmuch-restore.c b/notmuch-restore.c index ce07f89d..d3eea903 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -360,6 +360,7 @@ notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *n } char *p; + for (p = line; (input_format == DUMP_FORMAT_AUTO) && *p; p++) { if (*p == '(') input_format = DUMP_FORMAT_SUP; diff --git a/notmuch-show.c b/notmuch-show.c index c3c42caa..2c474682 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -80,14 +80,16 @@ _get_disposition (GMimeObject *meta) return g_mime_content_disposition_get_disposition (disposition); } -static bool _get_message_flag (notmuch_message_t *message, notmuch_message_flag_t flag) { +static bool +_get_message_flag (notmuch_message_t *message, notmuch_message_flag_t flag) +{ notmuch_bool_t is_set; notmuch_status_t status; status = notmuch_message_get_flag_st (message, flag, &is_set); if (print_status_message ("notmuch show", message, status)) - INTERNAL_ERROR("unexpected error getting message flag\n"); + INTERNAL_ERROR ("unexpected error getting message flag\n"); return is_set; } @@ -438,6 +440,7 @@ format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist) } int i; + for (i = 0; i < g_mime_signature_list_length (siglist); i++) { GMimeSignature *signature = g_mime_signature_list_get_signature (siglist, i); @@ -1157,9 +1160,9 @@ do_show_unthreaded (void *ctx, notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH, TRUE); excluded = _get_message_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED); - if (!excluded || !params->omit_excluded) { + if (! excluded || ! params->omit_excluded) { status = show_message (ctx, format, sp, message, 0, params); - if (status && !res) + if (status && ! res) res = status; } else { sp->null (sp); @@ -1325,6 +1328,7 @@ notmuch_show_command (notmuch_config_t *config, unused(notmuch_database_t *notmu } notmuch_database_mode_t mode = NOTMUCH_DATABASE_MODE_READ_ONLY; + if (params.crypto.decrypt == NOTMUCH_DECRYPT_TRUE) mode = NOTMUCH_DATABASE_MODE_READ_WRITE; if (notmuch_database_open_with_config (NULL, diff --git a/util/string-util.c b/util/string-util.c index 27f8a26b..9c46a81a 100644 --- a/util/string-util.c +++ b/util/string-util.c @@ -53,7 +53,7 @@ strsplit_len (const char *s, char delim, size_t *len) count++; } - if (count==0) + if (count == 0) return NULL; *len = count; @@ -183,6 +183,7 @@ parse_boolean_term (void *ctx, const char *str, /* Parse prefix */ str = skip_space (str); const char *pos = strchr (str, ':'); + if (! pos || pos == str) goto FAIL; *prefix_out = talloc_strndup (ctx, str, pos - str); -- 2.30.1