From b7ac4c05e118047442378f58eeb69d43bd1cbdb1 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Thu, 2 May 2019 09:19:41 -0400 Subject: [PATCH] gmime-cleanup: drop all arguments unused in GMime 3 This means dropping GMimeCryptoContext and notmuch_config arguments. All the argument changes are to internal functions, so this is not an API or ABI break. We also get to drop the #define for g_mime_3_unused. signed-off-by: Daniel Kahn Gillmor --- lib/index.cc | 3 +-- mime-node.c | 13 +++++-------- notmuch-client.h | 2 +- notmuch-insert.c | 2 +- notmuch-new.c | 2 +- notmuch-reindex.c | 2 +- notmuch.c | 2 +- util/crypto.c | 1 - util/crypto.h | 1 - util/gmime-extra.h | 2 -- 10 files changed, 11 insertions(+), 19 deletions(-) diff --git a/lib/index.cc b/lib/index.cc index 76830921..f21761d0 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -528,12 +528,11 @@ _index_encrypted_mime_part (notmuch_message_t *message, notmuch = notmuch_message_get_database (message); - GMimeCryptoContext* crypto_ctx = NULL; 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, crypto_ctx, encrypted_data, get_sk ? &decrypt_result : NULL, &err); + message, encrypted_data, get_sk ? &decrypt_result : NULL, &err); if (!attempted) return; if (err || !clear) { diff --git a/mime-node.c b/mime-node.c index 95dc5132..19744f43 100644 --- a/mime-node.c +++ b/mime-node.c @@ -170,8 +170,7 @@ set_signature_list_destructor (mime_node_t *node) /* Verify a signed mime node */ static void -node_verify (mime_node_t *node, GMimeObject *part, - g_mime_3_unused(GMimeCryptoContext *cryptoctx)) +node_verify (mime_node_t *node, GMimeObject *part) { GError *err = NULL; @@ -191,8 +190,7 @@ node_verify (mime_node_t *node, GMimeObject *part, /* Decrypt and optionally verify an encrypted mime node */ static void -node_decrypt_and_verify (mime_node_t *node, GMimeObject *part, - g_mime_3_unused(GMimeCryptoContext *cryptoctx)) +node_decrypt_and_verify (mime_node_t *node, GMimeObject *part) { GError *err = NULL; GMimeDecryptResult *decrypt_result = NULL; @@ -209,7 +207,7 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part, node->decrypted_child = _notmuch_crypto_decrypt (&node->decrypt_attempted, node->ctx->crypto->decrypt, message, - cryptoctx, encrypteddata, &decrypt_result, &err); + encrypteddata, &decrypt_result, &err); } if (! node->decrypted_child) { fprintf (stderr, "Failed to decrypt part: %s\n", @@ -249,7 +247,6 @@ static mime_node_t * _mime_node_create (mime_node_t *parent, GMimeObject *part) { mime_node_t *node = talloc_zero (parent, mime_node_t); - GMimeCryptoContext *cryptoctx = NULL; /* Set basic node properties */ node->part = part; @@ -290,7 +287,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part) "message (must be exactly 2)\n", node->nchildren); } else { - node_decrypt_and_verify (node, part, cryptoctx); + node_decrypt_and_verify (node, part); } } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify) { if (node->nchildren != 2) { @@ -299,7 +296,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part) "(must be exactly 2)\n", node->nchildren); } else { - node_verify (node, part, cryptoctx); + node_verify (node, part); } } diff --git a/notmuch-client.h b/notmuch-client.h index fba28242..d762d3cc 100644 --- a/notmuch-client.h +++ b/notmuch-client.h @@ -506,6 +506,6 @@ struct _notmuch_client_indexing_cli_choices { extern struct _notmuch_client_indexing_cli_choices indexing_cli_choices; extern const notmuch_opt_desc_t notmuch_shared_indexing_options []; notmuch_status_t -notmuch_process_shared_indexing_options (notmuch_database_t *notmuch, notmuch_config_t *config); +notmuch_process_shared_indexing_options (notmuch_database_t *notmuch); #endif diff --git a/notmuch-insert.c b/notmuch-insert.c index d229c9dc..327470d4 100644 --- a/notmuch-insert.c +++ b/notmuch-insert.c @@ -550,7 +550,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[]) notmuch_exit_if_unmatched_db_uuid (notmuch); - status = notmuch_process_shared_indexing_options (notmuch, config); + status = notmuch_process_shared_indexing_options (notmuch); if (status != NOTMUCH_STATUS_SUCCESS) { fprintf (stderr, "Error: Failed to process index options. (%s)\n", notmuch_status_to_string (status)); diff --git a/notmuch-new.c b/notmuch-new.c index 6a54a1a1..184e9aa2 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -1198,7 +1198,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]) if (notmuch == NULL) return EXIT_FAILURE; - status = notmuch_process_shared_indexing_options (notmuch, config); + status = notmuch_process_shared_indexing_options (notmuch); if (status != NOTMUCH_STATUS_SUCCESS) { fprintf (stderr, "Error: Failed to process index options. (%s)\n", notmuch_status_to_string (status)); diff --git a/notmuch-reindex.c b/notmuch-reindex.c index fefa7c63..3139a8c6 100644 --- a/notmuch-reindex.c +++ b/notmuch-reindex.c @@ -117,7 +117,7 @@ notmuch_reindex_command (notmuch_config_t *config, int argc, char *argv[]) notmuch_exit_if_unmatched_db_uuid (notmuch); - status = notmuch_process_shared_indexing_options (notmuch, config); + status = notmuch_process_shared_indexing_options (notmuch); if (status != NOTMUCH_STATUS_SUCCESS) { fprintf (stderr, "Error: Failed to process index options. (%s)\n", notmuch_status_to_string (status)); diff --git a/notmuch.c b/notmuch.c index c11e4cb1..de85041b 100644 --- a/notmuch.c +++ b/notmuch.c @@ -112,7 +112,7 @@ const notmuch_opt_desc_t notmuch_shared_indexing_options [] = { notmuch_status_t -notmuch_process_shared_indexing_options (notmuch_database_t *notmuch, g_mime_3_unused(notmuch_config_t *config)) +notmuch_process_shared_indexing_options (notmuch_database_t *notmuch) { if (indexing_cli_choices.opts == NULL) indexing_cli_choices.opts = notmuch_database_get_default_indexopts (notmuch); diff --git a/util/crypto.c b/util/crypto.c index 8104263d..ba67d4f4 100644 --- a/util/crypto.c +++ b/util/crypto.c @@ -32,7 +32,6 @@ GMimeObject * _notmuch_crypto_decrypt (bool *attempted, notmuch_decryption_policy_t decrypt, notmuch_message_t *message, - g_mime_3_unused(GMimeCryptoContext* crypto_ctx), GMimeMultipartEncrypted *part, GMimeDecryptResult **decrypt_result, GError **err) diff --git a/util/crypto.h b/util/crypto.h index dbb333eb..af3998e8 100644 --- a/util/crypto.h +++ b/util/crypto.h @@ -18,7 +18,6 @@ GMimeObject * _notmuch_crypto_decrypt (bool *attempted, notmuch_decryption_policy_t decrypt, notmuch_message_t *message, - GMimeCryptoContext* crypto_ctx, GMimeMultipartEncrypted *part, GMimeDecryptResult **decrypt_result, GError **err); diff --git a/util/gmime-extra.h b/util/gmime-extra.h index c17fa8fb..60ae8765 100644 --- a/util/gmime-extra.h +++ b/util/gmime-extra.h @@ -34,8 +34,6 @@ typedef GMimeAddressType GMimeRecipientType; typedef GMimeSignatureStatus GMimeSignatureError; -#define g_mime_3_unused(arg) unused(arg) - /** * Get last 16 hex digits of fingerprint ("keyid") */ -- 2.43.0