diff options
| author | David Bremner <david@tethera.net> | 2021-06-12 10:26:17 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-10-23 09:51:50 -0300 |
| commit | 2ce6c76a61c907b5d1d508e12255e83d9256937c (patch) | |
| tree | fcb1e35acb341eeaccfdd387fe214b5ba8dab9e6 /notmuch.c | |
| parent | c128c995bc3e7474d4086af7e2066f60f54329b2 (diff) | |
CLI: move indexopts variable out of shared options block
This reduces the amount of global state. Furthermore, index options
can be set (in principle) in several ways, not just in the one
function for processing indexing command line options.
Diffstat (limited to 'notmuch.c')
| -rw-r--r-- | notmuch.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -141,21 +141,18 @@ const notmuch_opt_desc_t notmuch_shared_indexing_options [] = { notmuch_status_t -notmuch_process_shared_indexing_options (notmuch_database_t *notmuch) +notmuch_process_shared_indexing_options (notmuch_indexopts_t *opts) { - if (indexing_cli_choices.opts == NULL) - indexing_cli_choices.opts = notmuch_database_get_default_indexopts (notmuch); + if (opts == NULL) + return NOTMUCH_STATUS_NULL_POINTER; + if (indexing_cli_choices.decrypt_policy_set) { 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, + status = notmuch_indexopts_set_decrypt_policy (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)); - notmuch_indexopts_destroy (indexing_cli_choices.opts); - indexing_cli_choices.opts = NULL; return status; } } |
