From: Richard Russon Date: Wed, 7 Aug 2019 20:27:52 +0000 (+0100) Subject: rename local variable rv to rc X-Git-Tag: 2019-10-25~97^2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4547411b57a0fed08a8fb825b6e8b8a1a023653f;p=neomutt rename local variable rv to rc --- diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c index d5ec9cbb9..84502e124 100644 --- a/autocrypt/autocrypt.c +++ b/autocrypt/autocrypt.c @@ -41,7 +41,7 @@ static int autocrypt_dir_init(int can_create) { - int rv = 0; + int rc = 0; struct stat sb; struct Buffer *prompt = NULL; @@ -67,12 +67,12 @@ static int autocrypt_dir_init(int can_create) error message returned by libc */ mutt_error(_("Can't create %s: %s."), C_AutocryptDir, strerror(errno)); - rv = -1; + rc = -1; } } mutt_buffer_pool_release(&prompt); - return rv; + return rc; } int mutt_autocrypt_init(int can_create) @@ -226,7 +226,7 @@ int mutt_autocrypt_process_autocrypt_header(struct Email *e, struct Envelope *en struct AutocryptPeerHistory *peerhist = NULL; struct Buffer *keyid = NULL; int update_db = 0, insert_db = 0, insert_db_history = 0, import_gpg = 0; - int rv = -1; + int rc = -1; if (!C_Autocrypt) return 0; @@ -280,7 +280,7 @@ int mutt_autocrypt_process_autocrypt_header(struct Email *e, struct Envelope *en { if (e->date_sent <= peer->autocrypt_timestamp) { - rv = 0; + rc = 0; goto cleanup; } @@ -312,7 +312,7 @@ int mutt_autocrypt_process_autocrypt_header(struct Email *e, struct Envelope *en if (!(import_gpg || insert_db || update_db)) { - rv = 0; + rc = 0; goto cleanup; } @@ -349,14 +349,14 @@ int mutt_autocrypt_process_autocrypt_header(struct Email *e, struct Envelope *en goto cleanup; } - rv = 0; + rc = 0; cleanup: mutt_autocrypt_db_peer_free(&peer); mutt_autocrypt_db_peer_history_free(&peerhist); mutt_buffer_pool_release(&keyid); - return rv; + return rc; } int mutt_autocrypt_process_gossip_header(struct Email *hdr, struct Envelope *prot_headers) @@ -370,7 +370,7 @@ int mutt_autocrypt_process_gossip_header(struct Email *hdr, struct Envelope *pro struct Address ac_hdr_addr = { 0 }; struct Buffer *keyid = NULL; int update_db = 0, insert_db = 0, insert_db_history = 0, import_gpg = 0; - int rv = -1; + int rc = -1; if (!C_Autocrypt) return 0; @@ -493,7 +493,7 @@ int mutt_autocrypt_process_gossip_header(struct Email *hdr, struct Envelope *pro update_db = insert_db = insert_db_history = import_gpg = 0; } - rv = 0; + rc = 0; cleanup: FREE(&ac_hdr_addr.mailbox); @@ -502,7 +502,7 @@ cleanup: mutt_autocrypt_db_gossip_history_free(&gossip_hist); mutt_buffer_pool_release(&keyid); - return rv; + return rc; } /* Returns the recommendation. If the recommendataion is > NO and @@ -511,7 +511,7 @@ cleanup: */ enum AutocryptRec mutt_autocrypt_ui_recommendation(struct Email *hdr, char **keylist) { - enum AutocryptRec rv = AUTOCRYPT_REC_OFF; + enum AutocryptRec rc = AUTOCRYPT_REC_OFF; struct AutocryptAccount *account = NULL; struct AutocryptPeer *peer = NULL; struct Address *recip = NULL; @@ -544,7 +544,7 @@ enum AutocryptRec mutt_autocrypt_ui_recommendation(struct Email *hdr, char **key mutt_addrlist_copy(&recips, &hdr->env->cc, false); mutt_addrlist_copy(&recips, &hdr->env->bcc, false); - rv = AUTOCRYPT_REC_NO; + rc = AUTOCRYPT_REC_NO; if (TAILQ_EMPTY(&recips)) goto cleanup; @@ -598,11 +598,11 @@ enum AutocryptRec mutt_autocrypt_ui_recommendation(struct Email *hdr, char **key } if (all_encrypt) - rv = AUTOCRYPT_REC_YES; + rc = AUTOCRYPT_REC_YES; else if (has_discourage) - rv = AUTOCRYPT_REC_DISCOURAGE; + rc = AUTOCRYPT_REC_DISCOURAGE; else - rv = AUTOCRYPT_REC_AVAILABLE; + rc = AUTOCRYPT_REC_AVAILABLE; if (keylist) mutt_str_replace(keylist, mutt_b2s(keylist_buf)); @@ -612,12 +612,12 @@ cleanup: mutt_addrlist_clear(&recips); mutt_autocrypt_db_peer_free(&peer); mutt_buffer_pool_release(&keylist_buf); - return rv; + return rc; } int mutt_autocrypt_set_sign_as_default_key(struct Email *hdr) { - int rv = -1; + int rc = -1; struct AutocryptAccount *account = NULL; if (!C_Autocrypt || mutt_autocrypt_init(0) || !hdr) @@ -637,11 +637,11 @@ int mutt_autocrypt_set_sign_as_default_key(struct Email *hdr) mutt_str_replace(&AutocryptSignAs, account->keyid); mutt_str_replace(&AutocryptDefaultKey, account->keyid); - rv = 0; + rc = 0; cleanup: mutt_autocrypt_db_account_free(&account); - return rv; + return rc; } static void write_autocrypt_header_line(FILE *fp, const char *addr, @@ -670,7 +670,7 @@ static void write_autocrypt_header_line(FILE *fp, const char *addr, int mutt_autocrypt_write_autocrypt_header(struct Envelope *env, FILE *fp) { - int rv = -1; + int rc = -1; struct AutocryptAccount *account = NULL; if (!C_Autocrypt || mutt_autocrypt_init(0) || !env) @@ -691,11 +691,11 @@ int mutt_autocrypt_write_autocrypt_header(struct Envelope *env, FILE *fp) write_autocrypt_header_line(fp, account->email_addr, account->prefer_encrypt, account->keydata); - rv = 0; + rc = 0; cleanup: mutt_autocrypt_db_account_free(&account); - return rv; + return rc; } int mutt_autocrypt_write_gossip_headers(struct Envelope *env, FILE *fp) @@ -716,7 +716,7 @@ int mutt_autocrypt_write_gossip_headers(struct Envelope *env, FILE *fp) int mutt_autocrypt_generate_gossip_list(struct Email *hdr) { - int rv = -1; + int rc = -1; struct AutocryptPeer *peer = NULL; struct AutocryptAccount *account = NULL; struct Address *recip = NULL; @@ -794,7 +794,7 @@ int mutt_autocrypt_generate_gossip_list(struct Email *hdr) mutt_addrlist_clear(&recips); mutt_autocrypt_db_account_free(&account); mutt_autocrypt_db_peer_free(&peer); - return rv; + return rc; } /* This is invoked during the first autocrypt initialization, diff --git a/autocrypt/autocrypt_db.c b/autocrypt/autocrypt_db.c index dce2a304b..89e1424c7 100644 --- a/autocrypt/autocrypt_db.c +++ b/autocrypt/autocrypt_db.c @@ -59,7 +59,7 @@ static int autocrypt_db_create(const char *db_path) int mutt_autocrypt_db_init(int can_create) { - int rv = -1; + int rc = -1; struct Buffer *db_path = NULL; struct stat sb; @@ -98,11 +98,11 @@ int mutt_autocrypt_db_init(int can_create) goto cleanup; } - rv = 0; + rc = 0; cleanup: mutt_buffer_pool_release(&db_path); - return rv; + return rc; } void mutt_autocrypt_db_close(void) @@ -208,7 +208,7 @@ void mutt_autocrypt_db_account_free(struct AutocryptAccount **account) int mutt_autocrypt_db_account_get(struct Address *addr, struct AutocryptAccount **account) { - int rv = -1, result; + int rc = -1, result; struct Address *norm_addr = NULL; norm_addr = copy_normalize_addr(addr); @@ -236,7 +236,7 @@ int mutt_autocrypt_db_account_get(struct Address *addr, struct AutocryptAccount if (result != SQLITE_ROW) { if (result == SQLITE_DONE) - rv = 0; + rc = 0; goto cleanup; } @@ -247,18 +247,18 @@ int mutt_autocrypt_db_account_get(struct Address *addr, struct AutocryptAccount (*account)->prefer_encrypt = sqlite3_column_int(AccountGetStmt, 3); (*account)->enabled = sqlite3_column_int(AccountGetStmt, 4); - rv = 1; + rc = 1; cleanup: mutt_addr_free(&norm_addr); sqlite3_reset(AccountGetStmt); - return rv; + return rc; } int mutt_autocrypt_db_account_insert(struct Address *addr, const char *keyid, const char *keydata, int prefer_encrypt) { - int rv = -1; + int rc = -1; struct Address *norm_addr = NULL; norm_addr = copy_normalize_addr(addr); @@ -291,17 +291,17 @@ int mutt_autocrypt_db_account_insert(struct Address *addr, const char *keyid, if (sqlite3_step(AccountInsertStmt) != SQLITE_DONE) goto cleanup; - rv = 0; + rc = 0; cleanup: mutt_addr_free(&norm_addr); sqlite3_reset(AccountInsertStmt); - return rv; + return rc; } int mutt_autocrypt_db_account_update(struct AutocryptAccount *acct) { - int rv = -1; + int rc = -1; if (!AccountUpdateStmt) { @@ -330,16 +330,16 @@ int mutt_autocrypt_db_account_update(struct AutocryptAccount *acct) if (sqlite3_step(AccountUpdateStmt) != SQLITE_DONE) goto cleanup; - rv = 0; + rc = 0; cleanup: sqlite3_reset(AccountUpdateStmt); - return rv; + return rc; } int mutt_autocrypt_db_account_delete(struct AutocryptAccount *acct) { - int rv = -1; + int rc = -1; if (!AccountDeleteStmt) { @@ -356,16 +356,16 @@ int mutt_autocrypt_db_account_delete(struct AutocryptAccount *acct) if (sqlite3_step(AccountDeleteStmt) != SQLITE_DONE) goto cleanup; - rv = 0; + rc = 0; cleanup: sqlite3_reset(AccountDeleteStmt); - return rv; + return rc; } int mutt_autocrypt_db_account_get_all(struct AutocryptAccount ***accounts, int *num_accounts) { - int rv = -1, result; + int rc = -1, result; sqlite3_stmt *stmt = NULL; struct AutocryptAccount **results = NULL, *account; int results_len = 0, results_count = 0; @@ -407,7 +407,7 @@ int mutt_autocrypt_db_account_get_all(struct AutocryptAccount ***accounts, int * if (result == SQLITE_DONE) { *accounts = results; - rv = *num_accounts = results_count; + rc = *num_accounts = results_count; } else { @@ -418,7 +418,7 @@ int mutt_autocrypt_db_account_get_all(struct AutocryptAccount ***accounts, int * cleanup: sqlite3_finalize(stmt); - return rv; + return rc; } struct AutocryptPeer *mutt_autocrypt_db_peer_new(void) @@ -440,7 +440,7 @@ void mutt_autocrypt_db_peer_free(struct AutocryptPeer **peer) int mutt_autocrypt_db_peer_get(struct Address *addr, struct AutocryptPeer **peer) { - int rv = -1, result; + int rc = -1, result; struct Address *norm_addr = NULL; norm_addr = copy_normalize_addr(addr); @@ -472,7 +472,7 @@ int mutt_autocrypt_db_peer_get(struct Address *addr, struct AutocryptPeer **peer if (result != SQLITE_ROW) { if (result == SQLITE_DONE) - rv = 0; + rc = 0; goto cleanup; } @@ -487,17 +487,17 @@ int mutt_autocrypt_db_peer_get(struct Address *addr, struct AutocryptPeer **peer (*peer)->gossip_keyid = strdup_column_text(PeerGetStmt, 7); (*peer)->gossip_keydata = strdup_column_text(PeerGetStmt, 8); - rv = 1; + rc = 1; cleanup: mutt_addr_free(&norm_addr); sqlite3_reset(PeerGetStmt); - return rv; + return rc; } int mutt_autocrypt_db_peer_insert(struct Address *addr, struct AutocryptPeer *peer) { - int rv = -1; + int rc = -1; struct Address *norm_addr = NULL; norm_addr = copy_normalize_addr(addr); @@ -542,17 +542,17 @@ int mutt_autocrypt_db_peer_insert(struct Address *addr, struct AutocryptPeer *pe if (sqlite3_step(PeerInsertStmt) != SQLITE_DONE) goto cleanup; - rv = 0; + rc = 0; cleanup: mutt_addr_free(&norm_addr); sqlite3_reset(PeerInsertStmt); - return rv; + return rc; } int mutt_autocrypt_db_peer_update(struct AutocryptPeer *peer) { - int rv = -1; + int rc = -1; if (!PeerUpdateStmt) { @@ -593,11 +593,11 @@ int mutt_autocrypt_db_peer_update(struct AutocryptPeer *peer) if (sqlite3_step(PeerUpdateStmt) != SQLITE_DONE) goto cleanup; - rv = 0; + rc = 0; cleanup: sqlite3_reset(PeerUpdateStmt); - return rv; + return rc; } struct AutocryptPeerHistory *mutt_autocrypt_db_peer_history_new(void) @@ -618,7 +618,7 @@ void mutt_autocrypt_db_peer_history_free(struct AutocryptPeerHistory **peerhist) int mutt_autocrypt_db_peer_history_insert(struct Address *addr, struct AutocryptPeerHistory *peerhist) { - int rv = -1; + int rc = -1; struct Address *norm_addr = NULL; norm_addr = copy_normalize_addr(addr); @@ -650,12 +650,12 @@ int mutt_autocrypt_db_peer_history_insert(struct Address *addr, if (sqlite3_step(PeerHistoryInsertStmt) != SQLITE_DONE) goto cleanup; - rv = 0; + rc = 0; cleanup: mutt_addr_free(&norm_addr); sqlite3_reset(PeerHistoryInsertStmt); - return rv; + return rc; } struct AutocryptGossipHistory *mutt_autocrypt_db_gossip_history_new(void) @@ -677,7 +677,7 @@ void mutt_autocrypt_db_gossip_history_free(struct AutocryptGossipHistory **gossi int mutt_autocrypt_db_gossip_history_insert(struct Address *addr, struct AutocryptGossipHistory *gossip_hist) { - int rv = -1; + int rc = -1; struct Address *norm_addr = NULL; norm_addr = copy_normalize_addr(addr); @@ -714,10 +714,10 @@ int mutt_autocrypt_db_gossip_history_insert(struct Address *addr, if (sqlite3_step(GossipHistoryInsertStmt) != SQLITE_DONE) goto cleanup; - rv = 0; + rc = 0; cleanup: mutt_addr_free(&norm_addr); sqlite3_reset(GossipHistoryInsertStmt); - return rv; + return rc; } diff --git a/autocrypt/autocrypt_gpgme.c b/autocrypt/autocrypt_gpgme.c index 48c440fb2..59f8d8f5e 100644 --- a/autocrypt/autocrypt_gpgme.c +++ b/autocrypt/autocrypt_gpgme.c @@ -53,7 +53,7 @@ int mutt_autocrypt_gpgme_init(void) static int export_keydata(gpgme_ctx_t ctx, gpgme_key_t key, struct Buffer *keydata) { - int rv = -1; + int rc = -1; gpgme_data_t dh = NULL; gpgme_key_t export_keys[2]; size_t export_data_len; @@ -79,17 +79,17 @@ static int export_keydata(gpgme_ctx_t ctx, gpgme_key_t key, struct Buffer *keyda gpgme_free(export_data); export_data = NULL; - rv = 0; + rc = 0; cleanup: gpgme_data_release(dh); - return rv; + return rc; } /* TODO: not sure if this function will be useful in the future. */ int mutt_autocrypt_gpgme_export_key(const char *keyid, struct Buffer *keydata) { - int rv = -1; + int rc = -1; gpgme_ctx_t ctx = NULL; gpgme_key_t key = NULL; @@ -102,17 +102,17 @@ int mutt_autocrypt_gpgme_export_key(const char *keyid, struct Buffer *keydata) if (export_keydata(ctx, key, keydata)) goto cleanup; - rv = 0; + rc = 0; cleanup: gpgme_key_unref(key); gpgme_release(ctx); - return rv; + return rc; } int mutt_autocrypt_gpgme_create_key(struct Address *addr, struct Buffer *keyid, struct Buffer *keydata) { - int rv = -1; + int rc = -1; gpgme_ctx_t ctx = NULL; gpgme_error_t err; gpgme_genkey_result_t keyresult; @@ -171,17 +171,17 @@ int mutt_autocrypt_gpgme_create_key(struct Address *addr, struct Buffer *keyid, goto cleanup; mutt_debug(LL_DEBUG1, "key has keydata *%s*\n", mutt_b2s(keydata)); - rv = 0; + rc = 0; cleanup: gpgme_key_unref(primary_key); gpgme_release(ctx); - return rv; + return rc; } int mutt_autocrypt_gpgme_import_key(const char *keydata, struct Buffer *keyid) { - int rv = -1; + int rc = -1; gpgme_ctx_t ctx = NULL; struct Buffer *raw_keydata = NULL; gpgme_data_t dh = NULL; @@ -205,18 +205,18 @@ int mutt_autocrypt_gpgme_import_key(const char *keydata, struct Buffer *keyid) goto cleanup; mutt_buffer_strcpy(keyid, result->imports->fpr); - rv = 0; + rc = 0; cleanup: gpgme_data_release(dh); gpgme_release(ctx); mutt_buffer_pool_release(&raw_keydata); - return rv; + return rc; } int mutt_autocrypt_gpgme_is_valid_key(const char *keyid) { - int rv = 0; + int rc = 0; gpgme_ctx_t ctx = NULL; gpgme_key_t key = NULL; @@ -229,12 +229,12 @@ int mutt_autocrypt_gpgme_is_valid_key(const char *keyid) if (gpgme_get_key(ctx, keyid, &key, 0)) goto cleanup; - rv = 1; + rc = 1; if (key->revoked || key->expired || key->disabled || key->invalid || !key->can_encrypt) - rv = 0; + rc = 0; cleanup: gpgme_key_unref(key); gpgme_release(ctx); - return rv; + return rc; } diff --git a/autocrypt/autocrypt_schema.c b/autocrypt/autocrypt_schema.c index 8c2617d08..c6dc41b41 100644 --- a/autocrypt/autocrypt_schema.c +++ b/autocrypt/autocrypt_schema.c @@ -91,7 +91,7 @@ int mutt_autocrypt_schema_init(void) int mutt_autocrypt_schema_update(void) { sqlite3_stmt *stmt = NULL; - int rv = -1, version; + int rc = -1, version; if (sqlite3_prepare_v2(AutocryptDB, "SELECT version FROM schema;", -1, &stmt, NULL) != SQLITE_OK) goto cleanup; @@ -116,9 +116,9 @@ int mutt_autocrypt_schema_update(void) /* TODO: schema version upgrades go here. * Bump one by one, each update inside a transaction. */ - rv = 0; + rc = 0; cleanup: sqlite3_finalize(stmt); - return rv; + return rc; }