]> granicus.if.org Git - neomutt/commitdiff
split if's containing assignments
authorRichard Russon <rich@flatcap.org>
Thu, 14 Dec 2017 20:00:40 +0000 (20:00 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 28 Dec 2017 13:25:02 +0000 (13:25 +0000)
51 files changed:
address.c
alias.c
attach.c
browser.c
buffy.c
complete.c
compose.c
conn/ssl.c
conn/ssl_gnutls.c
curs_main.c
doc/makedoc.c
edit.c
enter.c
hdrline.c
header.c
help.c
hook.c
imap/command.c
imap/imap.c
imap/message.c
imap/util.c
init.c
keymap.c
main.c
mh.c
mutt/charset.c
mutt/date.c
muttlib.c
mx.c
ncrypt/crypt.c
ncrypt/crypt_gpgme.c
ncrypt/gnupgparse.c
ncrypt/pgp.c
ncrypt/pgpkey.c
ncrypt/smime.c
pager.c
parse.c
pattern.c
pgppubring.c
pop.c
query.c
recvattach.c
recvcmd.c
remailer.c
rfc2047.c
rfc2231.c
rfc3676.c
sendlib.c
sidebar.c
smtp.c
url.c

index c3cd6427d0888adac6afacae95a69a0901bfc174..194b459e5d5aec51cddb4357d6912ea7d17cd734 100644 (file)
--- a/address.c
+++ b/address.c
@@ -326,8 +326,9 @@ static const char *parse_route_addr(const char *s, char *comment, size_t *commen
     s++;
   }
 
-  if ((s = parse_address(s, token, &tokenlen, sizeof(token) - 1, comment,
-                         commentlen, commentmax, addr)) == NULL)
+  s = parse_address(s, token, &tokenlen, sizeof(token) - 1, comment, commentlen,
+                    commentmax, addr);
+  if (s == NULL)
     return NULL;
 
   if (*s != '>')
@@ -500,7 +501,8 @@ struct Address *mutt_addr_parse_list(struct Address *top, const char *s)
     last = last->next;
 
   ws_pending = mutt_str_is_email_wsp(*s);
-  if ((nl = mutt_str_strlen(s)))
+  nl = mutt_str_strlen(s);
+  if (nl)
     nl = s[nl - 1] == '\n';
 
   s = mutt_str_skip_email_wsp(s);
diff --git a/alias.c b/alias.c
index d028ec85be6383d0b1b9edcda8b777b5d5e01e96..e3041cbc197e775b94925b152d14dc3366414f6e 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -302,7 +302,8 @@ void mutt_create_alias(struct Envelope *cur, struct Address *iadr)
   if (adr && adr->mailbox)
   {
     mutt_str_strfcpy(tmp, adr->mailbox, sizeof(tmp));
-    if ((pc = strchr(tmp, '@')))
+    pc = strchr(tmp, '@');
+    if (pc)
       *pc = '\0';
   }
   else
@@ -389,7 +390,8 @@ retry_name:
 
   mutt_alias_add_reverse(new);
 
-  if ((t = Aliases))
+  t = Aliases;
+  if (t)
   {
     while (t->next)
       t = t->next;
@@ -402,7 +404,8 @@ retry_name:
   if (mutt_get_field(_("Save to file: "), buf, sizeof(buf), MUTT_FILE) != 0)
     return;
   mutt_expand_path(buf, sizeof(buf));
-  if ((rc = fopen(buf, "a+")))
+  rc = fopen(buf, "a+");
+  if (rc)
   {
     /* terminate existing file with \n if necessary */
     if (fseek(rc, 0, SEEK_END))
index 87d1a7e0d63224e4007aaf781ff3b9b36be780c6..93f8c209281cb544b0202f551571408e8a33f012 100644 (file)
--- a/attach.c
+++ b/attach.c
@@ -498,8 +498,9 @@ int mutt_view_attachment(FILE *fp, struct Body *a, int flag, struct Header *hdr,
         goto return_error;
       }
 
-      if ((thepid = mutt_create_filter_fd(command, NULL, NULL, NULL, use_pipe ? tempfd : -1,
-                                          use_pager ? pagerfd : -1, -1)) == -1)
+      thepid = mutt_create_filter_fd(command, NULL, NULL, NULL, use_pipe ? tempfd : -1,
+                                     use_pager ? pagerfd : -1, -1);
+      if (thepid == -1)
       {
         if (pagerfd != -1)
           close(pagerfd);
index faac9dc2714e57bbc03bed2492ab5e48bd60acd0..933bd9d82cbbae874ea02ed300d0523b2c6b09ec 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -426,7 +426,8 @@ static const char *folder_format_str(char *buf, size_t buflen, size_t col, int c
     case 'g':
       if (folder->ff->local)
       {
-        if ((gr = getgrgid(folder->ff->gid)))
+        gr = getgrgid(folder->ff->gid);
+        if (gr)
           mutt_format_s(buf, buflen, prec, gr->gr_name);
         else
         {
@@ -502,7 +503,8 @@ static const char *folder_format_str(char *buf, size_t buflen, size_t col, int c
     case 'u':
       if (folder->ff->local)
       {
-        if ((pw = getpwuid(folder->ff->uid)))
+        pw = getpwuid(folder->ff->uid);
+        if (pw)
           mutt_format_s(buf, buflen, prec, pw->pw_name);
         else
         {
diff --git a/buffy.c b/buffy.c
index db32d86b65e95801cf1dff32c312a064efa98fb8..d6982ad32f87b73a2a940e3deaa7f1763fa44fc5 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -146,7 +146,8 @@ static int test_new_folder(const char *path)
   if (typ != MUTT_MBOX && typ != MUTT_MMDF)
     return 0;
 
-  if ((f = fopen(path, "rb")))
+  f = fopen(path, "rb");
+  if (f)
   {
     rc = test_last_status_new(f);
     mutt_file_fclose(&f);
index 9af2fbc84e7fecc392d229e72b8dedd3b9f3686a..e85429de3b1aa8de4adaf42b326fcfc2601a2c03 100644 (file)
@@ -148,7 +148,8 @@ int mutt_complete(char *s, size_t slen)
       mutt_str_strfcpy(exp_dirpart, NONULL(SpoolFile), sizeof(exp_dirpart));
     else
       mutt_str_strfcpy(exp_dirpart, NONULL(Folder), sizeof(exp_dirpart));
-    if ((p = strrchr(s, '/')))
+    p = strrchr(s, '/');
+    if (p)
     {
       char buf[_POSIX_PATH_MAX];
       if (mutt_file_concatn_path(buf, sizeof(buf), exp_dirpart, strlen(exp_dirpart),
@@ -166,7 +167,8 @@ int mutt_complete(char *s, size_t slen)
   }
   else
   {
-    if ((p = strrchr(s, '/')))
+    p = strrchr(s, '/');
+    if (p)
     {
       if (p == s) /* absolute path */
       {
index df0b79b06bdc19576307d90d62f5915cc3a72a7b..e69e58c63de9af652779bb90fc44c1ce315d69c3 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -666,7 +666,8 @@ static unsigned long cum_attachs_size(struct Menu *menu)
     if (!b->content)
       b->content = mutt_get_content_info(b->filename, b);
 
-    if ((info = b->content))
+    info = b->content;
+    if (info)
     {
       switch (b->encoding)
       {
@@ -1319,8 +1320,8 @@ int mutt_compose_menu(struct Header *msg, /* structure for new message */
 
         if (!fcc_set && *fcc)
         {
-          if ((i = query_quadoption(OPT_COPY,
-                                    _("Save a copy of this message?"))) == MUTT_ABORT)
+          i = query_quadoption(OPT_COPY, _("Save a copy of this message?"));
+          if (i == MUTT_ABORT)
             break;
           else if (i == MUTT_NO)
             *fcc = 0;
index 79e006b4b6319e0d09fefed0427fd23fa282b1be..298f32666cd57d094d034afbb498b40e7adc284d 100644 (file)
@@ -839,7 +839,8 @@ static int check_host(X509 *x509cert, const char *hostname, char *err, size_t er
 
   /* Try the DNS subjectAltNames. */
   match_found = false;
-  if ((subj_alt_names = X509_get_ext_d2i(x509cert, NID_subject_alt_name, NULL, NULL)))
+  subj_alt_names = X509_get_ext_d2i(x509cert, NID_subject_alt_name, NULL, NULL);
+  if (subj_alt_names)
   {
     subj_alt_names_count = sk_GENERAL_NAME_num(subj_alt_names);
     for (int i = 0; i < subj_alt_names_count; i++)
@@ -1069,7 +1070,8 @@ static int interactive_check_cert(X509 *cert, int idx, size_t len, SSL *ssl, int
         if (!allow_always)
           break;
         done = 0;
-        if ((fp = fopen(CertificateFile, "a")))
+        fp = fopen(CertificateFile, "a");
+        if (fp)
         {
           if (PEM_write_X509(fp, cert))
             done = 1;
index fcbff0f7c7bd9d769736f40594dd1e336c9ccd4e..0dfb998a497b29d2c197f79f408c10c4da9cf7be 100644 (file)
@@ -318,7 +318,8 @@ static int tls_check_stored_hostname(const gnutls_datum_t *cert, const char *hos
   regmatch_t pmatch[3];
 
   /* try checking against names stored in stored certs file */
-  if ((fp = fopen(CertificateFile, "r")))
+  fp = fopen(CertificateFile, "r");
+  if (fp)
   {
     if (REGCOMP(&preg,
                 "^#H ([a-zA-Z0-9_\\.-]+) ([0-9A-F]{4}( [0-9A-F]{4}){7})[ \t]*$",
@@ -829,7 +830,8 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata,
         break;
       case OP_MAX + 3: /* accept always */
         done = 0;
-        if ((fp = fopen(CertificateFile, "a")))
+        fp = fopen(CertificateFile, "a");
+        if (fp)
         {
           /* save hostname if necessary */
           if (certerr & CERTERR_HOSTNAME)
@@ -1006,7 +1008,8 @@ static void tls_get_client_cert(struct Connection *conn)
   }
   cn += 3;
 
-  if ((cnend = strstr(dn, ",EMAIL=")))
+  cnend = strstr(dn, ",EMAIL=");
+  if (cnend)
     *cnend = '\0';
 
   /* if we are using a client cert, SASL may expect an external auth name */
@@ -1172,7 +1175,8 @@ static int tls_negotiate(struct Connection *conn)
   gnutls_certificate_set_verify_flags(data->xcred, GNUTLS_VERIFY_DISABLE_TIME_CHECKS);
 #endif
 
-  if ((err = gnutls_init(&data->state, GNUTLS_CLIENT)))
+  err = gnutls_init(&data->state, GNUTLS_CLIENT);
+  if (err)
   {
     mutt_error("gnutls_handshake: %s", gnutls_strerror(err));
     mutt_sleep(2);
index 7a6e98efcea0d2cd7fe75725444546b9427cefd6..76d2e86e80969b0ab45cf7019e68c3621b6dccf0 100644 (file)
@@ -111,7 +111,7 @@ static const char *NoVisible = N_("No visible messages.");
   if (Context && menu->current >= Context->vcount)                             \
   {                                                                            \
     mutt_flushinp();                                                           \
-    mutt_error(_(NoVisible));                                                 \
+    mutt_error(_(NoVisible));                                                  \
     break;                                                                     \
   }
 
@@ -499,9 +499,10 @@ static int main_change_folder(struct Menu *menu, int op, char *buf,
    * switch statement would need to be run. */
   mutt_folder_hook(buf);
 
-  if ((Context = mx_open_mailbox(
-           buf, (option(OPT_READ_ONLY) || op == OP_MAIN_CHANGE_FOLDER_READONLY) ? MUTT_READONLY : 0,
-           NULL)) != NULL)
+  Context = mx_open_mailbox(
+      buf, (option(OPT_READ_ONLY) || (op == OP_MAIN_CHANGE_FOLDER_READONLY)) ? MUTT_READONLY : 0,
+      NULL);
+  if (Context)
   {
     menu->current = ci_first_message();
   }
index b2566e40ae7d2d0bb336bfc5c7c9e6bd2298f5fe..3046df957faab6a491100bcbd98bd47d799eb310 100644 (file)
@@ -1409,7 +1409,8 @@ int main(int argc, char *argv[])
   int c;
   FILE *f = NULL;
 
-  if ((Progname = strrchr(argv[0], '/')))
+  Progname = strrchr(argv[0], '/');
+  if (Progname)
     Progname++;
   else
     Progname = argv[0];
diff --git a/edit.c b/edit.c
index 80e07c6f228be7674d9d578cbc56febf3974dbdc..57ae237cc875e01a6f0f4982519fc19d7f905d96 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -114,7 +114,8 @@ static char **be_snarf_file(const char *path, char **buf, int *max, int *len, in
   char tmp[LONG_STRING];
   struct stat sb;
 
-  if ((f = fopen(path, "r")))
+  f = fopen(path, "r");
+  if (f)
   {
     fstat(fileno(f), &sb);
     buf = be_snarf_data(f, buf, max, len, 0, sb.st_size, 0);
diff --git a/enter.c b/enter.c
index c7df256aec5ce0c1c3675a5eeb2cfa1cf2a91117..827105d88ce5f2779f70f85cb3c1e2601dc45169 100644 (file)
--- a/enter.c
+++ b/enter.c
@@ -547,7 +547,8 @@ int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, int mul
           }
           else if (flags & MUTT_ALIAS && ch == OP_EDITOR_COMPLETE_QUERY)
           {
-            if ((i = state->curpos))
+            i = state->curpos;
+            if (i != 0)
             {
               for (; i && state->wbuf[i - 1] != ','; i--)
                 ;
index 49fa35ffaba6b73c1715eb9dcb135ef54f2004dd..2caaa8b43102a8ac997d6bb0400d9dceabe101b1 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -562,7 +562,8 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co
     case 'b':
       if (ctx)
       {
-        if ((p = strrchr(ctx->path, '/')))
+        p = strrchr(ctx->path, '/');
+        if (p)
           mutt_str_strfcpy(buf, p + 1, buflen);
         else
           mutt_str_strfcpy(buf, ctx->path, buflen);
@@ -1114,7 +1115,8 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co
       if (hdr->env->from && hdr->env->from->mailbox)
       {
         mutt_str_strfcpy(tmp, mutt_addr_for_display(hdr->env->from), sizeof(tmp));
-        if ((p = strpbrk(tmp, "%@")))
+        p = strpbrk(tmp, "%@");
+        if (p)
           *p = 0;
       }
       else
@@ -1134,7 +1136,8 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co
       }
       else
         mutt_format_s(tmp, sizeof(tmp), prec, mutt_get_name(hdr->env->from));
-      if ((p = strpbrk(tmp, " %@")))
+      p = strpbrk(tmp, " %@");
+      if (p)
         *p = 0;
       mutt_format_s(buf, buflen, prec, tmp);
       break;
index 95dc93e2eb44c895263a1f7299324552c2aab7f6..6fe6de40f63c13c726f527e40502dadf7fa4139b 100644 (file)
--- a/header.c
+++ b/header.c
@@ -191,7 +191,8 @@ void mutt_edit_headers(const char *editor, const char *body, struct Header *msg,
         path[l] = '\0';
 
         mutt_expand_path(path, sizeof(path));
-        if ((body2 = mutt_make_file_attach(path)))
+        body2 = mutt_make_file_attach(path);
+        if (body2)
         {
           body2->description = mutt_str_strdup(p);
           for (parts = msg->content; parts->next; parts = parts->next)
diff --git a/help.c b/help.c
index 7a7d31089557fcc457d17a495b17753b837e843a..a459b78ec8e10fa313050c843678676eac9e6ad1 100644 (file)
--- a/help.c
+++ b/help.c
@@ -57,7 +57,8 @@ static const struct Binding *help_lookup_function(int op, int menu)
         return (&OpGeneric[i]);
   }
 
-  if ((map = km_get_table(menu)))
+  map = km_get_table(menu);
+  if (map)
   {
     for (int i = 0; map[i].name; i++)
       if (map[i].op == op)
@@ -224,7 +225,8 @@ static void format_line(FILE *f, int ismacro, const char *t1, const char *t2, co
 
   /* don't try to press string into one line with less than 40 characters.
      The double parenthesis avoids a gcc warning, sigh ... */
-  if ((split = MuttIndexWindow->cols < 40))
+  split = MuttIndexWindow->cols;
+  if (split < 40)
   {
     col_a = col = 0;
     col_b = LONG_STRING;
diff --git a/hook.c b/hook.c
index a34331de44bb817a54e62129bf20dfb7acc27001..048360a850c4ad2404a6252efe09a7b2cc41466f 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -218,9 +218,10 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
   if (data & (MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_SAVEHOOK | MUTT_FCCHOOK |
               MUTT_MESSAGEHOOK | MUTT_REPLYHOOK))
   {
-    if ((pat = mutt_pattern_comp(
-             pattern.data, (data & (MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_FCCHOOK)) ? 0 : MUTT_FULL_MSG,
-             err)) == NULL)
+    pat = mutt_pattern_comp(
+        pattern.data,
+        (data & (MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_FCCHOOK)) ? 0 : MUTT_FULL_MSG, err);
+    if (!pat)
       goto error;
   }
   else if (~data & MUTT_GLOBALHOOK) /* NOT a global hook */
@@ -228,12 +229,13 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data,
     /* Hooks not allowing full patterns: Check syntax of regex */
     rx = mutt_mem_malloc(sizeof(regex_t));
 #ifdef MUTT_CRYPTHOOK
-    if ((rc = REGCOMP(rx, NONULL(pattern.data),
-                      ((data & (MUTT_CRYPTHOOK | MUTT_CHARSETHOOK | MUTT_ICONVHOOK)) ? REG_ICASE : 0))) != 0)
+    rc = REGCOMP(rx, NONULL(pattern.data),
+                 ((data & (MUTT_CRYPTHOOK | MUTT_CHARSETHOOK | MUTT_ICONVHOOK)) ? REG_ICASE : 0));
 #else
-    if ((rc = REGCOMP(rx, NONULL(pattern.data),
-                      (data & (MUTT_CHARSETHOOK | MUTT_ICONVHOOK)) ? REG_ICASE : 0)) != 0)
+    rc = REGCOMP(rx, NONULL(pattern.data),
+                 (data & (MUTT_CHARSETHOOK | MUTT_ICONVHOOK)) ? REG_ICASE : 0);
 #endif /* MUTT_CRYPTHOOK */
+    if (rc != 0)
     {
       regerror(rc, rx, err->data, err->dsize);
       FREE(&rx);
index eba868e8e52032111a545d7d74a21bfe293d1087..334d7adf045bd160248dee7e225d0fc5ccd70900 100644 (file)
@@ -376,7 +376,8 @@ static void cmd_parse_capability(struct ImapData *idata, char *s)
   mutt_debug(3, "Handling CAPABILITY\n");
 
   s = imap_next_word(s);
-  if ((bracket = strchr(s, ']')))
+  bracket = strchr(s, ']');
+  if (bracket)
     *bracket = '\0';
   FREE(&idata->capstr);
   idata->capstr = mutt_str_strdup(s);
index 4958335a20b8e8a6ac8f53a8161793c507e819c6..eaba75ca78b0e1d44974f70b938e839ea6ea6b7f 100644 (file)
@@ -1607,7 +1607,8 @@ int imap_status(char *path, int queue)
     imap_exec(idata, buf, 0);
 
   queued = 0;
-  if ((status = imap_mboxcache_get(idata, mbox, 0)))
+  status = imap_mboxcache_get(idata, mbox, 0);
+  if (status)
     return status->messages;
 
   return 0;
@@ -2433,8 +2434,9 @@ int imap_sync_mailbox(struct Context *ctx, int expunge)
   /* if we are expunging anyway, we can do deleted messages very quickly... */
   if (expunge && mutt_bit_isset(ctx->rights, MUTT_ACL_DELETE))
   {
-    if ((rc = imap_exec_msgset(idata, "UID STORE", "+FLAGS.SILENT (\\Deleted)",
-                               MUTT_DELETED, 1, 0)) < 0)
+    rc = imap_exec_msgset(idata, "UID STORE", "+FLAGS.SILENT (\\Deleted)",
+                          MUTT_DELETED, 1, 0);
+    if (rc < 0)
     {
       mutt_error(_("Expunge failed"));
       mutt_sleep(1);
index b6bf35b8923f5df22fb47d9f852e19299874ead9..4c6881e58972aa5f86377533c3faa212b9613475 100644 (file)
@@ -1019,7 +1019,8 @@ int imap_fetch_message(struct Context *ctx, struct Message *msg, int msgno)
   idata = ctx->data;
   h = ctx->hdrs[msgno];
 
-  if ((msg->fp = msg_cache_get(idata, h)))
+  msg->fp = msg_cache_get(idata, h);
+  if (msg->fp)
   {
     if (HEADER_DATA(h)->parsed)
       return 0;
index ceaafeb3e2859997cc4069d5286b9f6f8e8ea671..bb782e0548427b7e3b8a60fbd764c4971ebc9585 100644 (file)
@@ -445,7 +445,8 @@ int imap_parse_path(const char *path, struct ImapMbox *mx)
       /* walk past closing '}' */
       mx->mbox = mutt_str_strdup(c + 1);
 
-    if ((c = strrchr(tmp, '@')))
+    c = strrchr(tmp, '@');
+    if (c)
     {
       *c = '\0';
       mutt_str_strfcpy(mx->account.user, tmp, sizeof(mx->account.user));
diff --git a/init.c b/init.c
index 98504998ebbea6a26964ff95cf6cdfcb023b8d59..36075906a4f14c1f38238e439e32b304a5ed24dc 100644 (file)
--- a/init.c
+++ b/init.c
@@ -633,7 +633,8 @@ int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, int flags)
       pc = tok->dptr;
       do
       {
-        if ((pc = strpbrk(pc, "\\`")))
+        pc = strpbrk(pc, "\\`");
+        if (pc)
         {
           /* skip any quoted chars */
           if (*pc == '\\')
@@ -698,7 +699,8 @@ int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, int flags)
       if (*tok->dptr == '{')
       {
         tok->dptr++;
-        if ((pc = strchr(tok->dptr, '}')))
+        pc = strchr(tok->dptr, '}');
+        if (pc)
         {
           var = mutt_str_substr_dup(tok->dptr, pc);
           tok->dptr = pc + 1;
@@ -1600,7 +1602,8 @@ static int parse_attach_list(struct Buffer *buf, struct Buffer *s,
     else
       a->major = mutt_str_strdup(buf->data);
 
-    if ((p = strchr(a->major, '/')))
+    p = strchr(a->major, '/');
+    if (p)
     {
       *p = '\0';
       p++;
@@ -1660,7 +1663,8 @@ static int parse_unattach_list(struct Buffer *buf, struct Buffer *s,
     else
       tmp = mutt_str_strdup(buf->data);
 
-    if ((minor = strchr(tmp, '/')))
+    minor = strchr(tmp, '/');
+    if (minor)
     {
       *minor = '\0';
       minor++;
@@ -2693,7 +2697,8 @@ static int parse_set(struct Buffer *tmp, struct Buffer *s, unsigned long data,
 
         if (myvar)
         {
-          if ((val = myvar_get(myvar)))
+          val = myvar_get(myvar);
+          if (val)
           {
             pretty_var(err->data, err->dsize, myvar, val);
             break;
@@ -3368,7 +3373,7 @@ finish:
  * the user has typed so far. Allocate LONG_STRING just to be sure! */
 static char UserTyped[LONG_STRING] = { 0 };
 
-static int NumMatched = 0;            /* Number of matches for completion */
+static int NumMatched = 0;             /* Number of matches for completion */
 static char Completed[STRING] = { 0 }; /* completed string (command or variable) */
 static const char **Matches;
 /* this is a lie until mutt_init runs: */
@@ -4058,11 +4063,13 @@ void mutt_init(int skip_sys_rc, struct ListHead *commands)
 
   /* on one of the systems I use, getcwd() does not return the same prefix
      as is listed in the passwd file */
-  if ((p = getenv("HOME")))
+  p = getenv("HOME");
+  if (p)
     HomeDir = mutt_str_strdup(p);
 
   /* Get some information about the user */
-  if ((pw = getpwuid(getuid())))
+  pw = getpwuid(getuid());
+  if (pw)
   {
     char rnbuf[STRING];
 
@@ -4082,7 +4089,8 @@ void mutt_init(int skip_sys_rc, struct ListHead *commands)
       fputs(_("unable to determine home directory"), stderr);
       exit(1);
     }
-    if ((p = getenv("USER")))
+    p = getenv("USER");
+    if (p)
       Username = mutt_str_strdup(p);
     else
     {
@@ -4125,7 +4133,8 @@ void mutt_init(int skip_sys_rc, struct ListHead *commands)
   }
 
   /* some systems report the FQDN instead of just the hostname */
-  if ((p = strchr(utsname.nodename, '.')))
+  p = strchr(utsname.nodename, '.');
+  if (p)
     ShortHostname = mutt_str_substr_dup(utsname.nodename, p);
   else
     ShortHostname = mutt_str_strdup(utsname.nodename);
@@ -4160,7 +4169,8 @@ void mutt_init(int skip_sys_rc, struct ListHead *commands)
 #endif
 
 #ifdef USE_NNTP
-  if ((p = getenv("NNTPSERVER")))
+  p = getenv("NNTPSERVER");
+  if (p)
   {
     FREE(&NewsServer);
     NewsServer = mutt_str_strdup(p);
@@ -4172,7 +4182,8 @@ void mutt_init(int skip_sys_rc, struct ListHead *commands)
   }
 #endif
 
-  if ((p = getenv("MAIL")))
+  p = getenv("MAIL");
+  if (p)
     SpoolFile = mutt_str_strdup(p);
   else if ((p = getenv("MAILDIR")))
     SpoolFile = mutt_str_strdup(p);
@@ -4186,7 +4197,8 @@ void mutt_init(int skip_sys_rc, struct ListHead *commands)
     SpoolFile = mutt_str_strdup(buffer);
   }
 
-  if ((p = getenv("MAILCAPS")))
+  p = getenv("MAILCAPS");
+  if (p)
     MailcapPath = mutt_str_strdup(p);
   else
   {
index 8efee03e3a01abb8763472daf46c119fcea982a0..4e956b660eaf4eb981cd4f20efda4be8c656a778 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -543,7 +543,8 @@ int km_dokey(int menu)
       {
         /* check generic menu */
         bindings = OpGeneric;
-        if ((func = get_func(bindings, tmp.op)))
+        func = get_func(bindings, tmp.op);
+        if (func)
           return tmp.op;
       }
 
@@ -619,7 +620,8 @@ static const char *km_keyname(int c)
   static char buf[10];
   const char *p = NULL;
 
-  if ((p = mutt_map_get_name(c, KeyNames)))
+  p = mutt_map_get_name(c, KeyNames);
+  if (p)
     return p;
 
   if (c < 256 && c > -128 && iscntrl((unsigned char) c))
diff --git a/main.c b/main.c
index 02a0d9a1fd4ac1764f48ce82f53563bcd0c41011..b1cff104d75db83222814125c4e515bd2156bac7 100644 (file)
--- a/main.c
+++ b/main.c
@@ -274,8 +274,9 @@ int main(int argc, char **argv, char **env)
     }
 
     /* USE_NNTP 'g:G' */
-    if ((i = getopt(argc, argv,
-                    "+A:a:Bb:F:f:c:Dd:l:Ee:g:GH:s:i:hm:npQ:RSvxyzZ")) != EOF)
+    i = getopt(argc, argv, "+A:a:Bb:F:f:c:Dd:l:Ee:g:GH:s:i:hm:npQ:RSvxyzZ");
+    if (i != EOF)
+    {
       switch (i)
       {
         case 'A':
@@ -412,6 +413,7 @@ int main(int argc, char **argv, char **env)
         default:
           usage();
       }
+    }
   }
 
   /* collapse remaining argv */
@@ -482,7 +484,8 @@ int main(int argc, char **argv, char **env)
     struct ListNode *np;
     STAILQ_FOREACH(np, &alias_queries, entries)
     {
-      if ((a = mutt_lookup_alias(np->data)))
+      a = mutt_lookup_alias(np->data);
+      if (a)
       {
         /* output in machine-readable form */
         mutt_addrlist_to_intl(a, NULL);
@@ -918,9 +921,9 @@ int main(int argc, char **argv, char **env)
     mutt_folder_hook(folder);
     mutt_startup_shutdown_hook(MUTT_STARTUPHOOK);
 
-    if ((Context = mx_open_mailbox(
-             folder, ((flags & MUTT_RO) || option(OPT_READ_ONLY)) ? MUTT_READONLY : 0, NULL)) ||
-        !explicit_folder)
+    Context = mx_open_mailbox(
+        folder, ((flags & MUTT_RO) || option(OPT_READ_ONLY)) ? MUTT_READONLY : 0, NULL);
+    if (Context || !explicit_folder)
     {
 #ifdef USE_SIDEBAR
       mutt_sb_set_open_buffy();
diff --git a/mh.c b/mh.c
index e0a7d85330200851b5d549ddfb0dfbba4c219844..89d85f6cf1466fa45205aeeb52b604e4c7e1590e 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -149,7 +149,8 @@ static short mhs_set(struct MhSequences *mhs, int i, short f)
 static int mh_read_token(char *t, int *first, int *last)
 {
   char *p = NULL;
-  if ((p = strchr(t, '-')))
+  p = strchr(t, '-');
+  if (p)
   {
     *p++ = '\0';
     if (mutt_str_atoi(t, first) < 0 || mutt_str_atoi(p, last) < 0)
@@ -502,7 +503,8 @@ static void mh_update_sequences(struct Context *ctx)
   snprintf(sequences, sizeof(sequences), "%s/.mh_sequences", ctx->path);
 
   /* first, copy unknown sequences */
-  if ((ofp = fopen(sequences, "r")))
+  ofp = fopen(sequences, "r");
+  if (ofp)
   {
     while ((buf = mutt_file_read_line(buf, &s, ofp, &l, 0)))
     {
@@ -524,7 +526,8 @@ static void mh_update_sequences(struct Context *ctx)
     if (ctx->hdrs[l]->deleted)
       continue;
 
-    if ((p = strrchr(ctx->hdrs[l]->path, '/')))
+    p = strrchr(ctx->hdrs[l]->path, '/');
+    if (p)
       p++;
     else
       p = ctx->hdrs[l]->path;
@@ -600,7 +603,8 @@ static void mh_sequences_add_one(struct Context *ctx, int n, short unseen,
   snprintf(seq_flagged, sizeof(seq_flagged), "%s:", NONULL(MhSeqFlagged));
 
   snprintf(sequences, sizeof(sequences), "%s/.mh_sequences", ctx->path);
-  if ((ofp = fopen(sequences, "r")))
+  ofp = fopen(sequences, "r");
+  if (ofp)
   {
     while ((buf = mutt_file_read_line(buf, &sz, ofp, &line, 0)))
     {
@@ -650,7 +654,8 @@ static void mh_update_maildir(struct Maildir *md, struct MhSequences *mhs)
 
   for (; md; md = md->next)
   {
-    if ((p = strrchr(md->h->path, '/')))
+    p = strrchr(md->h->path, '/');
+    if (p)
       p++;
     else
       p = md->h->path;
@@ -1598,7 +1603,8 @@ static int md_commit_message(struct Context *ctx, struct Message *msg, struct He
   mutt_str_strfcpy(subdir, s, 4);
 
   /* extract the flags */
-  if ((s = strchr(s, ':')))
+  s = strchr(s, ':');
+  if (s)
     mutt_str_strfcpy(suffix, s, sizeof(suffix));
   else
     suffix[0] = '\0';
@@ -1989,11 +1995,13 @@ static char *maildir_canon_filename(char *dest, const char *src, size_t l)
 {
   char *t = NULL, *u = NULL;
 
-  if ((t = strrchr(src, '/')))
+  t = strrchr(src, '/');
+  if (t)
     src = t + 1;
 
   mutt_str_strfcpy(dest, src, l);
-  if ((u = strrchr(dest, ':')))
+  u = strrchr(dest, ':');
+  if (u)
     *u = '\0';
 
   return dest;
@@ -2270,8 +2278,8 @@ static int mh_check_mailbox(struct Context *ctx, int *index_hint)
   {
     ctx->hdrs[i]->active = false;
 
-    if ((p = mutt_hash_find(fnames, ctx->hdrs[i]->path)) && p->h &&
-        (mbox_strict_cmp_headers(ctx->hdrs[i], p->h)))
+    p = mutt_hash_find(fnames, ctx->hdrs[i]->path);
+    if (p && p->h && mbox_strict_cmp_headers(ctx->hdrs[i], p->h))
     {
       ctx->hdrs[i]->active = true;
       /* found the right message */
@@ -2480,8 +2488,8 @@ FILE *maildir_open_find_message(const char *folder, const char *msg, char **newn
 
   maildir_canon_filename(unique, msg, sizeof(unique));
 
-  if ((fp = md_open_find_message(folder, unique, new_hits > cur_hits ? "new" : "cur", newname)) ||
-      errno != ENOENT)
+  fp = md_open_find_message(folder, unique, new_hits > cur_hits ? "new" : "cur", newname);
+  if (fp || (errno != ENOENT))
   {
     if (new_hits < UINT_MAX && cur_hits < UINT_MAX)
     {
@@ -2491,8 +2499,8 @@ FILE *maildir_open_find_message(const char *folder, const char *msg, char **newn
 
     return fp;
   }
-  if ((fp = md_open_find_message(folder, unique, new_hits > cur_hits ? "cur" : "new", newname)) ||
-      errno != ENOENT)
+  fp = md_open_find_message(folder, unique, new_hits > cur_hits ? "cur" : "new", newname);
+  if (fp || (errno != ENOENT))
   {
     if (new_hits < UINT_MAX && cur_hits < UINT_MAX)
     {
index 424cdb669f4f9e8f52d085d9f24eae8444c40984..ecc390fbd540e9760755242475aece89fc735e43 100644 (file)
@@ -345,7 +345,8 @@ void mutt_cs_canonical_charset(char *dest, size_t dlen, const char *name)
   char in[LONG_STRING], scratch[LONG_STRING];
 
   mutt_str_strfcpy(in, name, sizeof(in));
-  if ((ext = strchr(in, '/')))
+  ext = strchr(in, '/');
+  if (ext)
     *ext++ = '\0';
 
   if ((mutt_str_strcasecmp(in, "utf-8") == 0) ||
index b347cd6abc14f5d6af910372f7bd36a20f8c392a..6f456244b4ee716f11cb907ff2a41ebd469b1de2 100644 (file)
@@ -151,7 +151,8 @@ static time_t compute_tz(time_t g, struct tm *utc)
 
   t = (((lt->tm_hour - utc->tm_hour) * 60) + (lt->tm_min - utc->tm_min)) * 60;
 
-  if ((yday = (lt->tm_yday - utc->tm_yday)))
+  yday = (lt->tm_yday - utc->tm_yday);
+  if (yday != 0)
   {
     /* This code is optimized to negative timezones (West of Greenwich) */
     if ((yday == -1) || /* UTC passed midnight before localtime */
@@ -478,7 +479,8 @@ time_t mutt_date_parse_date(const char *s, struct Tz *tz_out)
   mutt_str_strfcpy(scratch, s, sizeof(scratch));
 
   /* kill the day of the week, if it exists. */
-  if ((t = strchr(scratch, ',')))
+  t = strchr(scratch, ',');
+  if (t)
     t++;
   else
     t = scratch;
index 4ac366528f6a82610a32af07a74bc6f77774989e..d5b9287a3614b8011901a72b5eeded3ea5c1891f 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -195,10 +195,12 @@ char *mutt_expand_path_regex(char *s, size_t slen, int regex)
         else
         {
           struct passwd *pw = NULL;
-          if ((t = strchr(s + 1, '/')))
+          t = strchr(s + 1, '/');
+          if (t)
             *t = 0;
 
-          if ((pw = getpwnam(s + 1)))
+          pw = getpwnam(s + 1);
+          if (pw)
           {
             mutt_str_strfcpy(p, pw->pw_dir, sizeof(p));
             if (t)
@@ -254,7 +256,8 @@ char *mutt_expand_path_regex(char *s, size_t slen, int regex)
         struct Header *h = NULL;
         struct Address *alias = NULL;
 
-        if ((alias = mutt_lookup_alias(s + 1)))
+        alias = mutt_lookup_alias(s + 1);
+        if (alias)
         {
           h = mutt_new_header();
           h->env = mutt_env_new();
@@ -765,7 +768,8 @@ void mutt_save_path(char *d, size_t dsize, struct Address *a)
     {
       char *p = NULL;
 
-      if ((p = strpbrk(d, "%@")))
+      p = strpbrk(d, "%@");
+      if (p)
         *p = 0;
     }
     mutt_str_strlower(d);
@@ -1265,7 +1269,7 @@ void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const c
               col++;
             }
           }
-          if (len + wlen > buflen)
+          if ((len + wlen) > buflen)
             len = mutt_wstr_trunc(tmp, buflen - wlen, cols - col, NULL);
           memcpy(wptr, tmp, len);
           wptr += len;
@@ -1330,7 +1334,8 @@ void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const c
               *p = '_';
         }
 
-        if ((len = mutt_str_strlen(tmp)) + wlen > buflen)
+        len = mutt_str_strlen(tmp);
+        if ((len + wlen) > buflen)
           len = mutt_wstr_trunc(tmp, buflen - wlen, cols - col, NULL);
 
         memcpy(wptr, tmp, len);
diff --git a/mx.c b/mx.c
index f84808ade28be709a453fc55196e674c5850229a..6554161f8b6aefe9482522b2c3699793758716bc 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -701,7 +701,8 @@ int mx_close_mailbox(struct Context *ctx, int *index_hint)
   {
     char *p = NULL;
 
-    if ((p = mutt_find_hook(MUTT_MBOXHOOK, ctx->path)))
+    p = mutt_find_hook(MUTT_MBOXHOOK, ctx->path);
+    if (p)
     {
       is_spool = 1;
       mutt_str_strfcpy(mbox, p, sizeof(mbox));
index fd134f8aa150d7353cf64d93a32cadbe4bbd7539..80439767766af0b48e12e14e301135f91466b06c 100644 (file)
@@ -447,13 +447,13 @@ int mutt_is_application_pgp(struct Body *m)
     if ((mutt_str_strcasecmp(m->subtype, "pgp") == 0) ||
         (mutt_str_strcasecmp(m->subtype, "x-pgp-message") == 0))
     {
-      if ((p = mutt_param_get("x-action", m->parameter)) &&
-          ((mutt_str_strcasecmp(p, "sign") == 0) ||
-           (mutt_str_strcasecmp(p, "signclear") == 0)))
+      p = mutt_param_get("x-action", m->parameter);
+      if (p && ((mutt_str_strcasecmp(p, "sign") == 0) ||
+          (mutt_str_strcasecmp(p, "signclear") == 0)))
         t |= PGPSIGN;
 
-      if ((p = mutt_param_get("format", m->parameter)) &&
-          (mutt_str_strcasecmp(p, "keys-only") == 0))
+      p = mutt_param_get("format", m->parameter);
+      if (p && (mutt_str_strcasecmp(p, "keys-only") == 0))
       {
         t |= PGPKEY;
       }
@@ -501,7 +501,8 @@ int mutt_is_application_smime(struct Body *m)
     if ((mutt_str_strcasecmp(m->subtype, "x-pkcs7-mime") == 0) ||
         (mutt_str_strcasecmp(m->subtype, "pkcs7-mime") == 0))
     {
-      if ((t = mutt_param_get("smime-type", m->parameter)))
+      t = mutt_param_get("smime-type", m->parameter);
+      if (t)
       {
         if (mutt_str_strcasecmp(t, "enveloped-data") == 0)
           return SMIMEENCRYPT;
index d1cb04d58fa75dbf0d94ec66e618a743b400a689..da9d01277b1a6a3a1c36cca01019306638aecb6f 100644 (file)
@@ -2227,7 +2227,8 @@ static int pgp_gpgme_extract_keys(gpgme_data_t keydata, FILE **fp, int dryrun)
   err = gpgme_op_keylist_start(tmpctx, NULL, 0);
   while (!err)
   {
-    if ((err = gpgme_op_keylist_next(tmpctx, &key)))
+    err = gpgme_op_keylist_next(tmpctx, &key);
+    if (err)
       break;
     uid = key->uids;
     subkey = key->subkeys;
@@ -2370,7 +2371,8 @@ int pgp_gpgme_check_traditional(FILE *fp, struct Body *b, int just_one)
       rc = (pgp_gpgme_check_traditional(fp, b->parts, 0) || rc);
     else if (b->type == TYPETEXT)
     {
-      if ((r = mutt_is_application_pgp(b)))
+      r = mutt_is_application_pgp(b);
+      if (r != 0)
         rc = (rc || r);
       else
         rc = (pgp_check_traditional_one_body(fp, b) || rc);
@@ -3161,7 +3163,8 @@ static int compare_key_address(const void *a, const void *b)
   struct CryptKeyInfo **t = (struct CryptKeyInfo **) b;
   int r;
 
-  if ((r = mutt_str_strcasecmp((*s)->uid, (*t)->uid)))
+  r = mutt_str_strcasecmp((*s)->uid, (*t)->uid);
+  if (r != 0)
     return r > 0;
   else
     return (mutt_str_strcasecmp(crypt_fpr_or_lkeyid(*s), crypt_fpr_or_lkeyid(*t)) > 0);
@@ -3182,7 +3185,8 @@ static int compare_keyid(const void *a, const void *b)
   struct CryptKeyInfo **t = (struct CryptKeyInfo **) b;
   int r;
 
-  if ((r = mutt_str_strcasecmp(crypt_fpr_or_lkeyid(*s), crypt_fpr_or_lkeyid(*t))))
+  r = mutt_str_strcasecmp(crypt_fpr_or_lkeyid(*s), crypt_fpr_or_lkeyid(*t));
+  if (r != 0)
     return r > 0;
   else
     return (mutt_str_strcasecmp((*s)->uid, (*t)->uid) > 0);
@@ -3233,12 +3237,14 @@ static int compare_key_trust(const void *a, const void *b)
   unsigned long ts = 0, tt = 0;
   int r;
 
-  if ((r = (((*s)->flags & (KEYFLAG_RESTRICTIONS)) - ((*t)->flags & (KEYFLAG_RESTRICTIONS)))))
+  r = (((*s)->flags & (KEYFLAG_RESTRICTIONS)) - ((*t)->flags & (KEYFLAG_RESTRICTIONS)));
+  if (r != 0)
     return r > 0;
 
   ts = (*s)->validity;
   tt = (*t)->validity;
-  if ((r = (tt - ts)))
+  r = (tt - ts);
+  if (r != 0)
     return r < 0;
 
   if ((*s)->kobj->subkeys)
@@ -3257,7 +3263,8 @@ static int compare_key_trust(const void *a, const void *b)
   if (ts < tt)
     return 0;
 
-  if ((r = mutt_str_strcasecmp((*s)->uid, (*t)->uid)))
+  r = mutt_str_strcasecmp((*s)->uid, (*t)->uid);
+  if (r != 0)
     return r > 0;
   return (mutt_str_strcasecmp(crypt_fpr_or_lkeyid((*s)), crypt_fpr_or_lkeyid((*t))) > 0);
 }
@@ -3541,23 +3548,38 @@ static unsigned int key_check_cap(gpgme_key_t key, enum KeyCap cap)
     case KEY_CAP_CAN_ENCRYPT:
       ret = key->can_encrypt;
       if (ret == 0)
+      {
         for (subkey = key->subkeys; subkey; subkey = subkey->next)
-          if ((ret = subkey->can_encrypt))
+        {
+          ret = subkey->can_encrypt;
+          if (ret != 0)
             break;
+        }
+      }
       break;
     case KEY_CAP_CAN_SIGN:
       ret = key->can_sign;
       if (ret == 0)
+      {
         for (subkey = key->subkeys; subkey; subkey = subkey->next)
-          if ((ret = subkey->can_sign))
+        {
+          ret = subkey->can_sign;
+          if (ret != 0)
             break;
+        }
+      }
       break;
     case KEY_CAP_CAN_CERTIFY:
       ret = key->can_certify;
       if (ret == 0)
+      {
         for (subkey = key->subkeys; subkey; subkey = subkey->next)
-          if ((ret = subkey->can_certify))
+        {
+          ret = subkey->can_certify;
+          if (ret != 0)
             break;
+        }
+      }
       break;
   }
 
@@ -4600,7 +4622,8 @@ static struct CryptKeyInfo *crypt_ask_for_key(char *tag, char *whatfor, short ab
       }
     }
 
-    if ((key = crypt_getkeybystr(resp, abilities, app, forced_valid)))
+    key = crypt_getkeybystr(resp, abilities, app, forced_valid);
+    if (key)
       return key;
 
     mutt_error(_("No matching keys found for \"%s\""), resp);
@@ -4970,8 +4993,9 @@ static int gpgme_send_menu(struct Header *msg, int is_smime)
         break;
 
       case 'a': /* sign (a)s */
-        if ((p = crypt_ask_for_key(_("Sign as: "), NULL, KEYFLAG_CANSIGN,
-                                   is_smime ? APPLICATION_SMIME : APPLICATION_PGP, NULL)))
+        p = crypt_ask_for_key(_("Sign as: "), NULL, KEYFLAG_CANSIGN,
+                              is_smime ? APPLICATION_SMIME : APPLICATION_PGP, NULL);
+        if (p)
         {
           snprintf(input_signas, sizeof(input_signas), "0x%s", crypt_fpr_or_lkeyid(p));
           mutt_str_replace(is_smime ? &SmimeDefaultKey : &PgpSignAs, input_signas);
index c18e1626e0d70800f2fea389d49896a319e533bf..624723a8ad8b9ecb8e45c2e48370b207d62580fb 100644 (file)
@@ -147,7 +147,8 @@ static struct PgpKeyInfo *parse_pub_line(char *buf, int *is_subkey, struct PgpKe
 
   for (p = buf; p; p = pend)
   {
-    if ((pend = strchr(p, ':')))
+    pend = strchr(p, ':');
+    if (pend)
       *pend++ = 0;
     field++;
     if (!*p && (field != 1) && (field != 10))
index 609c23ea44e08ee259aa9d65a374468f284072d0..7d2badf75660a915bf73d28f628f98afca46b675 100644 (file)
@@ -110,7 +110,8 @@ bool pgp_use_gpg_agent(void)
   if (!option(OPT_PGP_USE_GPG_AGENT))
     return false;
 
-  if ((tty = ttyname(0)))
+  tty = ttyname(0);
+  if (tty)
   {
     setenv("GPG_TTY", tty, 0);
     mutt_envlist_set("GPG_TTY", tty, false);
@@ -443,8 +444,9 @@ int pgp_application_pgp_handler(struct Body *m, struct State *s)
           return -1;
         }
 
-        if ((thepid = pgp_invoke_decode(&pgpin, NULL, &pgperr, -1, fileno(pgpout),
-                                        -1, tmpfname, needpass)) == -1)
+        thepid = pgp_invoke_decode(&pgpin, NULL, &pgperr, -1, fileno(pgpout),
+                                   -1, tmpfname, needpass);
+        if (thepid == -1)
         {
           mutt_file_fclose(&pgpout);
           maybe_goodsig = false;
@@ -689,7 +691,8 @@ int pgp_check_traditional(FILE *fp, struct Body *b, int just_one)
       rc = pgp_check_traditional(fp, b->parts, 0) || rc;
     else if (b->type == TYPETEXT)
     {
-      if ((r = mutt_is_application_pgp(b)))
+      r = mutt_is_application_pgp(b);
+      if (r)
         rc = rc || r;
       else
         rc = pgp_check_traditional_one_body(fp, b) || rc;
@@ -734,8 +737,8 @@ int pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile)
 
   crypt_current_time(s, "PGP");
 
-  if ((thepid = pgp_invoke_verify(NULL, &pgpout, NULL, -1, -1, fileno(pgperr),
-                                  tempfile, sigfile)) != -1)
+  thepid = pgp_invoke_verify(NULL, &pgpout, NULL, -1, -1, fileno(pgperr), tempfile, sigfile);
+  if (thepid != -1)
   {
     if (pgp_copy_checksig(pgpout, s->fpout) >= 0)
       badsig = 0;
@@ -747,7 +750,8 @@ int pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile)
     if (pgp_copy_checksig(pgperr, s->fpout) >= 0)
       badsig = 0;
 
-    if ((rv = mutt_wait_filter(thepid)))
+    rv = mutt_wait_filter(thepid);
+    if (rv)
       badsig = -1;
 
     mutt_debug(1, "mutt_wait_filter returned %d.\n", rv);
@@ -862,8 +866,8 @@ static struct Body *pgp_decrypt_part(struct Body *a, struct State *s,
   mutt_file_copy_bytes(s->fpin, pgptmp, a->length);
   mutt_file_fclose(&pgptmp);
 
-  if ((thepid = pgp_invoke_decrypt(&pgpin, &pgpout, NULL, -1, -1,
-                                   fileno(pgperr), pgptmpfile)) == -1)
+  thepid = pgp_invoke_decrypt(&pgpin, &pgpout, NULL, -1, -1, fileno(pgperr), pgptmpfile);
+  if (thepid == -1)
   {
     mutt_file_fclose(&pgperr);
     unlink(pgptmpfile);
@@ -1406,8 +1410,9 @@ struct Body *pgp_encrypt_message(struct Body *a, char *keylist, int sign)
   mutt_write_mime_body(a, fptmp);
   mutt_file_fclose(&fptmp);
 
-  if ((thepid = pgp_invoke_encrypt(&pgpin, NULL, NULL, -1, fileno(fpout),
-                                   fileno(pgperr), pgpinfile, keylist, sign)) == -1)
+  thepid = pgp_invoke_encrypt(&pgpin, NULL, NULL, -1, fileno(fpout),
+                              fileno(pgperr), pgpinfile, keylist, sign);
+  if (thepid == -1)
   {
     mutt_file_fclose(&fpout);
     mutt_file_fclose(&pgperr);
@@ -1581,8 +1586,9 @@ struct Body *pgp_traditional_encryptsign(struct Body *a, int flags, char *keylis
 
   unlink(pgperrfile);
 
-  if ((thepid = pgp_invoke_traditional(&pgpin, NULL, NULL, -1, fileno(pgpout),
-                                       fileno(pgperr), pgpinfile, keylist, flags)) == -1)
+  thepid = pgp_invoke_traditional(&pgpin, NULL, NULL, -1, fileno(pgpout),
+                                  fileno(pgperr), pgpinfile, keylist, flags);
+  if (thepid == -1)
   {
     mutt_perror(_("Can't invoke PGP"));
     mutt_file_fclose(&pgpout);
@@ -1803,7 +1809,8 @@ int pgp_send_menu(struct Header *msg)
       case 'a': /* sign (a)s */
         unset_option(OPT_PGP_CHECK_TRUST);
 
-        if ((p = pgp_ask_for_key(_("Sign as: "), NULL, 0, PGP_SECRING)))
+        p = pgp_ask_for_key(_("Sign as: "), NULL, 0, PGP_SECRING);
+        if (p)
         {
           snprintf(input_signas, sizeof(input_signas), "0x%s", pgp_fpr_or_lkeyid(p));
           mutt_str_replace(&PgpSignAs, input_signas);
index 89510f598c526429eca79534d98d398307d569aa..00eab239c84a61cb464ce0722b512260368fa0f3 100644 (file)
@@ -320,7 +320,8 @@ static int compare_key_address(const void *a, const void *b)
   struct PgpUid **s = (struct PgpUid **) a;
   struct PgpUid **t = (struct PgpUid **) b;
 
-  if ((r = mutt_str_strcasecmp((*s)->addr, (*t)->addr)))
+  r = mutt_str_strcasecmp((*s)->addr, (*t)->addr);
+  if (r != 0)
     return r > 0;
   else
     return (mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent),
@@ -340,8 +341,8 @@ static int compare_keyid(const void *a, const void *b)
   struct PgpUid **s = (struct PgpUid **) a;
   struct PgpUid **t = (struct PgpUid **) b;
 
-  if ((r = mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent),
-                               pgp_fpr_or_lkeyid((*t)->parent))))
+  r = mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent), pgp_fpr_or_lkeyid((*t)->parent));
+  if (r != 0)
     return r > 0;
   else
     return (mutt_str_strcasecmp((*s)->addr, (*t)->addr) > 0);
@@ -358,8 +359,9 @@ static int compare_key_date(const void *a, const void *b)
   struct PgpUid **s = (struct PgpUid **) a;
   struct PgpUid **t = (struct PgpUid **) b;
 
-  if ((r = ((*s)->parent->gen_time - (*t)->parent->gen_time)))
-    return r > 0;
+  r = ((*s)->parent->gen_time - (*t)->parent->gen_time);
+  if (r != 0)
+    return (r > 0);
   return (mutt_str_strcasecmp((*s)->addr, (*t)->addr) > 0);
 }
 
@@ -375,17 +377,22 @@ static int compare_key_trust(const void *a, const void *b)
   struct PgpUid **s = (struct PgpUid **) a;
   struct PgpUid **t = (struct PgpUid **) b;
 
-  if ((r = (((*s)->parent->flags & (KEYFLAG_RESTRICTIONS)) -
-            ((*t)->parent->flags & (KEYFLAG_RESTRICTIONS)))))
-    return r > 0;
-  if ((r = ((*s)->trust - (*t)->trust)))
-    return r < 0;
-  if ((r = ((*s)->parent->keylen - (*t)->parent->keylen)))
-    return r < 0;
-  if ((r = ((*s)->parent->gen_time - (*t)->parent->gen_time)))
-    return r < 0;
-  if ((r = mutt_str_strcasecmp((*s)->addr, (*t)->addr)))
-    return r > 0;
+  r = (((*s)->parent->flags & (KEYFLAG_RESTRICTIONS)) -
+       ((*t)->parent->flags & (KEYFLAG_RESTRICTIONS)));
+  if (r != 0)
+    return (r > 0);
+  r = ((*s)->trust - (*t)->trust);
+  if (r != 0)
+    return (r < 0);
+  r = ((*s)->parent->keylen - (*t)->parent->keylen);
+  if (r != 0)
+    return (r < 0);
+  r = ((*s)->parent->gen_time - (*t)->parent->gen_time);
+  if (r != 0)
+    return (r < 0);
+  r = mutt_str_strcasecmp((*s)->addr, (*t)->addr);
+  if (r != 0)
+    return (r > 0);
   return (mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent),
                               pgp_fpr_or_lkeyid((*t)->parent)) > 0);
 }
@@ -579,8 +586,9 @@ static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys,
         snprintf(tmpbuf, sizeof(tmpbuf), "0x%s",
                  pgp_fpr_or_lkeyid(pgp_principal_key(KeyTable[menu->current]->parent)));
 
-        if ((thepid = pgp_invoke_verify_key(NULL, NULL, NULL, -1, fileno(fp),
-                                            fileno(devnull), tmpbuf)) == -1)
+        thepid = pgp_invoke_verify_key(NULL, NULL, NULL, -1, fileno(fp),
+                                       fileno(devnull), tmpbuf);
+        if (thepid == -1)
         {
           mutt_perror(_("Can't create filter"));
           unlink(tempfile);
@@ -707,7 +715,8 @@ struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, en
       }
     }
 
-    if ((key = pgp_getkeybystr(resp, abilities, keyring)))
+    key = pgp_getkeybystr(resp, abilities, keyring);
+    if (key)
       return key;
 
     mutt_error(_("No matching keys found for \"%s\""), resp);
@@ -764,8 +773,8 @@ struct Body *pgp_make_key_attachment(char *tempf)
 
   mutt_message(_("Invoking PGP..."));
 
-  if ((thepid = pgp_invoke_export(NULL, NULL, NULL, -1, fileno(tempfp),
-                                  fileno(devnull), tmp)) == -1)
+  thepid = pgp_invoke_export(NULL, NULL, NULL, -1, fileno(tempfp), fileno(devnull), tmp);
+  if (thepid == -1)
   {
     mutt_perror(_("Can't create filter"));
     unlink(tempf);
@@ -938,7 +947,8 @@ struct PgpKeyInfo *pgp_getkeybyaddr(struct Address *a, short abilities,
       /*
        * Else: Ask the user.
        */
-      if ((k = pgp_select_key(matches, a, NULL)))
+      k = pgp_select_key(matches, a, NULL);
+      if (k)
         pgp_remove_key(&matches, k);
     }
 
@@ -1025,7 +1035,8 @@ struct PgpKeyInfo *pgp_getkeybystr(char *p, short abilities, enum PgpRing keyrin
 
   if (matches)
   {
-    if ((k = pgp_select_key(matches, NULL, p)))
+    k = pgp_select_key(matches, NULL, p);
+    if (k)
       pgp_remove_key(&matches, k);
 
     pgp_free_key(&matches);
index 014acb7dc74d4123ce76e47bee9a67b8c5df4bc9..fba62f89379e9040109d2172c59ecafcaff9dca2 100644 (file)
@@ -756,7 +756,8 @@ static struct SmimeKey *smime_ask_for_key(char *prompt, short abilities, short p
     if (mutt_get_field(prompt, resp, sizeof(resp), MUTT_CLEAR) != 0)
       return NULL;
 
-    if ((key = smime_get_key_by_str(resp, abilities, public)))
+    key = smime_get_key_by_str(resp, abilities, public);
+    if (key)
       return key;
 
     mutt_error(_("No matching keys found for \"%s\""), resp);
@@ -938,9 +939,9 @@ static int smime_handle_cert_email(char *certificate, char *mailbox, int copy,
   }
   mutt_file_unlink(tmpfname);
 
-  if ((thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr),
-                             certificate, NULL, NULL, NULL, NULL, NULL, NULL,
-                             SmimeGetCertEmailCommand)) == -1)
+  thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr), certificate,
+                        NULL, NULL, NULL, NULL, NULL, NULL, SmimeGetCertEmailCommand);
+  if (thepid == -1)
   {
     mutt_message(_("Error: unable to create OpenSSL subprocess!"));
     mutt_file_fclose(&fperr);
@@ -1034,8 +1035,9 @@ static char *smime_extract_certificate(char *infile)
   /* Step 1: Convert the signature to a PKCS#7 structure, as we can't
      extract the full set of certificates directly.
   */
-  if ((thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr), infile, NULL,
-                             NULL, NULL, NULL, NULL, NULL, SmimePk7outCommand)) == -1)
+  thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr), infile,
+                        NULL, NULL, NULL, NULL, NULL, NULL, SmimePk7outCommand);
+  if (thepid == -1)
   {
     mutt_any_key_to_continue(_("Error: unable to create OpenSSL subprocess!"));
     mutt_file_fclose(&fperr);
@@ -1074,8 +1076,9 @@ static char *smime_extract_certificate(char *infile)
 
   /* Step 2: Extract the certificates from a PKCS#7 structure.
    */
-  if ((thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr), pk7out, NULL,
-                             NULL, NULL, NULL, NULL, NULL, SmimeGetCertCommand)) == -1)
+  thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr), pk7out,
+                        NULL, NULL, NULL, NULL, NULL, NULL, SmimeGetCertCommand);
+  if (thepid == -1)
   {
     mutt_any_key_to_continue(_("Error: unable to create OpenSSL subprocess!"));
     mutt_file_fclose(&fperr);
@@ -1137,8 +1140,9 @@ static char *smime_extract_signer_certificate(char *infile)
 
   /* Extract signer's certificate
    */
-  if ((thepid = smime_invoke(NULL, NULL, NULL, -1, -1, fileno(fperr), infile, NULL, NULL, NULL,
-                             NULL, certfile, NULL, SmimeGetSignerCertCommand)) == -1)
+  thepid = smime_invoke(NULL, NULL, NULL, -1, -1, fileno(fperr), infile, NULL, NULL,
+                        NULL, NULL, certfile, NULL, SmimeGetSignerCertCommand);
+  if (thepid == -1)
   {
     mutt_any_key_to_continue(_("Error: unable to create OpenSSL subprocess!"));
     mutt_file_fclose(&fperr);
@@ -1213,13 +1217,14 @@ void smime_invoke_import(char *infile, char *mailbox)
   }
 
   mutt_endwin(NULL);
-  if ((certfile = smime_extract_certificate(infile)))
+  certfile = smime_extract_certificate(infile);
+  if (certfile)
   {
     mutt_endwin(NULL);
 
-    if ((thepid = smime_invoke(&smimein, NULL, NULL, -1, fileno(fpout),
-                               fileno(fperr), certfile, NULL, NULL, NULL, NULL,
-                               NULL, NULL, SmimeImportCertCommand)) == -1)
+    thepid = smime_invoke(&smimein, NULL, NULL, -1, fileno(fpout), fileno(fperr), certfile,
+                          NULL, NULL, NULL, NULL, NULL, NULL, SmimeImportCertCommand);
+    if (thepid == -1)
     {
       mutt_message(_("Error: unable to create OpenSSL subprocess!"));
       return;
@@ -1282,7 +1287,8 @@ int smime_verify_sender(struct Header *h)
 
   if (mbox)
   {
-    if ((certfile = smime_extract_signer_certificate(tempfname)))
+    certfile = smime_extract_signer_certificate(tempfname);
+    if (certfile)
     {
       mutt_file_unlink(tempfname);
       if (smime_handle_cert_email(certfile, mbox, 0, NULL, NULL))
@@ -1370,7 +1376,8 @@ struct Body *smime_build_smime_entity(struct Body *a, char *certlist)
   *certfile = '\0';
   for (cert_start = certlist; cert_start; cert_start = cert_end)
   {
-    if ((cert_end = strchr(cert_start, ' ')))
+    cert_end = strchr(cert_start, ' ');
+    if (cert_end)
       *cert_end = '\0';
     if (*cert_start)
     {
@@ -1388,8 +1395,9 @@ struct Body *smime_build_smime_entity(struct Body *a, char *certlist)
   mutt_write_mime_body(a, fptmp);
   mutt_file_fclose(&fptmp);
 
-  if ((thepid = smime_invoke_encrypt(&smimein, NULL, NULL, -1, fileno(fpout),
-                                     fileno(smimeerr), smimeinfile, certfile)) == -1)
+  thepid = smime_invoke_encrypt(&smimein, NULL, NULL, -1, fileno(fpout),
+                                fileno(smimeerr), smimeinfile, certfile);
+  if (thepid == -1)
   {
     mutt_file_fclose(&smimeerr);
     mutt_file_unlink(smimeinfile);
@@ -1538,8 +1546,8 @@ struct Body *smime_sign_message(struct Body *a)
 
   smime_free_key(&default_key);
 
-  if ((thepid = smime_invoke_sign(&smimein, NULL, &smimeerr, -1,
-                                  fileno(smimeout), -1, filetosign)) == -1)
+  thepid = smime_invoke_sign(&smimein, NULL, &smimeerr, -1, fileno(smimeout), -1, filetosign);
+  if (thepid == -1)
   {
     mutt_perror(_("Can't open OpenSSL subprocess!"));
     mutt_file_fclose(&smimeout);
@@ -1696,8 +1704,9 @@ int smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile)
 
   crypt_current_time(s, "OpenSSL");
 
-  if ((thepid = smime_invoke_verify(NULL, &smimeout, NULL, -1, -1, fileno(smimeerr),
-                                    tempfile, signedfile, 0)) != -1)
+  thepid = smime_invoke_verify(NULL, &smimeout, NULL, -1, -1, fileno(smimeerr),
+                               tempfile, signedfile, 0);
+  if (thepid != -1)
   {
     fflush(smimeout);
     mutt_file_fclose(&smimeout);
@@ -2157,7 +2166,8 @@ int smime_send_menu(struct Header *msg)
       case 'S': /* (s)ign in oppenc mode */
         if (!SmimeDefaultKey)
         {
-          if ((key = smime_ask_for_key(_("Sign as: "), KEYFLAG_CANSIGN, 0)))
+          key = smime_ask_for_key(_("Sign as: "), KEYFLAG_CANSIGN, 0);
+          if (key)
           {
             mutt_str_replace(&SmimeDefaultKey, key->hash);
             smime_free_key(&key);
@@ -2172,7 +2182,8 @@ int smime_send_menu(struct Header *msg)
 
       case 'a': /* sign (a)s */
 
-        if ((key = smime_ask_for_key(_("Sign as: "), KEYFLAG_CANSIGN, 0)))
+        key = smime_ask_for_key(_("Sign as: "), KEYFLAG_CANSIGN, 0);
+        if (key)
         {
           mutt_str_replace(&SmimeDefaultKey, key->hash);
           smime_free_key(&key);
diff --git a/pager.c b/pager.c
index b751723472b6066cab409fa14add69ca871dc9c6..ff85565f045ea719fc786581173c6289be262c8d 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -1545,8 +1545,8 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **line_info,
     goto out; /* fake display */
   }
 
-  if ((b_read = fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt,
-                            &buflen, &buf_ready)) < 0)
+  b_read = fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt, &buflen, &buf_ready);
+  if (b_read < 0)
   {
     if (change_last)
       (*last)--;
@@ -1807,10 +1807,12 @@ static void pager_menu_redraw(struct Menu *pager_menu)
 #if defined(USE_SLANG_CURSES) || defined(HAVE_RESIZETERM)
     if (Resize)
     {
-      if ((rd->search_compiled = Resize->search_compiled))
+      rd->search_compiled = Resize->search_compiled;
+      if (rd->search_compiled)
       {
-        if ((err = REGCOMP(&rd->search_re, rd->searchbuf,
-                           REG_NEWLINE | mutt_which_case(rd->searchbuf))) != 0)
+        err = REGCOMP(&rd->search_re, rd->searchbuf,
+                      REG_NEWLINE | mutt_which_case(rd->searchbuf));
+        if (err != 0)
         {
           regerror(err, &rd->search_re, buffer, sizeof(buffer));
           mutt_error("%s", buffer);
@@ -2499,8 +2501,8 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e
           }
         }
 
-        if ((err = REGCOMP(&rd.search_re, searchbuf,
-                           REG_NEWLINE | mutt_which_case(searchbuf))) != 0)
+        err = REGCOMP(&rd.search_re, searchbuf, REG_NEWLINE | mutt_which_case(searchbuf));
+        if (err != 0)
         {
           regerror(err, &rd.search_re, buffer, sizeof(buffer));
           mutt_error("%s", buffer);
diff --git a/parse.c b/parse.c
index 0b28d37f2a904d004b4c525bd2b6575548120431..56da6e91eb38fb4ef052fcac216b2f35e41a7c58 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -325,18 +325,21 @@ void mutt_parse_content_type(char *s, struct Body *ct)
     /* Some pre-RFC1521 gateways still use the "name=filename" convention,
      * but if a filename has already been set in the content-disposition,
      * let that take precedence, and don't set it here */
-    if ((pc = mutt_param_get("name", ct->parameter)) && !ct->filename)
+    pc = mutt_param_get("name", ct->parameter);
+    if (pc && !ct->filename)
       ct->filename = mutt_str_strdup(pc);
 
 #ifdef SUN_ATTACHMENT
     /* this is deep and utter perversion */
-    if ((pc = mutt_param_get("conversions", ct->parameter)))
+    pc = mutt_param_get("conversions", ct->parameter);
+    if (pc)
       ct->encoding = mutt_check_encoding(pc);
 #endif
   }
 
   /* Now get the subtype */
-  if ((subtype = strchr(s, '/')))
+  subtype = strchr(s, '/');
+  if (subtype)
   {
     *subtype++ = '\0';
     for (pc = subtype; *pc && !ISSPACE(*pc) && *pc != ';'; pc++)
@@ -410,9 +413,11 @@ static void parse_content_disposition(const char *s, struct Body *ct)
   if (s)
   {
     s = mutt_str_skip_email_wsp(s + 1);
-    if ((s = mutt_param_get("filename", (parms = parse_parameters(s)))))
+    s = mutt_param_get("filename", (parms = parse_parameters(s)));
+    if (s)
       mutt_str_replace(&ct->filename, s);
-    if ((s = mutt_param_get("name", parms)))
+    s = mutt_param_get("name", parms);
+    if (s)
       ct->form_name = mutt_str_strdup(s);
     mutt_param_free(&parms);
   }
@@ -439,7 +444,8 @@ struct Body *mutt_read_mime_header(FILE *fp, int digest)
   while (*(line = mutt_read_rfc822_line(fp, line, &linelen)) != 0)
   {
     /* Find the value of the current header */
-    if ((c = strchr(line, ':')))
+    c = strchr(line, ':');
+    if (c)
     {
       *c = 0;
       c = mutt_str_skip_email_wsp(c + 1);
@@ -745,7 +751,8 @@ void mutt_parse_mime_message(struct Context *ctx, struct Header *cur)
     if (cur->content->parts)
       break; /* The message was parsed earlier. */
 
-    if ((msg = mx_open_message(ctx, cur->msgno)))
+    msg = mx_open_message(ctx, cur->msgno);
+    if (msg)
     {
       mutt_parse_part(msg->fp, cur->content);
 
index bce00f13bff858190335b05ddc1ba2f083551fa8..bfe145cf9cd022fa913954713456fd7e39e12763 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -2147,8 +2147,9 @@ int mutt_search_command(int cur, int op)
     {
       /* remember that we've already searched this message */
       h->searched = true;
-      if ((h->matched = (mutt_pattern_exec(SearchPattern, MUTT_MATCH_FULL_ADDRESS,
-                                           Context, h, NULL) > 0)))
+      h->matched =
+          mutt_pattern_exec(SearchPattern, MUTT_MATCH_FULL_ADDRESS, Context, h, NULL);
+      if (h->matched > 0)
       {
         mutt_clear_error();
         if (msg && *msg)
index 93e1c02cf52535d20a2c767a9e918521b388efa3..3f66ea8590edff26b54637171a024813b14ddf15 100644 (file)
@@ -896,7 +896,8 @@ int main(int argc, char *const argv[])
     mutt_str_strfcpy(kring, tmp_kring, sizeof(kring));
   else
   {
-    if ((env_pgppath = getenv("PGPPATH")))
+    env_pgppath = getenv("PGPPATH");
+    if (env_pgppath)
       mutt_str_strfcpy(pgppath, env_pgppath, sizeof(pgppath));
     else if ((env_home = getenv("HOME")))
       snprintf(pgppath, sizeof(pgppath), "%s/.pgp", env_home);
diff --git a/pop.c b/pop.c
index 6ba4fb09b3a12bf008a84663ae0e5f9cbe23078d..e72f597b1a76dd53e2b17909a43399a9f92831fc 100644 (file)
--- a/pop.c
+++ b/pop.c
@@ -327,7 +327,8 @@ static int pop_fetch_headers(struct Context *ctx)
       if (!ctx->quiet)
         mutt_progress_update(&progress, i + 1 - old_count, -1);
 #ifdef USE_HCACHE
-      if ((data = mutt_hcache_fetch(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data))))
+      data = mutt_hcache_fetch(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data));
+      if (data)
       {
         char *uidl = mutt_str_strdup(ctx->hdrs[i]->data);
         int refno = ctx->hdrs[i]->refno;
@@ -557,7 +558,8 @@ static int pop_fetch_message(struct Context *ctx, struct Message *msg, int msgno
   unsigned short bcache = 1;
 
   /* see if we already have the message in body cache */
-  if ((msg->fp = mutt_bcache_get(pop_data->bcache, h->data)))
+  msg->fp = mutt_bcache_get(pop_data->bcache, h->data);
+  if (msg->fp)
     return 0;
 
   /*
diff --git a/query.c b/query.c
index d9664783450ed7214c80623af09846b6e871e773..674d9ff0b66154657444bdd7381ed370888f4695 100644 (file)
--- a/query.c
+++ b/query.c
@@ -135,11 +135,13 @@ static struct Query *run_query(char *s, int quiet)
   if (!quiet)
     mutt_message(_("Waiting for response..."));
   fgets(msg, sizeof(msg), fp);
-  if ((p = strrchr(msg, '\n')))
+  p = strrchr(msg, '\n');
+  if (p)
     *p = '\0';
   while ((buf = mutt_file_read_line(buf, &buflen, fp, &dummy, 0)) != NULL)
   {
-    if ((p = strtok(buf, "\t\n")))
+    p = strtok(buf, "\t\n");
+    if (p)
     {
       if (!first)
       {
index 9daa9b009675e89fc1091ec33ab53fa40515b964..3c5ab604167e4977dcaf872668c684810396d55d 100644 (file)
@@ -514,8 +514,8 @@ static int query_save_attachment(FILE *fp, struct Body *body,
     }
     else
     {
-      if ((rc = mutt_check_overwrite(body->filename, buf, tfile, sizeof(tfile),
-                                     &append, directory)) == -1)
+      rc = mutt_check_overwrite(body->filename, buf, tfile, sizeof(tfile), &append, directory);
+      if (rc == -1)
         return -1;
       else if (rc == 1)
       {
index 372cc0bc6ce8627b747121b263e1fdf0547527cf..22600119b474f955c57bb4a33e8235cc752fea7f 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -467,9 +467,10 @@ static void attach_forward_bodies(FILE *fp, struct Header *hdr, struct AttachCtx
 
   if (!mime_fwd_all && !cur && (nattach > 1) && !check_can_decode(actx, cur))
   {
-    if ((rc = query_quadoption(OPT_MIME_FORWARD_REST,
-                               _("Can't decode all tagged attachments.  "
-                                 "MIME-forward the others?"))) == MUTT_ABORT)
+    rc = query_quadoption(
+        OPT_MIME_FORWARD_REST,
+        _("Can't decode all tagged attachments.  MIME-forward the others?"));
+    if (rc == MUTT_ABORT)
       goto bail;
     else if (rc == MUTT_NO)
       mime_fwd_any = false;
@@ -590,8 +591,8 @@ static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, struct Body *c
 
   tmpbody[0] = '\0';
 
-  if ((rc = query_quadoption(OPT_MIME_FORWARD,
-                             _("Forward MIME encapsulated?"))) == MUTT_NO)
+  rc = query_quadoption(OPT_MIME_FORWARD, _("Forward MIME encapsulated?"));
+  if (rc == MUTT_NO)
   {
     /* no MIME encapsulation */
 
@@ -844,9 +845,10 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx,
 
   if (nattach > 1 && !check_can_decode(actx, cur))
   {
-    if ((rc = query_quadoption(OPT_MIME_FORWARD_REST,
-                               _("Can't decode all tagged attachments.  "
-                                 "MIME-encapsulate the others?"))) == MUTT_ABORT)
+    rc = query_quadoption(OPT_MIME_FORWARD_REST,
+                          _("Can't decode all tagged attachments.  "
+                            "MIME-encapsulate the others?"));
+    if (rc == MUTT_ABORT)
       return;
     else if (rc == MUTT_YES)
       mime_reply_any = true;
index c40895b97a898af03b72807223e66527cb0ac94a..2b2a5b2b5879dd979e26d4e28226731e785f6856 100644 (file)
@@ -678,7 +678,8 @@ void mix_make_chain(struct ListHead *chainhead)
   {
     for (int i = 0; i < chain->cl; i++)
     {
-      if ((j = chain->ch[i]))
+      j = chain->ch[i];
+      if (j != 0)
         t = type2_list[j]->shortname;
       else
         t = "*";
index e7af709fb878f83c22ca58332b541d55060fc077..663ea75bee434373c813855b4a56761480bba5f1 100644 (file)
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -483,7 +483,8 @@ static int rfc2047_encode(const char *d, size_t dlen, int col, const char *fromc
   tocode = fromcode;
   if (icode)
   {
-    if ((tocode1 = mutt_choose_charset(icode, charsets, u, ulen, 0, 0)))
+    tocode1 = mutt_choose_charset(icode, charsets, u, ulen, 0, 0);
+    if (tocode1)
       tocode = tocode1;
     else
     {
@@ -677,7 +678,8 @@ static int rfc2047_decode_word(char *d, const char *s, size_t len)
       case 2:
         /* ignore language specification a la RFC2231 */
         t = pp1;
-        if ((t1 = memchr(pp, '*', t - pp)))
+        t1 = memchr(pp, '*', t - pp);
+        if (t1)
           t = t1;
         charset = mutt_str_substr_dup(pp, t);
         break;
index c59295f5bd7bac33650b420ed96dde0abeef01e7..e5b377628b5f9ceabbcd59a4d868aebbd165cc91 100644 (file)
--- a/rfc2231.c
+++ b/rfc2231.c
@@ -89,7 +89,8 @@ static char *rfc2231_get_charset(char *value, char *charset, size_t chslen)
   *t = '\0';
   mutt_str_strfcpy(charset, value, chslen);
 
-  if ((u = strchr(t + 1, '\'')))
+  u = strchr(t + 1, '\'');
+  if (u)
     return u + 1;
   else
     return t + 1;
@@ -177,7 +178,8 @@ static void rfc2231_join_continuations(struct Parameter **head, struct Rfc2231Pa
 
     mutt_str_strfcpy(attribute, par->attribute, sizeof(attribute));
 
-    if ((encoded = par->encoded))
+    encoded = par->encoded;
+    if (encoded != 0)
       valp = rfc2231_get_charset(par->value, charset, sizeof(charset));
     else
       valp = par->value;
@@ -195,7 +197,8 @@ static void rfc2231_join_continuations(struct Parameter **head, struct Rfc2231Pa
 
       q = par->next;
       rfc2231_free_parameter(&par);
-      if ((par = q))
+      par = q;
+      if (par)
         valp = par->value;
     } while (par && (strcmp(par->attribute, attribute) == 0));
 
index b735f3eafeadc1e63ffcb56071baf470fafe42c3..2c8ca21f18100b00ce7905b2c8b43dcde13c805e 100644 (file)
--- a/rfc3676.c
+++ b/rfc3676.c
@@ -277,7 +277,8 @@ int rfc3676_handler(struct Body *a, struct State *s)
   memset(&fst, 0, sizeof(fst));
 
   /* respect DelSp of RFC3676 only with f=f parts */
-  if ((t = (char *) mutt_param_get("delsp", a->parameter)))
+  t = mutt_param_get("delsp", a->parameter);
+  if (t)
   {
     delsp = mutt_str_strlen(t) == 3 && (mutt_str_strncasecmp(t, "yes", 3) == 0);
     t = NULL;
index 1a06c695a0845a0215b192abfd9d0d9837b4d2fb..e1eed0a6771531d8f443db83fe3d3b0ce6feed24 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -390,7 +390,8 @@ int mutt_write_mime_header(struct Body *a, FILE *f)
           char *tmp = NULL;
 
           /* Strip off the leading path... */
-          if ((t = strrchr(fn, '/')))
+          t = strrchr(fn, '/');
+          if (t)
             t++;
           else
             t = fn;
@@ -1042,7 +1043,8 @@ int mutt_lookup_mime_type(struct Body *att, const char *path)
       while (fgets(buf, sizeof(buf) - 1, f) != NULL)
       {
         /* weed out any comments */
-        if ((p = strchr(buf, '#')))
+        p = strchr(buf, '#');
+        if (p)
           *p = 0;
 
         /* remove any leading space. */
@@ -1557,7 +1559,8 @@ static bool check_boundary(const char *boundary, struct Body *b)
   if (b->next && check_boundary(boundary, b->next))
     return true;
 
-  if ((p = mutt_param_get("boundary", b->parameter)) && (mutt_str_strcmp(p, boundary) == 0))
+  p = mutt_param_get("boundary", b->parameter);
+  if (p && (mutt_str_strcmp(p, boundary) == 0))
   {
     return true;
   }
@@ -2153,7 +2156,8 @@ int mutt_write_rfc822_header(FILE *fp, struct Envelope *env,
   struct ListNode *tmp;
   STAILQ_FOREACH(tmp, &env->userhdrs, entries)
   {
-    if ((p = strchr(tmp->data, ':')))
+    p = strchr(tmp->data, ':');
+    if (p)
     {
       q = p;
 
@@ -2230,7 +2234,8 @@ const char *mutt_fqdn(short may_hide_host)
 
     if (may_hide_host && option(OPT_HIDDEN_HOST))
     {
-      if ((p = strchr(Hostname, '.')))
+      p = strchr(Hostname, '.');
+      if (p)
         p++;
 
       /* sanity check: don't hide the host if
@@ -2606,8 +2611,8 @@ int mutt_invoke_sendmail(struct Address *from, struct Address *to, struct Addres
   if (!option(OPT_NO_CURSES))
     mutt_need_hard_redraw();
 
-  if ((i = send_msg(path, args, msg, option(OPT_NO_CURSES) ? NULL : &childout)) !=
-      (EX_OK & 0xff))
+  i = send_msg(path, args, msg, option(OPT_NO_CURSES) ? NULL : &childout);
+  if (i != (EX_OK & 0xff))
   {
     if (i != S_BKG)
     {
index 17d3b53ef651e4267426c21a6143ee559b466318..2a286f08f0c1b061bf2fc3b521c7e340c0326966 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -252,8 +252,8 @@ static const char *sidebar_format_str(char *buf, size_t buflen, size_t col, int
  * mutt_expando_format to do the actual work. mutt_expando_format will callback to
  * us using sidebar_format_str() for the sidebar specific formatting characters.
  */
-static void make_sidebar_entry(char *buf, size_t buflen, int width,
-                               char *box, struct SbEntry *sbe)
+static void make_sidebar_entry(char *buf, size_t buflen, int width, char *box,
+                               struct SbEntry *sbe)
 {
   if (!buf || !box || !sbe)
     return;
diff --git a/smtp.c b/smtp.c
index 3e722d300c6d8a9dbb1011053606cb02dcef8417..723e77fa8e9284e3a54361254af7f6c2eac16013 100644 (file)
--- a/smtp.c
+++ b/smtp.c
@@ -162,7 +162,8 @@ static int smtp_rcpt_to(struct Connection *conn, const struct Address *a)
       snprintf(buf, sizeof(buf), "RCPT TO:<%s>\r\n", a->mailbox);
     if (mutt_socket_write(conn, buf) == -1)
       return SMTP_ERR_WRITE;
-    if ((r = smtp_get_resp(conn)))
+    r = smtp_get_resp(conn);
+    if (r != 0)
       return r;
     a = a->next;
   }
@@ -196,7 +197,8 @@ static int smtp_data(struct Connection *conn, const char *msgfile)
     mutt_file_fclose(&fp);
     return SMTP_ERR_WRITE;
   }
-  if ((r = smtp_get_resp(conn)))
+  r = smtp_get_resp(conn);
+  if (r != 0)
   {
     mutt_file_fclose(&fp);
     return r;
@@ -234,7 +236,8 @@ static int smtp_data(struct Connection *conn, const char *msgfile)
   if (mutt_socket_write(conn, ".\r\n") == -1)
     return SMTP_ERR_WRITE;
 
-  if ((r = smtp_get_resp(conn)))
+  r = smtp_get_resp(conn);
+  if (r != 0)
     return r;
 
   return 0;
@@ -579,10 +582,12 @@ static int smtp_open(struct Connection *conn)
     return -1;
 
   /* get greeting string */
-  if ((rc = smtp_get_resp(conn)))
+  rc = smtp_get_resp(conn);
+  if (rc != 0)
     return rc;
 
-  if ((rc = smtp_helo(conn)))
+  rc = smtp_helo(conn);
+  if (rc != 0)
     return rc;
 
 #ifdef USE_SSL
@@ -599,7 +604,8 @@ static int smtp_open(struct Connection *conn)
   {
     if (mutt_socket_write(conn, "STARTTLS\r\n") < 0)
       return SMTP_ERR_WRITE;
-    if ((rc = smtp_get_resp(conn)))
+    rc = smtp_get_resp(conn);
+    if (rc != 0)
       return rc;
 
     if (mutt_ssl_starttls(conn))
@@ -610,7 +616,8 @@ static int smtp_open(struct Connection *conn)
     }
 
     /* re-EHLO to get authentication mechanisms */
-    if ((rc = smtp_helo(conn)))
+    rc = smtp_helo(conn);
+    if (rc != 0)
       return rc;
   }
 #endif
@@ -668,7 +675,8 @@ int mutt_smtp_send(const struct Address *from, const struct Address *to,
   do
   {
     /* send our greeting */
-    if ((rc = smtp_open(conn)))
+    rc = smtp_open(conn);
+    if (rc != 0)
       break;
     FREE(&AuthMechs);
 
@@ -691,7 +699,8 @@ int mutt_smtp_send(const struct Address *from, const struct Address *to,
       rc = SMTP_ERR_WRITE;
       break;
     }
-    if ((rc = smtp_get_resp(conn)))
+    rc = smtp_get_resp(conn);
+    if (rc != 0)
       break;
 
     /* send the recipient list */
@@ -700,7 +709,8 @@ int mutt_smtp_send(const struct Address *from, const struct Address *to,
       break;
 
     /* send the message data */
-    if ((rc = smtp_data(conn, msgfile)))
+    rc = smtp_data(conn, msgfile);
+    if (rc != 0)
       break;
 
     mutt_socket_write(conn, "QUIT\r\n");
diff --git a/url.c b/url.c
index c2eee6895eb20e86e079c7f67ec4f825d0f29d96..3487f8c441e89ae368f9ff329f4835708fd3cec6 100644 (file)
--- a/url.c
+++ b/url.c
@@ -105,10 +105,12 @@ static int parse_query_string(struct Url *u, char *src)
   while (src && *src)
   {
     qs = mutt_mem_calloc(1, sizeof(struct UrlQueryString));
-    if ((k = strchr(src, '&')))
+    k = strchr(src, '&');
+    if (k)
       *k = '\0';
 
-    if ((v = strchr(src, '=')))
+    v = strchr(src, '=');
+    if (v)
     {
       *v = '\0';
       qs->value = v + 1;
@@ -173,23 +175,27 @@ int url_parse(struct Url *u, char *src)
 
   src += 2;
 
-  if ((t = strchr(src, '?')))
+  t = strchr(src, '?');
+  if (t)
   {
     *t++ = '\0';
     if (parse_query_string(u, t) < 0)
       goto err;
   }
 
-  if ((u->path = strchr(src, '/')))
+  u->path = strchr(src, '/');
+  if (u->path)
     *u->path++ = '\0';
 
   if (u->path && url_pct_decode(u->path) < 0)
     goto err;
 
-  if ((t = strrchr(src, '@')))
+  t = strrchr(src, '@');
+  if (t)
   {
     *t = '\0';
-    if ((p = strchr(src, ':')))
+    p = strchr(src, ':');
+    if (p)
     {
       *p = '\0';
       u->pass = p + 1;
@@ -213,7 +219,8 @@ int url_parse(struct Url *u, char *src)
   else
     t = src;
 
-  if ((p = strchr(t, ':')))
+  p = strchr(t, ':');
+  if (p)
   {
     int num;
     *p++ = '\0';
@@ -357,7 +364,8 @@ int url_parse_mailto(struct Envelope *e, char **body, const char *src)
   if (!tmp)
     return -1;
 
-  if ((headers = strchr(tmp, '?')))
+  headers = strchr(tmp, '?');
+  if (headers)
     *headers++ = '\0';
 
   if (url_pct_decode(tmp) < 0)
@@ -369,7 +377,8 @@ int url_parse_mailto(struct Envelope *e, char **body, const char *src)
 
   for (; tag; tag = strtok_r(NULL, "&", &p))
   {
-    if ((value = strchr(tag, '=')))
+    value = strchr(tag, '=');
+    if (value)
       *value++ = '\0';
     if (!value || !*value)
       continue;