From: Richard Russon Date: Fri, 24 Nov 2017 15:39:49 +0000 (+0000) Subject: rename variables: ret -> rc X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81c0337d15de1697122061046a555bcd1b4293ba;p=neomutt rename variables: ret -> rc --- diff --git a/attach.c b/attach.c index 061ddb991..3e2223386 100644 --- a/attach.c +++ b/attach.c @@ -898,7 +898,7 @@ int mutt_decode_save_attachment(FILE *fp, struct Body *m, char *path, int displa unsigned int saved_encoding = 0; struct Body *saved_parts = NULL; struct Header *saved_hdr = NULL; - int ret = 0; + int rc = 0; memset(&s, 0, sizeof(s)); s.flags = displaying; @@ -960,7 +960,7 @@ int mutt_decode_save_attachment(FILE *fp, struct Body *m, char *path, int displa if (mutt_file_fsync_close(&s.fpout) != 0) { mutt_perror("fclose"); - ret = -1; + rc = -1; } if (!fp) { @@ -975,7 +975,7 @@ int mutt_decode_save_attachment(FILE *fp, struct Body *m, char *path, int displa mutt_file_fclose(&s.fpin); } - return ret; + return rc; } /** diff --git a/charset.c b/charset.c index 3353f0299..8530469e6 100644 --- a/charset.c +++ b/charset.c @@ -370,7 +370,7 @@ size_t mutt_iconv(iconv_t cd, ICONV_CONST char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft, ICONV_CONST char **inrepls, const char *outrepl) { - size_t ret = 0, ret1; + size_t rc = 0, ret1; ICONV_CONST char *ib = *inbuf; size_t ibl = *inbytesleft; char *ob = *outbuf; @@ -380,7 +380,7 @@ size_t mutt_iconv(iconv_t cd, ICONV_CONST char **inbuf, size_t *inbytesleft, { ret1 = iconv(cd, &ib, &ibl, &ob, &obl); if (ret1 != (size_t) -1) - ret += ret1; + rc += ret1; if (ibl && obl && errno == EILSEQ) { if (inrepls) @@ -400,7 +400,7 @@ size_t mutt_iconv(iconv_t cd, ICONV_CONST char **inbuf, size_t *inbytesleft, ibl--; ob = ob1; obl = obl1; - ret++; + rc++; break; } } @@ -424,7 +424,7 @@ size_t mutt_iconv(iconv_t cd, ICONV_CONST char **inbuf, size_t *inbytesleft, ibl--; ob += n; obl -= n; - ret++; + rc++; iconv(cd, 0, 0, 0, 0); /* for good measure */ continue; } @@ -433,7 +433,7 @@ size_t mutt_iconv(iconv_t cd, ICONV_CONST char **inbuf, size_t *inbytesleft, *inbytesleft = ibl; *outbuf = ob; *outbytesleft = obl; - return ret; + return rc; } } diff --git a/conn/getdomain.c b/conn/getdomain.c index 6418b5190..ccbf2eac1 100644 --- a/conn/getdomain.c +++ b/conn/getdomain.c @@ -49,12 +49,12 @@ */ int getdnsdomainname(char *d, size_t len) { - int ret = -1; + int rc = -1; #if defined(HAVE_GETADDRINFO) || defined(HAVE_GETADDRINFO_A) char node[STRING]; if (gethostname(node, sizeof(node))) - return ret; + return rc; struct addrinfo hints; struct addrinfo *h = NULL; @@ -109,12 +109,12 @@ int getdnsdomainname(char *d, size_t len) if (h != NULL && h->ai_canonname && (p = strchr(h->ai_canonname, '.'))) { mutt_str_strfcpy(d, ++p, len); - ret = 0; + rc = 0; mutt_debug(1, "getdnsdomainname(): %s\n", d); freeaddrinfo(h); } #endif /* HAVE_GETADDRINFO || defined HAVE_GETADDRINFO_A */ - return ret; + return rc; } diff --git a/conn/ssl.c b/conn/ssl.c index d64142fdf..bdd3a2715 100644 --- a/conn/ssl.c +++ b/conn/ssl.c @@ -418,12 +418,12 @@ static int ssl_socket_close(struct Connection *conn) */ static char *x509_get_part(X509_NAME *name, int nid) { - static char ret[SHORT_STRING]; + static char data[SHORT_STRING]; - if (!name || X509_NAME_get_text_by_NID(name, nid, ret, sizeof(ret)) < 0) - mutt_str_strfcpy(ret, _("Unknown"), sizeof(ret)); + if (!name || X509_NAME_get_text_by_NID(name, nid, data, sizeof(data)) < 0) + mutt_str_strfcpy(data, _("Unknown"), sizeof(data)); - return ret; + return data; } /** diff --git a/conn/ssl_gnutls.c b/conn/ssl_gnutls.c index 4e3e8811e..fcbff0f7c 100644 --- a/conn/ssl_gnutls.c +++ b/conn/ssl_gnutls.c @@ -118,7 +118,7 @@ static int tls_init(void) static int tls_socket_read(struct Connection *conn, char *buf, size_t len) { struct TlsSockData *data = conn->sockdata; - int ret; + int rc; if (!data) { @@ -129,16 +129,16 @@ static int tls_socket_read(struct Connection *conn, char *buf, size_t len) do { - ret = gnutls_record_recv(data->state, buf, len); - if ((ret < 0 && gnutls_error_is_fatal(ret) == 1) || ret == GNUTLS_E_INTERRUPTED) + rc = gnutls_record_recv(data->state, buf, len); + if ((rc < 0 && gnutls_error_is_fatal(rc) == 1) || rc == GNUTLS_E_INTERRUPTED) { - mutt_error("tls_socket_read (%s)", gnutls_strerror(ret)); + mutt_error("tls_socket_read (%s)", gnutls_strerror(rc)); mutt_sleep(2); return -1; } - } while (ret == GNUTLS_E_AGAIN); + } while (rc == GNUTLS_E_AGAIN); - return ret; + return rc; } /** diff --git a/hcache/hcache.c b/hcache/hcache.c index b9ed2ea1e..0a5d8d3aa 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -584,10 +584,10 @@ static const char *hcache_per_folder(const char *path, const char *folder, hcach struct stat sb; int plen = mutt_str_strlen(path); - int ret = stat(path, &sb); + int rc = stat(path, &sb); int slash = (path[plen - 1] == '/'); - if (((ret == 0) && !S_ISDIR(sb.st_mode)) || ((ret == -1) && !slash)) + if (((rc == 0) && !S_ISDIR(sb.st_mode)) || ((rc == -1) && !slash)) { /* An existing file or a non-existing path not ending with a slash */ snprintf(hcpath, sizeof(hcpath), "%s%s", path, suffix); @@ -603,7 +603,7 @@ static const char *hcache_per_folder(const char *path, const char *folder, hcach if (!slash) plen++; - ret = namer(folder, hcpath + plen, sizeof(hcpath) - plen); + rc = namer(folder, hcpath + plen, sizeof(hcpath) - plen); } else { @@ -616,10 +616,10 @@ static const char *hcache_per_folder(const char *path, const char *folder, hcach m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11], m[12], m[13], m[14], m[15]); - ret = snprintf(hcpath, sizeof(hcpath), "%s%s%s%s", path, slash ? "" : "/", name, suffix); + rc = snprintf(hcpath, sizeof(hcpath), "%s%s%s%s", path, slash ? "" : "/", name, suffix); } - if (ret < 0) /* namer or fprintf failed.. should not happen */ + if (rc < 0) /* namer or fprintf failed.. should not happen */ return path; create_hcache_dir(hcpath); diff --git a/ncrypt/crypt.c b/ncrypt/crypt.c index b1c68c4d1..59d7731d3 100644 --- a/ncrypt/crypt.c +++ b/ncrypt/crypt.c @@ -115,19 +115,19 @@ static void disable_coredumps(void) */ int crypt_valid_passphrase(int flags) { - int ret = 0; + int rc = 0; #if !defined(DEBUG) disable_coredumps(); #endif if ((WithCrypto & APPLICATION_PGP) && (flags & APPLICATION_PGP)) - ret = crypt_pgp_valid_passphrase(); + rc = crypt_pgp_valid_passphrase(); if ((WithCrypto & APPLICATION_SMIME) && (flags & APPLICATION_SMIME)) - ret = crypt_smime_valid_passphrase(); + rc = crypt_smime_valid_passphrase(); - return ret; + return rc; } int mutt_protect(struct Header *msg, char *keylist) diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 17747eea8..ea7196fc6 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -5010,7 +5010,7 @@ int smime_gpgme_send_menu(struct Header *msg) static int verify_sender(struct Header *h, gpgme_protocol_t protocol) { struct Address *sender = NULL; - unsigned int ret = 1; + unsigned int rc = 1; if (h->env->from) { @@ -5033,7 +5033,7 @@ static int verify_sender(struct Header *h, gpgme_protocol_t protocol) int uid_length = 0; sender_length = strlen(sender->mailbox); - for (uid = key->uids; uid && ret; uid = uid->next) + for (uid = key->uids; uid && rc; uid = uid->next) { uid_length = strlen(uid->email); if (1 && (uid->email[0] == '<') && (uid->email[uid_length - 1] == '>') && @@ -5043,7 +5043,7 @@ static int verify_sender(struct Header *h, gpgme_protocol_t protocol) if (!at_sign) { if (strncmp(uid->email + 1, sender->mailbox, sender_length) == 0) - ret = 0; + rc = 0; } else { @@ -5065,7 +5065,7 @@ static int verify_sender(struct Header *h, gpgme_protocol_t protocol) domainname_match = (strncasecmp(tmp_email, tmp_sender, domainname_length) == 0); if (mailbox_match && domainname_match) - ret = 0; + rc = 0; } } } @@ -5082,7 +5082,7 @@ static int verify_sender(struct Header *h, gpgme_protocol_t protocol) signature_key = NULL; } - return ret; + return rc; } int smime_gpgme_verify_sender(struct Header *h) diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 4b8b9cfee..89a615fba 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -909,7 +909,7 @@ static int smime_handle_cert_email(char *certificate, char *mailbox, int copy, FILE *fpout = NULL, *fperr = NULL; char tmpfname[_POSIX_PATH_MAX]; char email[STRING]; - int ret = -1, count = 0; + int rc = -1, count = 0; pid_t thepid; size_t len = 0; @@ -955,23 +955,23 @@ static int smime_handle_cert_email(char *certificate, char *mailbox, int copy, if (len && (email[len - 1] == '\n')) email[len - 1] = '\0'; if (mutt_str_strncasecmp(email, mailbox, mutt_str_strlen(mailbox)) == 0) - ret = 1; + rc = 1; - ret = ret < 0 ? 0 : ret; + rc = rc < 0 ? 0 : rc; count++; } - if (ret == -1) + if (rc == -1) { mutt_endwin(NULL); mutt_file_copy_stream(fperr, stdout); mutt_any_key_to_continue(_("Error: unable to create OpenSSL subprocess!")); - ret = 1; + rc = 1; } - else if (!ret) - ret = 1; + else if (!rc) + rc = 1; else - ret = 0; + rc = 0; if (copy && buffer && num) { @@ -991,12 +991,12 @@ static int smime_handle_cert_email(char *certificate, char *mailbox, int copy, } } else if (copy) - ret = 2; + rc = 2; mutt_file_fclose(&fpout); mutt_file_fclose(&fperr); - return ret; + return rc; } static char *smime_extract_certificate(char *infile) diff --git a/pop.c b/pop.c index 436dc5d09..aa7564638 100644 --- a/pop.c +++ b/pop.c @@ -82,7 +82,7 @@ static int fetch_message(char *line, void *file) static int pop_read_header(struct PopData *pop_data, struct Header *h) { FILE *f = NULL; - int ret, index; + int rc, index; long length; char buf[LONG_STRING]; char tempfile[_POSIX_PATH_MAX]; @@ -96,24 +96,24 @@ static int pop_read_header(struct PopData *pop_data, struct Header *h) } snprintf(buf, sizeof(buf), "LIST %d\r\n", h->refno); - ret = pop_query(pop_data, buf, sizeof(buf)); - if (ret == 0) + rc = pop_query(pop_data, buf, sizeof(buf)); + if (rc == 0) { sscanf(buf, "+OK %d %ld", &index, &length); snprintf(buf, sizeof(buf), "TOP %d 0\r\n", h->refno); - ret = pop_fetch_data(pop_data, buf, NULL, fetch_message, f); + rc = pop_fetch_data(pop_data, buf, NULL, fetch_message, f); if (pop_data->cmd_top == 2) { - if (ret == 0) + if (rc == 0) { pop_data->cmd_top = 1; mutt_debug(1, "pop_read_header: set TOP capability\n"); } - if (ret == -2) + if (rc == -2) { pop_data->cmd_top = 0; @@ -124,7 +124,7 @@ static int pop_read_header(struct PopData *pop_data, struct Header *h) } } - switch (ret) + switch (rc) { case 0: { @@ -153,7 +153,7 @@ static int pop_read_header(struct PopData *pop_data, struct Header *h) mutt_file_fclose(&f); unlink(tempfile); - return ret; + return rc; } /** diff --git a/pop_lib.c b/pop_lib.c index c3b72dccb..cddee2d19 100644 --- a/pop_lib.c +++ b/pop_lib.c @@ -299,21 +299,21 @@ int pop_connect(struct PopData *pop_data) */ int pop_open_connection(struct PopData *pop_data) { - int ret; + int rc; unsigned int n, size; char buf[LONG_STRING]; - ret = pop_connect(pop_data); - if (ret < 0) + rc = pop_connect(pop_data); + if (rc < 0) { mutt_sleep(2); - return ret; + return rc; } - ret = pop_capabilities(pop_data, 0); - if (ret == -1) + rc = pop_capabilities(pop_data, 0); + if (rc == -1) goto err_conn; - if (ret == -2) + if (rc == -2) { mutt_sleep(2); return -2; @@ -327,21 +327,20 @@ int pop_open_connection(struct PopData *pop_data) pop_data->use_stls = 2; if (pop_data->use_stls == 0) { - ret = - query_quadoption(OPT_SSL_STARTTLS, _("Secure connection with TLS?")); - if (ret == MUTT_ABORT) + rc = query_quadoption(OPT_SSL_STARTTLS, _("Secure connection with TLS?")); + if (rc == MUTT_ABORT) return -2; pop_data->use_stls = 1; - if (ret == MUTT_YES) + if (rc == MUTT_YES) pop_data->use_stls = 2; } if (pop_data->use_stls == 2) { mutt_str_strfcpy(buf, "STLS\r\n", sizeof(buf)); - ret = pop_query(pop_data, buf, sizeof(buf)); - if (ret == -1) + rc = pop_query(pop_data, buf, sizeof(buf)); + if (rc == -1) goto err_conn; - if (ret != 0) + if (rc != 0) { mutt_error("%s", pop_data->err_msg); mutt_sleep(2); @@ -355,10 +354,10 @@ int pop_open_connection(struct PopData *pop_data) else { /* recheck capabilities after STLS completes */ - ret = pop_capabilities(pop_data, 1); - if (ret == -1) + rc = pop_capabilities(pop_data, 1); + if (rc == -1) goto err_conn; - if (ret == -2) + if (rc == -2) { mutt_sleep(2); return -2; @@ -375,19 +374,19 @@ int pop_open_connection(struct PopData *pop_data) } #endif - ret = pop_authenticate(pop_data); - if (ret == -1) + rc = pop_authenticate(pop_data); + if (rc == -1) goto err_conn; - if (ret == -3) + if (rc == -3) mutt_clear_error(); - if (ret != 0) - return ret; + if (rc != 0) + return rc; /* recheck capabilities after authentication */ - ret = pop_capabilities(pop_data, 2); - if (ret == -1) + rc = pop_capabilities(pop_data, 2); + if (rc == -1) goto err_conn; - if (ret == -2) + if (rc == -2) { mutt_sleep(2); return -2; @@ -395,14 +394,14 @@ int pop_open_connection(struct PopData *pop_data) /* get total size of mailbox */ mutt_str_strfcpy(buf, "STAT\r\n", sizeof(buf)); - ret = pop_query(pop_data, buf, sizeof(buf)); - if (ret == -1) + rc = pop_query(pop_data, buf, sizeof(buf)); + if (rc == -1) goto err_conn; - if (ret == -2) + if (rc == -2) { mutt_error("%s", pop_data->err_msg); mutt_sleep(2); - return ret; + return rc; } sscanf(buf, "+OK %u %u", &n, &size); diff --git a/rfc2047.c b/rfc2047.c index 28f95d8f8..53c5a094a 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -428,7 +428,7 @@ static size_t choose_block(char *d, size_t dlen, int col, const char *fromcode, static int rfc2047_encode(ICONV_CONST char *d, size_t dlen, int col, const char *fromcode, const char *charsets, char **e, size_t *elen, char *specials) { - int ret = 0; + int rc = 0; char *buf = NULL; size_t bufpos, buflen; char *u = NULL, *t0 = NULL, *t1 = NULL, *t = NULL; @@ -442,7 +442,7 @@ static int rfc2047_encode(ICONV_CONST char *d, size_t dlen, int col, const char /* Try to convert to UTF-8. */ if (convert_string(d, dlen, fromcode, icode, &u, &ulen)) { - ret = 1; + rc = 1; icode = 0; mutt_mem_realloc(&u, (ulen = dlen) + 1); memcpy(u, d, dlen); @@ -478,7 +478,7 @@ static int rfc2047_encode(ICONV_CONST char *d, size_t dlen, int col, const char /* No encoding is required. */ *e = u; *elen = ulen; - return ret; + return rc; } /* Choose target charset. */ @@ -489,7 +489,7 @@ static int rfc2047_encode(ICONV_CONST char *d, size_t dlen, int col, const char tocode = tocode1; else { - ret = 2; + rc = 2; icode = 0; } } @@ -612,7 +612,7 @@ static int rfc2047_encode(ICONV_CONST char *d, size_t dlen, int col, const char *e = buf; *elen = buflen + 1; - return ret; + return rc; } void rfc2047_encode_string(char **pd, int encode_specials, int col) diff --git a/sendlib.c b/sendlib.c index 41204244c..da06f938e 100644 --- a/sendlib.c +++ b/sendlib.c @@ -2722,7 +2722,7 @@ void mutt_unprepare_envelope(struct Envelope *env) static int bounce_message(FILE *fp, struct Header *h, struct Address *to, const char *resent_from, struct Address *env_from) { - int ret = 0; + int rc = 0; FILE *f = NULL; char date[SHORT_STRING], tempfile[_POSIX_PATH_MAX]; struct Message *msg = NULL; @@ -2732,8 +2732,8 @@ static int bounce_message(FILE *fp, struct Header *h, struct Address *to, /* Try to bounce each message out, aborting if we get any failures. */ for (int i = 0; i < Context->msgcount; i++) if (message_is_tagged(Context, i)) - ret |= bounce_message(fp, Context->hdrs[i], to, resent_from, env_from); - return ret; + rc |= bounce_message(fp, Context->hdrs[i], to, resent_from, env_from); + return rc; } /* If we failed to open a message, return with error */ @@ -2772,17 +2772,17 @@ static int bounce_message(FILE *fp, struct Header *h, struct Address *to, } #ifdef USE_SMTP if (SmtpUrl) - ret = mutt_smtp_send(env_from, to, NULL, NULL, tempfile, h->content->encoding == ENC8BIT); + rc = mutt_smtp_send(env_from, to, NULL, NULL, tempfile, h->content->encoding == ENC8BIT); else #endif /* USE_SMTP */ - ret = mutt_invoke_sendmail(env_from, to, NULL, NULL, tempfile, - h->content->encoding == ENC8BIT); + rc = mutt_invoke_sendmail(env_from, to, NULL, NULL, tempfile, + h->content->encoding == ENC8BIT); } if (msg) mx_close_message(Context, &msg); - return ret; + return rc; } int mutt_bounce_message(FILE *fp, struct Header *h, struct Address *to) diff --git a/smtp.c b/smtp.c index 63f725c0d..5919b59ec 100644 --- a/smtp.c +++ b/smtp.c @@ -642,7 +642,7 @@ int mutt_smtp_send(const struct Address *from, const struct Address *to, struct Account account; const char *envfrom = NULL; char buf[1024]; - int ret = -1; + int rc = -1; /* it might be better to synthesize an envelope from from user and host * but this condition is most likely arrived at accidentally */ @@ -657,7 +657,7 @@ int mutt_smtp_send(const struct Address *from, const struct Address *to, } if (smtp_fill_account(&account) < 0) - return ret; + return rc; conn = mutt_conn_find(NULL, &account); if (!conn) @@ -668,57 +668,55 @@ int mutt_smtp_send(const struct Address *from, const struct Address *to, do { /* send our greeting */ - if ((ret = smtp_open(conn))) + if ((rc = smtp_open(conn))) break; FREE(&AuthMechs); /* send the sender's address */ - ret = snprintf(buf, sizeof(buf), "MAIL FROM:<%s>", envfrom); + rc = snprintf(buf, sizeof(buf), "MAIL FROM:<%s>", envfrom); if (eightbit && mutt_bit_isset(Capabilities, EIGHTBITMIME)) { mutt_str_strncat(buf, sizeof(buf), " BODY=8BITMIME", 15); - ret += 14; + rc += 14; } if (DsnReturn && mutt_bit_isset(Capabilities, DSN)) - ret += snprintf(buf + ret, sizeof(buf) - ret, " RET=%s", DsnReturn); + rc += snprintf(buf + rc, sizeof(buf) - rc, " rc=%s", DsnReturn); if (mutt_bit_isset(Capabilities, SMTPUTF8) && (address_uses_unicode(envfrom) || addresses_use_unicode(to) || addresses_use_unicode(cc) || addresses_use_unicode(bcc))) - ret += snprintf(buf + ret, sizeof(buf) - ret, " SMTPUTF8"); + rc += snprintf(buf + rc, sizeof(buf) - rc, " SMTPUTF8"); mutt_str_strncat(buf, sizeof(buf), "\r\n", 3); if (mutt_socket_write(conn, buf) == -1) { - ret = SMTP_ERR_WRITE; + rc = SMTP_ERR_WRITE; break; } - if ((ret = smtp_get_resp(conn))) + if ((rc = smtp_get_resp(conn))) break; /* send the recipient list */ - if ((ret = smtp_rcpt_to(conn, to)) || (ret = smtp_rcpt_to(conn, cc)) || - (ret = smtp_rcpt_to(conn, bcc))) - { + if ((rc = smtp_rcpt_to(conn, to)) || (rc = smtp_rcpt_to(conn, cc)) || + (rc = smtp_rcpt_to(conn, bcc))) break; - } /* send the message data */ - if ((ret = smtp_data(conn, msgfile))) + if ((rc = smtp_data(conn, msgfile))) break; mutt_socket_write(conn, "QUIT\r\n"); - ret = 0; + rc = 0; } while (0); if (conn) mutt_socket_close(conn); - if (ret == SMTP_ERR_READ) + if (rc == SMTP_ERR_READ) mutt_error(_("SMTP session failed: read error")); - else if (ret == SMTP_ERR_WRITE) + else if (rc == SMTP_ERR_WRITE) mutt_error(_("SMTP session failed: write error")); - else if (ret == SMTP_ERR_CODE) + else if (rc == SMTP_ERR_CODE) mutt_error(_("Invalid server response")); - return ret; + return rc; }