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 <dkg@fifthhorseman.net>
This commit is contained in:
Daniel Kahn Gillmor 2019-05-02 09:19:41 -04:00 committed by David Bremner
parent 591a0787c2
commit b7ac4c05e1
10 changed files with 11 additions and 19 deletions

View file

@ -528,12 +528,11 @@ _index_encrypted_mime_part (notmuch_message_t *message,
notmuch = notmuch_message_get_database (message); notmuch = notmuch_message_get_database (message);
GMimeCryptoContext* crypto_ctx = NULL;
bool attempted = false; bool attempted = false;
GMimeDecryptResult *decrypt_result = NULL; GMimeDecryptResult *decrypt_result = NULL;
bool get_sk = (notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE); bool get_sk = (notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
clear = _notmuch_crypto_decrypt (&attempted, notmuch_indexopts_get_decrypt_policy (indexopts), 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) if (!attempted)
return; return;
if (err || !clear) { if (err || !clear) {

View file

@ -170,8 +170,7 @@ set_signature_list_destructor (mime_node_t *node)
/* Verify a signed mime node */ /* Verify a signed mime node */
static void static void
node_verify (mime_node_t *node, GMimeObject *part, node_verify (mime_node_t *node, GMimeObject *part)
g_mime_3_unused(GMimeCryptoContext *cryptoctx))
{ {
GError *err = NULL; GError *err = NULL;
@ -191,8 +190,7 @@ node_verify (mime_node_t *node, GMimeObject *part,
/* Decrypt and optionally verify an encrypted mime node */ /* Decrypt and optionally verify an encrypted mime node */
static void static void
node_decrypt_and_verify (mime_node_t *node, GMimeObject *part, node_decrypt_and_verify (mime_node_t *node, GMimeObject *part)
g_mime_3_unused(GMimeCryptoContext *cryptoctx))
{ {
GError *err = NULL; GError *err = NULL;
GMimeDecryptResult *decrypt_result = 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->decrypted_child = _notmuch_crypto_decrypt (&node->decrypt_attempted,
node->ctx->crypto->decrypt, node->ctx->crypto->decrypt,
message, message,
cryptoctx, encrypteddata, &decrypt_result, &err); encrypteddata, &decrypt_result, &err);
} }
if (! node->decrypted_child) { if (! node->decrypted_child) {
fprintf (stderr, "Failed to decrypt part: %s\n", 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_create (mime_node_t *parent, GMimeObject *part)
{ {
mime_node_t *node = talloc_zero (parent, mime_node_t); mime_node_t *node = talloc_zero (parent, mime_node_t);
GMimeCryptoContext *cryptoctx = NULL;
/* Set basic node properties */ /* Set basic node properties */
node->part = part; node->part = part;
@ -290,7 +287,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
"message (must be exactly 2)\n", "message (must be exactly 2)\n",
node->nchildren); node->nchildren);
} else { } 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) { } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify) {
if (node->nchildren != 2) { if (node->nchildren != 2) {
@ -299,7 +296,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
"(must be exactly 2)\n", "(must be exactly 2)\n",
node->nchildren); node->nchildren);
} else { } else {
node_verify (node, part, cryptoctx); node_verify (node, part);
} }
} }

View file

@ -506,6 +506,6 @@ struct _notmuch_client_indexing_cli_choices {
extern struct _notmuch_client_indexing_cli_choices indexing_cli_choices; extern struct _notmuch_client_indexing_cli_choices indexing_cli_choices;
extern const notmuch_opt_desc_t notmuch_shared_indexing_options []; extern const notmuch_opt_desc_t notmuch_shared_indexing_options [];
notmuch_status_t 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 #endif

View file

@ -550,7 +550,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
notmuch_exit_if_unmatched_db_uuid (notmuch); 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) { if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n", fprintf (stderr, "Error: Failed to process index options. (%s)\n",
notmuch_status_to_string (status)); notmuch_status_to_string (status));

View file

@ -1198,7 +1198,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
if (notmuch == NULL) if (notmuch == NULL)
return EXIT_FAILURE; return EXIT_FAILURE;
status = notmuch_process_shared_indexing_options (notmuch, config); status = notmuch_process_shared_indexing_options (notmuch);
if (status != NOTMUCH_STATUS_SUCCESS) { if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n", fprintf (stderr, "Error: Failed to process index options. (%s)\n",
notmuch_status_to_string (status)); notmuch_status_to_string (status));

View file

@ -117,7 +117,7 @@ notmuch_reindex_command (notmuch_config_t *config, int argc, char *argv[])
notmuch_exit_if_unmatched_db_uuid (notmuch); 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) { if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n", fprintf (stderr, "Error: Failed to process index options. (%s)\n",
notmuch_status_to_string (status)); notmuch_status_to_string (status));

View file

@ -112,7 +112,7 @@ const notmuch_opt_desc_t notmuch_shared_indexing_options [] = {
notmuch_status_t 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) if (indexing_cli_choices.opts == NULL)
indexing_cli_choices.opts = notmuch_database_get_default_indexopts (notmuch); indexing_cli_choices.opts = notmuch_database_get_default_indexopts (notmuch);

View file

@ -32,7 +32,6 @@ GMimeObject *
_notmuch_crypto_decrypt (bool *attempted, _notmuch_crypto_decrypt (bool *attempted,
notmuch_decryption_policy_t decrypt, notmuch_decryption_policy_t decrypt,
notmuch_message_t *message, notmuch_message_t *message,
g_mime_3_unused(GMimeCryptoContext* crypto_ctx),
GMimeMultipartEncrypted *part, GMimeMultipartEncrypted *part,
GMimeDecryptResult **decrypt_result, GMimeDecryptResult **decrypt_result,
GError **err) GError **err)

View file

@ -18,7 +18,6 @@ GMimeObject *
_notmuch_crypto_decrypt (bool *attempted, _notmuch_crypto_decrypt (bool *attempted,
notmuch_decryption_policy_t decrypt, notmuch_decryption_policy_t decrypt,
notmuch_message_t *message, notmuch_message_t *message,
GMimeCryptoContext* crypto_ctx,
GMimeMultipartEncrypted *part, GMimeMultipartEncrypted *part,
GMimeDecryptResult **decrypt_result, GMimeDecryptResult **decrypt_result,
GError **err); GError **err);

View file

@ -34,8 +34,6 @@ typedef GMimeAddressType GMimeRecipientType;
typedef GMimeSignatureStatus GMimeSignatureError; typedef GMimeSignatureStatus GMimeSignatureError;
#define g_mime_3_unused(arg) unused(arg)
/** /**
* Get last 16 hex digits of fingerprint ("keyid") * Get last 16 hex digits of fingerprint ("keyid")
*/ */