From 1fb24c49e7cc82ad5d9644aaf9a129c71f790b2c Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Thu, 28 Feb 2019 17:14:42 +0000 Subject: [PATCH] return result --- imap/imap.c | 14 +++++++------- keymap.c | 6 +++--- mbox/mbox.c | 6 +++--- menu.c | 20 ++++++++++---------- mutt/string.c | 6 +++--- ncrypt/pgp.c | 10 +++++----- ncrypt/smime.c | 12 ++++++------ notmuch/mutt_notmuch.c | 10 +++++----- sidebar.c | 26 +++++++++++++------------- 9 files changed, 55 insertions(+), 55 deletions(-) diff --git a/imap/imap.c b/imap/imap.c index 3556a4160..84c5a25ff 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1203,7 +1203,7 @@ int imap_check_mailbox(struct Mailbox *m, bool force) /* overload keyboard timeout to avoid many mailbox checks in a row. * Most users don't like having to wait exactly when they press a key. */ - int result = 0; + int rc = 0; /* try IDLE first, unless force is set */ if (!force && C_ImapIdle && (adata->capabilities & IMAP_CAP_IDLE) && @@ -1214,7 +1214,7 @@ int imap_check_mailbox(struct Mailbox *m, bool force) } if (adata->state == IMAP_IDLE) { - while ((result = mutt_socket_poll(adata->conn, 0)) > 0) + while ((rc = mutt_socket_poll(adata->conn, 0)) > 0) { if (imap_cmd_step(adata) != IMAP_CMD_CONTINUE) { @@ -1222,7 +1222,7 @@ int imap_check_mailbox(struct Mailbox *m, bool force) return -1; } } - if (result < 0) + if (rc < 0) { mutt_debug(LL_DEBUG1, "Poll failed, disabling IDLE\n"); adata->capabilities &= ~IMAP_CAP_IDLE; // Clear the flag @@ -1240,15 +1240,15 @@ int imap_check_mailbox(struct Mailbox *m, bool force) imap_cmd_finish(adata); if (mdata->check_status & IMAP_EXPUNGE_PENDING) - result = MUTT_REOPENED; + rc = MUTT_REOPENED; else if (mdata->check_status & IMAP_NEWMAIL_PENDING) - result = MUTT_NEW_MAIL; + rc = MUTT_NEW_MAIL; else if (mdata->check_status & IMAP_FLAGS_PENDING) - result = MUTT_FLAGS; + rc = MUTT_FLAGS; mdata->check_status = IMAP_OPEN_NO_FLAGS; - return result; + return rc; } /** diff --git a/keymap.c b/keymap.c index ee3428e72..a3a7de992 100644 --- a/keymap.c +++ b/keymap.c @@ -287,7 +287,7 @@ static size_t parsekeys(const char *str, keycode_t *d, size_t max) static enum CommandResult km_bind_err(const char *s, int menu, int op, char *macro, char *desc, struct Buffer *err) { - enum CommandResult retval = MUTT_CMD_SUCCESS; + enum CommandResult rc = MUTT_CMD_SUCCESS; struct Keymap *last = NULL, *next = NULL; keycode_t buf[MAX_SEQ]; size_t pos = 0, lastpos = 0; @@ -335,7 +335,7 @@ static enum CommandResult km_bind_err(const char *s, int menu, int op, "https://neomutt.org/guide/configuration.html#bind-warnings"), old_binding, new_binding, mutt_map_get_name(menu, Menus), new_binding); } - retval = MUTT_CMD_WARNING; + rc = MUTT_CMD_WARNING; } len = tmp->eq; next = tmp->next; @@ -377,7 +377,7 @@ static enum CommandResult km_bind_err(const char *s, int menu, int op, Keymaps[menu] = map; } - return retval; + return rc; } /** diff --git a/mbox/mbox.c b/mbox/mbox.c index ad768a2ce..d43163d66 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -808,7 +808,7 @@ static bool test_last_status_new(FILE *fp) { struct Email *e = NULL; struct Envelope *tmp_envelope = NULL; - bool result = false; + bool rc = false; if (fseek_last_message(fp) == -1) return false; @@ -816,12 +816,12 @@ static bool test_last_status_new(FILE *fp) e = mutt_email_new(); tmp_envelope = mutt_rfc822_read_header(fp, e, false, false); if (!(e->read || e->old)) - result = true; + rc = true; mutt_env_free(&tmp_envelope); mutt_email_free(&e); - return result; + return rc; } /** diff --git a/menu.c b/menu.c index 5d1185f82..c49075a47 100644 --- a/menu.c +++ b/menu.c @@ -1142,7 +1142,7 @@ void mutt_menu_current_redraw(void) */ static int menu_search(struct Menu *menu, int op) { - int r = 0, wrap = 0; + int rc = 0, wrap = 0; int search_dir; regex_t re; char buf[128]; @@ -1176,34 +1176,34 @@ static int menu_search(struct Menu *menu, int op) if (search_buf) { int flags = mutt_mb_is_lower(search_buf) ? REG_ICASE : 0; - r = REGCOMP(&re, search_buf, REG_NOSUB | flags); + rc = REGCOMP(&re, search_buf, REG_NOSUB | flags); } - if (r != 0) + if (rc != 0) { - regerror(r, &re, buf, sizeof(buf)); + regerror(rc, &re, buf, sizeof(buf)); mutt_error("%s", buf); return -1; } - r = menu->current + search_dir; + rc = menu->current + search_dir; search_next: if (wrap) mutt_message(_("Search wrapped to top")); - while (r >= 0 && r < menu->max) + while (rc >= 0 && rc < menu->max) { - if (menu->menu_search(menu, &re, r) == 0) + if (menu->menu_search(menu, &re, rc) == 0) { regfree(&re); - return r; + return rc; } - r += search_dir; + rc += search_dir; } if (C_WrapSearch && wrap++ == 0) { - r = search_dir == 1 ? 0 : menu->max - 1; + rc = search_dir == 1 ? 0 : menu->max - 1; goto search_next; } regfree(&re); diff --git a/mutt/string.c b/mutt/string.c index d3c725bef..598705597 100644 --- a/mutt/string.c +++ b/mutt/string.c @@ -1090,17 +1090,17 @@ bool mutt_str_inline_replace(char *buf, size_t buflen, size_t xlen, const char * */ int mutt_str_remall_strcasestr(char *str, const char *target) { - int retval = 1; + int rc = 1; // Look through an ensure all instances of the substring are gone. while ((str = (char *) mutt_str_strcasestr(str, target))) { size_t target_len = mutt_str_strlen(target); memmove(str, str + target_len, 1 + strlen(str + target_len)); - retval = 0; // If we got here, then a substring existed and has been removed. + rc = 0; // If we got here, then a substring existed and has been removed. } - return retval; + return rc; } /** diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 6fecb0133..e4c3ecfa6 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -350,7 +350,7 @@ static int pgp_check_pgp_decryption_okay_regex(FILE *fp_in) */ static int pgp_check_decryption_okay(FILE *fp_in) { - int rv = -1; + int rc = -1; char *line = NULL, *s = NULL; int lineno = 0; size_t linelen; @@ -376,14 +376,14 @@ static int pgp_check_decryption_okay(FILE *fp_in) { mutt_debug(LL_DEBUG2, "\tPLAINTEXT encountered outside of DECRYPTION.\n"); - rv = -2; + rc = -2; break; } } else if (mutt_str_startswith(s, "DECRYPTION_FAILED", CASE_MATCH)) { mutt_debug(LL_DEBUG2, "\tDECRYPTION_FAILED encountered. Failure.\n"); - rv = -3; + rc = -3; break; } else if (mutt_str_startswith(s, "DECRYPTION_OKAY", CASE_MATCH)) @@ -391,12 +391,12 @@ static int pgp_check_decryption_okay(FILE *fp_in) /* Don't break out because we still have to check for * PLAINTEXT outside of the decryption boundaries. */ mutt_debug(LL_DEBUG2, "\tDECRYPTION_OKAY encountered.\n"); - rv = 0; + rc = 0; } } FREE(&line); - return rv; + return rc; } /** diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 1b6ba0dcf..fd0be733b 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -1429,7 +1429,7 @@ void smime_class_invoke_import(char *infile, char *mailbox) int smime_class_verify_sender(struct Email *e) { char *mbox = NULL, *certfile = NULL, tempfname[PATH_MAX]; - int retval = 1; + int rc = 1; mutt_mktemp(tempfname, sizeof(tempfname)); FILE *fp_out = mutt_file_fopen(tempfname, "w"); @@ -1473,7 +1473,7 @@ int smime_class_verify_sender(struct Email *e) mutt_any_key_to_continue(NULL); } else - retval = 0; + rc = 0; mutt_file_unlink(certfile); FREE(&certfile); } @@ -1484,7 +1484,7 @@ int smime_class_verify_sender(struct Email *e) mutt_any_key_to_continue(_("no mbox")); mutt_file_unlink(tempfname); - return retval; + return rc; } /* @@ -2307,7 +2307,7 @@ bail: */ int smime_class_application_handler(struct Body *m, struct State *s) { - int rv = -1; + int rc = -1; /* clear out any mime headers before the handler, so they can't be spoofed. */ mutt_env_free(&m->mime_headers); @@ -2315,10 +2315,10 @@ int smime_class_application_handler(struct Body *m, struct State *s) struct Body *tattach = smime_handle_entity(m, s, NULL); if (tattach) { - rv = 0; + rc = 0; mutt_body_free(&tattach); } - return rv; + return rc; } /** diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index f272ee73c..3533c2118 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -1781,7 +1781,7 @@ bool nm_message_is_still_queried(struct Mailbox *m, struct Email *e) return false; char *new_str = NULL; - bool result = false; + bool rc = false; if (safe_asprintf(&new_str, "id:%s and (%s)", email_get_id(e), orig_str) < 0) return false; @@ -1798,7 +1798,7 @@ bool nm_message_is_still_queried(struct Mailbox *m, struct Email *e) if (!messages) return false; - result = notmuch_messages_valid(messages); + rc = notmuch_messages_valid(messages); notmuch_messages_destroy(messages); break; } @@ -1809,7 +1809,7 @@ bool nm_message_is_still_queried(struct Mailbox *m, struct Email *e) if (!threads) return false; - result = notmuch_threads_valid(threads); + rc = notmuch_threads_valid(threads); notmuch_threads_destroy(threads); break; } @@ -1818,9 +1818,9 @@ bool nm_message_is_still_queried(struct Mailbox *m, struct Email *e) notmuch_query_destroy(q); mutt_debug(LL_DEBUG2, "nm: checking if message is still queried: %s = %s\n", - new_str, result ? "true" : "false"); + new_str, rc ? "true" : "false"); - return result; + return rc; } /** diff --git a/sidebar.c b/sidebar.c index 4d2b9cc99..63cfbd586 100644 --- a/sidebar.c +++ b/sidebar.c @@ -301,44 +301,44 @@ static int cb_qsort_sbe(const void *a, const void *b) struct Mailbox *m1 = sbe1->mailbox; struct Mailbox *m2 = sbe2->mailbox; - int result = 0; + int rc = 0; switch ((C_SidebarSortMethod & SORT_MASK)) { case SORT_COUNT: if (m2->msg_count == m1->msg_count) - result = mutt_str_strcoll(m1->path, m2->path); + rc = mutt_str_strcoll(m1->path, m2->path); else - result = (m2->msg_count - m1->msg_count); + rc = (m2->msg_count - m1->msg_count); break; case SORT_UNREAD: if (m2->msg_unread == m1->msg_unread) - result = mutt_str_strcoll(m1->path, m2->path); + rc = mutt_str_strcoll(m1->path, m2->path); else - result = (m2->msg_unread - m1->msg_unread); + rc = (m2->msg_unread - m1->msg_unread); break; case SORT_DESC: - result = mutt_str_strcmp(m1->desc, m2->desc); + rc = mutt_str_strcmp(m1->desc, m2->desc); break; case SORT_FLAGGED: if (m2->msg_flagged == m1->msg_flagged) - result = mutt_str_strcoll(m1->path, m2->path); + rc = mutt_str_strcoll(m1->path, m2->path); else - result = (m2->msg_flagged - m1->msg_flagged); + rc = (m2->msg_flagged - m1->msg_flagged); break; case SORT_PATH: { - result = mutt_inbox_cmp(m1->path, m2->path); - if (result == 0) - result = mutt_str_strcoll(m1->path, m2->path); + rc = mutt_inbox_cmp(m1->path, m2->path); + if (rc == 0) + rc = mutt_str_strcoll(m1->path, m2->path); break; } } if (C_SidebarSortMethod & SORT_REVERSE) - result = -result; + rc = -rc; - return result; + return rc; } /** -- 2.40.0