Skip to content

Commit

Permalink
rename variables: ret -> rc
Browse files Browse the repository at this point in the history
  • Loading branch information
flatcap committed Nov 26, 2017
1 parent 77d37fa commit 81c0337
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 114 deletions.
6 changes: 3 additions & 3 deletions attach.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions charset.c
Expand Up @@ -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;
Expand All @@ -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)
Expand All @@ -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;
}
}
Expand All @@ -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;
}
Expand All @@ -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;
}
}

Expand Down
8 changes: 4 additions & 4 deletions conn/getdomain.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
8 changes: 4 additions & 4 deletions conn/ssl.c
Expand Up @@ -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;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions conn/ssl_gnutls.c
Expand Up @@ -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)
{
Expand All @@ -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;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions hcache/hcache.c
Expand Up @@ -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);
Expand All @@ -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
{
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions ncrypt/crypt.c
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions ncrypt/crypt_gpgme.c
Expand Up @@ -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)
{
Expand All @@ -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] == '>') &&
Expand All @@ -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
{
Expand All @@ -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;
}
}
}
Expand All @@ -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)
Expand Down
20 changes: 10 additions & 10 deletions ncrypt/smime.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions pop.c
Expand Up @@ -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];
Expand All @@ -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;

Expand All @@ -124,7 +124,7 @@ static int pop_read_header(struct PopData *pop_data, struct Header *h)
}
}

switch (ret)
switch (rc)
{
case 0:
{
Expand Down Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 81c0337

Please sign in to comment.