]> granicus.if.org Git - neomutt/commitdiff
kill unnecessary == NULL
authorRichard Russon <rich@flatcap.org>
Fri, 17 Aug 2018 01:20:19 +0000 (02:20 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 19 Aug 2018 12:44:06 +0000 (13:44 +0100)
38 files changed:
alias.c
complete.c
compose.c
copy.c
curs_main.c
edit.c
editmsg.c
email/parameter.c
email/parse.c
email/rfc2047.c
handler.c
hdrline.c
imap/util.c
maildir/mh.c
mbox/mbox.c
mutt/file.c
mutt/history.c
mutt/path.c
mutt/regex.c
mutt_attach.c
mutt_lua.c
mutt_thread.c
mx.c
ncrypt/crypt.c
ncrypt/crypt_gpgme.c
ncrypt/pgp.c
nntp/newsrc.c
nntp/nntp.c
notmuch/mutt_notmuch.c
pager.c
pattern.c
pop/pop.c
postpone.c
recvcmd.c
remailer.c
send.c
sendlib.c
sort.c

diff --git a/alias.c b/alias.c
index 077a0c09da6d687152c53aee33c17df23656514d..1ab40fb1d2ea715dcd1c5b7a29c30f0595e32a54 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -213,7 +213,7 @@ static int check_alias_name(const char *s, char *dest, size_t destlen)
     int bad = l == (size_t)(-1) || l == (size_t)(-2); /* conversion error */
     bad = bad || (!dry && l > destlen); /* too few room for mb char */
     if (l == 1)
-      bad = bad || (strchr("-_+=.", *s) == NULL && !iswalnum(wc));
+      bad = bad || (!strchr("-_+=.", *s) && !iswalnum(wc));
     else
       bad = bad || !iswalnum(wc);
     if (bad)
index 67d242dd03318393f3ce69dfaf33cbe116341752..76f60db691fbfa0fcf89d08671fc614ff60bd151 100644 (file)
@@ -158,8 +158,8 @@ int mutt_complete(char *buf, size_t buflen)
     if (p)
     {
       char tmp[PATH_MAX];
-      if (mutt_path_concatn(tmp, sizeof(tmp), exp_dirpart, strlen(exp_dirpart),
-                                 buf + 1, (size_t)(p - buf - 1)) == NULL)
+      if (!mutt_path_concatn(tmp, sizeof(tmp), exp_dirpart, strlen(exp_dirpart),
+                                 buf + 1, (size_t)(p - buf - 1)))
       {
         return -1;
       }
index ab32cc73f4fdffb73b14ebd65081ff8768e2d58e..8b7082378c624ebcc77fe363ef5f48af7b0cec5f 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -1200,7 +1200,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
 
             /* append bptr to the alts list,
              * and remove from the msg->content list */
-            if (alts == NULL)
+            if (!alts)
             {
               group->parts = alts = bptr;
               bptr = bptr->next;
@@ -1298,7 +1298,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
 
             /* append bptr to the alts list,
              * and remove from the msg->content list */
-            if (alts == NULL)
+            if (!alts)
             {
               group->parts = alts = bptr;
               bptr = bptr->next;
diff --git a/copy.c b/copy.c
index 18c22195ed58852f9f186ba779a98263e2b88b96..a1d086b20fe1bcdfa12f36d73591c2bf1a8974b4 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -102,7 +102,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end,
     {
       nl = strchr(buf, '\n');
 
-      if ((fgets(buf, sizeof(buf), in)) == NULL)
+      if (!fgets(buf, sizeof(buf), in))
         break;
 
       /* Is it the beginning of a header? */
@@ -177,7 +177,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end,
     nl = strchr(buf, '\n');
 
     /* Read a line */
-    if ((fgets(buf, sizeof(buf), in)) == NULL)
+    if (!fgets(buf, sizeof(buf), in))
       break;
 
     /* Is it the beginning of a header? */
@@ -820,7 +820,7 @@ static int append_message(struct Context *dest, FILE *fpin, struct Context *src,
 
   if (fseeko(fpin, hdr->offset, SEEK_SET) < 0)
     return -1;
-  if (fgets(buf, sizeof(buf), fpin) == NULL)
+  if (!fgets(buf, sizeof(buf), fpin))
     return -1;
 
   msg = mx_msg_open_new(dest, hdr, is_from(buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM);
index dd6de7407e8bf7011ce1dd86a3d181946b528c1c..cd3024ee5943ae53fce7ac4b7f813254d0bcba2b 100644 (file)
@@ -1330,7 +1330,7 @@ int mutt_index_menu(void)
             struct ListNode *ref = NULL;
             STAILQ_FOREACH(ref, &CURHDR->env->references, entries)
             {
-              if (mutt_hash_find(Context->id_hash, ref->data) == NULL)
+              if (!mutt_hash_find(Context->id_hash, ref->data))
               {
                 rc2 = nntp_check_msgid(Context, ref->data);
                 if (rc2 < 0)
diff --git a/edit.c b/edit.c
index dda2d5b4c2234a7faa82cd001cd698744cf1b2be..d1f775760eba30f5923f4a77131e6a87d893d61f 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -101,7 +101,7 @@ static char **be_snarf_data(FILE *f, char **buf, int *bufmax, int *buflen,
   fseeko(f, offset, SEEK_SET);
   while (bytes > 0)
   {
-    if (fgets(p, tmplen - 1, f) == NULL)
+    if (!fgets(p, tmplen - 1, f))
       break;
     bytes -= mutt_str_strlen(p);
     if (*bufmax == *buflen)
index 0263035f5e920dcaf287d5ce705591a1c3e520f2..bbd404cc5344aa91587175b961dd626421508243 100644 (file)
--- a/editmsg.c
+++ b/editmsg.c
@@ -83,7 +83,7 @@ static int edit_or_view_one_message(bool edit, struct Context *ctx, struct Heade
   omagic = MboxType;
   MboxType = MUTT_MBOX;
 
-  rc = (mx_mbox_open(tmp, MUTT_NEWFOLDER, &tmpctx) == NULL) ? -1 : 0;
+  rc = mx_mbox_open(tmp, MUTT_NEWFOLDER, &tmpctx) ? 0 : -1;
 
   MboxType = omagic;
 
@@ -185,7 +185,7 @@ static int edit_or_view_one_message(bool edit, struct Context *ctx, struct Heade
     goto bail;
   }
 
-  if (mx_mbox_open(ctx->path, MUTT_APPEND, &tmpctx) == NULL)
+  if (!mx_mbox_open(ctx->path, MUTT_APPEND, &tmpctx))
   {
     rc = -1;
     /* L10N: %s is from strerror(errno) */
index e38bda6cfb5ece2f500c412fe23717f28600ec93..8f3bad4666a2e7a077d479d2ab0e5d0d926c4009 100644 (file)
@@ -162,14 +162,10 @@ void mutt_param_delete(struct ParameterList *p, const char *attribute)
 bool mutt_param_cmp_strict(const struct ParameterList *p1, const struct ParameterList *p2)
 {
   if (!p1 && !p2)
-  {
     return false;
-  }
 
   if ((p1 == NULL) ^ (p2 == NULL))
-  {
     return true;
-  }
 
   struct Parameter *np1 = TAILQ_FIRST(p1);
   struct Parameter *np2 = TAILQ_FIRST(p2);
index 89082197127465592c755ddc2d6bb30dde223401..74392abd2d73488565ccbd81fcaa6ac6fb871945 100644 (file)
@@ -154,7 +154,7 @@ static void parse_parameters(struct ParameterList *param, const char *s)
     }
 
     /* Find the next parameter */
-    if ((*s != ';') && (s = strchr(s, ';')) == NULL)
+    if ((*s != ';') && !(s = strchr(s, ';')))
       break; /* no more parameters */
 
     do
index 162b878583c6a2a7d070c17ef851579e9acb0d5f..43b21b83a7f0c9ab7432f7de70d7265dedcc4c69 100644 (file)
@@ -142,7 +142,7 @@ static char *parse_encoded_word(char *str, enum ContentEncoding *enc, char **cha
   regmatch_t match[4];
   size_t nmatch = 4;
 
-  if (re == NULL)
+  if (!re)
   {
     re = mutt_regex_compile("=\\?"
                             "([^][()<>@,;:\\\"/?. =]+)" /* charset */
index bf70ec1af9119fe76f99ca8b4e6b3b57a29616fe..0d91566a413417fc43190894dc0d8e2fc132183c 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -314,7 +314,7 @@ static void decode_quoted(struct State *s, long len, bool istext, iconv_t cd)
      * lines are at most 76 characters, but we should be liberal about what
      * we accept.
      */
-    if (fgets(line, MIN((ssize_t) sizeof(line), len + 1), s->fpin) == NULL)
+    if (!fgets(line, MIN((ssize_t) sizeof(line), len + 1), s->fpin))
       break;
 
     size_t linelen = strlen(line);
@@ -374,7 +374,7 @@ static void decode_uuencoded(struct State *s, long len, bool istext, iconv_t cd)
 
   while (len > 0)
   {
-    if ((fgets(tmps, sizeof(tmps), s->fpin)) == NULL)
+    if (!fgets(tmps, sizeof(tmps), s->fpin))
       return;
     len -= mutt_str_strlen(tmps);
     if ((mutt_str_strncmp(tmps, "begin", 5) == 0) && ISSPACE(tmps[5]))
@@ -382,7 +382,7 @@ static void decode_uuencoded(struct State *s, long len, bool istext, iconv_t cd)
   }
   while (len > 0)
   {
-    if ((fgets(tmps, sizeof(tmps), s->fpin)) == NULL)
+    if (!fgets(tmps, sizeof(tmps), s->fpin))
       return;
     len -= mutt_str_strlen(tmps);
     if (mutt_str_strncmp(tmps, "end", 3) == 0)
index a6e5f72921abb80fa564f3052367f2cbe25f282c..35e982edb9ada65ebc70959ec34b8a64d9bc2fb1 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -429,7 +429,7 @@ static char *apply_subject_mods(struct Envelope *env)
   if (STAILQ_EMPTY(&SubjectRegexList))
     return env->subject;
 
-  if (env->subject == NULL || *env->subject == '\0')
+  if (!env->subject || *env->subject == '\0')
   {
     env->disp_subj = NULL;
     return NULL;
index d3d7ba65308121e60128b08de7dd40310e481dfb..3ae743fb5026e5eb5494cd3c2f0f22babdf429ec 100644 (file)
@@ -1019,8 +1019,8 @@ int imap_account_match(const struct Account *a1, const struct Account *a2)
 {
   struct ImapData *a1_idata = imap_conn_find(a1, MUTT_IMAP_CONN_NONEW);
   struct ImapData *a2_idata = imap_conn_find(a2, MUTT_IMAP_CONN_NONEW);
-  const struct Account *a1_canon = a1_idata == NULL ? a1 : &a1_idata->conn->account;
-  const struct Account *a2_canon = a2_idata == NULL ? a2 : &a2_idata->conn->account;
+  const struct Account *a1_canon = a1_idata ? &a1_idata->conn->account : a1;
+  const struct Account *a2_canon = a2_idata ? &a2_idata->conn->account : a2;
 
   return mutt_account_match(a1_canon, a2_canon);
 }
index f94bd5723420b06a1f7daa068159ca2fc42dcd56..3042b0dcf1671c9a60dae74601f1291059a6c58e 100644 (file)
@@ -1672,7 +1672,7 @@ static int maildir_mh_open_message(struct Context *ctx, struct Message *msg,
   snprintf(path, sizeof(path), "%s/%s", ctx->path, cur->path);
 
   msg->fp = fopen(path, "r");
-  if (msg->fp == NULL && errno == ENOENT && is_maildir)
+  if (!msg->fp && (errno == ENOENT) && is_maildir)
     msg->fp = maildir_open_find_message(ctx->path, cur->path, NULL);
 
   if (!msg->fp)
index 23e23f1a65f9b150c768bb6e6c8b73c39fd284fe..ba0a070b1c37f26d287ba73105a6d1d7e81eca8c 100644 (file)
@@ -144,7 +144,7 @@ static int mmdf_parse_mailbox(struct Context *ctx)
 
   while (true)
   {
-    if (fgets(buf, sizeof(buf) - 1, ctx->fp) == NULL)
+    if (!fgets(buf, sizeof(buf) - 1, ctx->fp))
       break;
 
     if (SigInt == 1)
@@ -166,7 +166,7 @@ static int mmdf_parse_mailbox(struct Context *ctx)
       hdr->offset = loc;
       hdr->index = ctx->msgcount;
 
-      if (fgets(buf, sizeof(buf) - 1, ctx->fp) == NULL)
+      if (!fgets(buf, sizeof(buf) - 1, ctx->fp))
       {
         /* TODO: memory leak??? */
         mutt_debug(1, "unexpected EOF\n");
@@ -200,7 +200,7 @@ static int mmdf_parse_mailbox(struct Context *ctx)
         if ((tmploc > 0) && (tmploc < ctx->size))
         {
           if (fseeko(ctx->fp, tmploc, SEEK_SET) != 0 ||
-              fgets(buf, sizeof(buf) - 1, ctx->fp) == NULL ||
+              !fgets(buf, sizeof(buf) - 1, ctx->fp) ||
               (mutt_str_strcmp(MMDF_SEP, buf) != 0))
           {
             if (fseeko(ctx->fp, loc, SEEK_SET) != 0)
@@ -222,7 +222,7 @@ static int mmdf_parse_mailbox(struct Context *ctx)
           loc = ftello(ctx->fp);
           if (loc < 0)
             return -1;
-          if (fgets(buf, sizeof(buf) - 1, ctx->fp) == NULL)
+          if (!fgets(buf, sizeof(buf) - 1, ctx->fp))
             break;
           lines++;
         } while (mutt_str_strcmp(buf, MMDF_SEP) != 0);
@@ -363,7 +363,7 @@ static int mbox_parse_mailbox(struct Context *ctx)
            * to see a valid message separator at this point in the stream
            */
           if (fseeko(ctx->fp, tmploc, SEEK_SET) != 0 ||
-              fgets(buf, sizeof(buf), ctx->fp) == NULL ||
+              !fgets(buf, sizeof(buf), ctx->fp) ||
               (mutt_str_strncmp("From ", buf, 5) != 0))
           {
             mutt_debug(1, "bad content-length in message %d (cl=" OFF_T_FMT ")\n",
@@ -1018,7 +1018,7 @@ static int mbox_mbox_sync(struct Context *ctx, int *index_hint)
   /* Create a temporary file to write the new version of the mailbox in. */
   mutt_mktemp(tempfile, sizeof(tempfile));
   i = open(tempfile, O_WRONLY | O_EXCL | O_CREAT, 0600);
-  if ((i == -1) || (fp = fdopen(i, "w")) == NULL)
+  if ((i == -1) || !(fp = fdopen(i, "w")))
   {
     if (-1 != i)
     {
@@ -1175,7 +1175,7 @@ static int mbox_mbox_sync(struct Context *ctx, int *index_hint)
 
   if (fseeko(ctx->fp, offset, SEEK_SET) != 0 || /* seek the append location */
       /* do a sanity check to make sure the mailbox looks ok */
-      fgets(buf, sizeof(buf), ctx->fp) == NULL ||
+      !fgets(buf, sizeof(buf), ctx->fp) ||
       (ctx->magic == MUTT_MBOX && (mutt_str_strncmp("From ", buf, 5) != 0)) ||
       (ctx->magic == MUTT_MMDF && (mutt_str_strcmp(MMDF_SEP, buf) != 0)))
   {
index fead75ee072ea46546e539e49f52b68c8fe448b4..6abf7843739c20921881cfff95c90acf455efe23 100644 (file)
@@ -304,7 +304,7 @@ int mutt_file_symlink(const char *oldpath, const char *newpath)
   {
     char abs_oldpath[PATH_MAX];
 
-    if ((getcwd(abs_oldpath, sizeof(abs_oldpath)) == NULL) ||
+    if (!getcwd(abs_oldpath, sizeof(abs_oldpath)) ||
         ((strlen(abs_oldpath) + 1 + strlen(oldpath) + 1) > sizeof(abs_oldpath)))
     {
       return -1;
@@ -612,7 +612,7 @@ char *mutt_file_read_line(char *s, size_t *size, FILE *fp, int *line, int flags)
 
   while (true)
   {
-    if (fgets(s + offset, *size - offset, fp) == NULL)
+    if (!fgets(s + offset, *size - offset, fp))
     {
       FREE(&s);
       return NULL;
index e29e9f1c300c53887adb6cfe5a92486658363248..c5b4aa0d2568503d371cc7946cc47e9ff14002c1 100644 (file)
@@ -527,7 +527,7 @@ char *mutt_hist_next(enum HistoryClass hclass)
       next = 0;
     if (next == h->last)
       break;
-  } while (h->hist[next] == NULL);
+  } while (!h->hist[next]);
 
   h->cur = next;
   return NONULL(h->hist[h->cur]);
@@ -555,7 +555,7 @@ char *mutt_hist_prev(enum HistoryClass hclass)
       prev = History;
     if (prev == h->last)
       break;
-  } while (h->hist[prev] == NULL);
+  } while (!h->hist[prev]);
 
   h->cur = prev;
   return NONULL(h->hist[h->cur]);
index 66d7ab2f224ef26aff01e085f9b2526eb5db7916..52850ceef0dcda7a45f95353004fb2d9c9349f79 100644 (file)
@@ -427,7 +427,7 @@ size_t mutt_path_realpath(char *buf)
 {
   char s[PATH_MAX];
 
-  if (realpath(buf, s) == NULL)
+  if (!realpath(buf, s))
     return 0;
 
   return mutt_str_strfcpy(buf, s, sizeof(s));
index a720855da0c26511133b410b0d7f31bef3ef02c3..6c9c370893a3f9a0210c649cfbfac109c84e571a 100644 (file)
@@ -358,7 +358,7 @@ char *mutt_replacelist_apply(struct ReplaceList *rl, char *buf, size_t buflen, c
   if (buf && buflen)
     buf[0] = '\0';
 
-  if (str == NULL || *str == '\0' || (buf && !buflen))
+  if (!str || *str == '\0' || (buf && !buflen))
     return buf;
 
   twinbuf[0][0] = '\0';
index e71e3b4b080336ce7ce59b1432c45ef28f95246c..e6945aebe7ba4bfdd914c20cecfd9295558442b7 100644 (file)
@@ -436,7 +436,7 @@ int mutt_view_attachment(FILE *fp, struct Body *a, int flag, struct Header *hdr,
 
     if (rfc1524_expand_filename(entry->nametemplate, fname, tempfile, sizeof(tempfile)))
     {
-      if (fp == NULL && (mutt_str_strcmp(tempfile, a->filename) != 0))
+      if (!fp && (mutt_str_strcmp(tempfile, a->filename) != 0))
       {
         /* send case: the file is already there */
         if (mutt_file_symlink(a->filename, tempfile) == -1)
@@ -802,9 +802,9 @@ int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct
 
       if (fseeko(fp, m->offset, SEEK_SET) < 0)
         return -1;
-      if (fgets(buf, sizeof(buf), fp) == NULL)
+      if (!fgets(buf, sizeof(buf), fp))
         return -1;
-      if (mx_mbox_open(path, MUTT_APPEND | MUTT_QUIET, &ctx) == NULL)
+      if (!mx_mbox_open(path, MUTT_APPEND | MUTT_QUIET, &ctx))
         return -1;
       msg = mx_msg_open_new(&ctx, hn, is_from(buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM);
       if (!msg)
index f2a93de21fb21b61c035f34b8527965c94f806c7..f4a86b126df9732172d688e022b734f602dbec46 100644 (file)
@@ -117,7 +117,7 @@ static int lua_mutt_call(lua_State *l)
   }
   else
   {
-    if (lua_pushstring(l, err.data) == NULL)
+    if (!lua_pushstring(l, err.data))
       handle_error(l);
     else
       rc++;
@@ -303,7 +303,7 @@ static int lua_mutt_enter(lua_State *l)
   }
   else
   {
-    if (lua_pushstring(l, err.data) == NULL)
+    if (!lua_pushstring(l, err.data))
       handle_error(l);
     else
       rc++;
index 025c32cea53aec4191829cc5afa0fd5053946a61..16551e94850b1eae98eb4ae04e26ea4c87d7ba01 100644 (file)
@@ -1228,7 +1228,7 @@ int mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag)
     }
   }
 
-  if (thread == top && (thread = thread->child) == NULL)
+  if ((thread == top) && !(thread = thread->child))
   {
     /* return value depends on action requested */
     if (flag & (MUTT_THREAD_COLLAPSE | MUTT_THREAD_UNCOLLAPSE))
diff --git a/mx.c b/mx.c
index cafc57c8797e4a8e923949f8f4bde9a82cb63ea0..2c88b0407b11661eaed7acc906175b9a9f32ee15 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -835,7 +835,7 @@ int mx_mbox_close(struct Context *ctx, int *index_hint)
     else /* use regular append-copy mode */
 #endif
     {
-      if (mx_mbox_open(mbox, MUTT_APPEND, &f) == NULL)
+      if (!mx_mbox_open(mbox, MUTT_APPEND, &f))
       {
         ctx->closing = false;
         return -1;
index bb8668086aa3b7928c3d132ca54ebc45d0bfe11a..92367c8b20b2ae1f9ab9b175c98bca219ca0d909 100644 (file)
@@ -1299,7 +1299,7 @@ bool crypt_is_numerical_keyid(const char *s)
   if (strlen(s) % 8)
     return false;
   while (*s)
-    if (strchr("0123456789ABCDEFabcdef", *s++) == NULL)
+    if (!strchr("0123456789ABCDEFabcdef", *s++))
       return false;
 
   return true;
index 57ec0691239556d2389253784cd2ae8d7816a00d..0e597be84161c5d1a03ef28b85495bb9e6272f22 100644 (file)
@@ -2563,7 +2563,7 @@ int pgp_gpgme_application_handler(struct Body *m, struct State *s)
 
   for (bytes = m->length; bytes > 0;)
   {
-    if (fgets(buf, sizeof(buf), s->fpin) == NULL)
+    if (!fgets(buf, sizeof(buf), s->fpin))
       break;
 
     LOFF_T offset = ftello(s->fpin);
index 70f3900ce9872c0c67d5fe567c6b48fbcb35ea62..3d06da3d332e3975c812a6d685c5d9ed9a892547 100644 (file)
@@ -490,7 +490,7 @@ int pgp_class_application_handler(struct Body *m, struct State *s)
 
   for (bytes = m->length; bytes > 0;)
   {
-    if (fgets(buf, sizeof(buf), s->fpin) == NULL)
+    if (!fgets(buf, sizeof(buf), s->fpin))
       break;
 
     offset = ftello(s->fpin);
index 6b9e5fac013ed739ac9f8142f5cf1f64c52fb4ae..9f39dfe0d5ab05a987d698d904fe178fd29d0674 100644 (file)
@@ -642,7 +642,7 @@ static int active_get_cache(struct NntpServer *nserv)
   if (!fp)
     return -1;
 
-  if (fgets(buf, sizeof(buf), fp) == NULL || sscanf(buf, "%ld%s", &t, file) != 1 || t == 0)
+  if (!fgets(buf, sizeof(buf), fp) || (sscanf(buf, "%ld%s", &t, file) != 1) || (t == 0))
   {
     mutt_file_fclose(&fp);
     return -1;
index 81e55acbac6b63484dcbee8df5cd0f16ea0bfbf3..2cc95be62aca0eaed0a59bdddc28109f6520b907 100644 (file)
@@ -1164,7 +1164,7 @@ static int parse_overview_line(char *line, void *data)
 
     if (*header)
     {
-      if (strstr(header, ":full") == NULL && fputs(header, fp) == EOF)
+      if (!strstr(header, ":full") && (fputs(header, fp) == EOF))
       {
         mutt_file_fclose(&fp);
         return -1;
@@ -1296,7 +1296,7 @@ static int nntp_fetch_headers(struct Context *ctx, void *hc, anum_t first,
   fc.last = last;
   fc.restore = restore;
   fc.messages = mutt_mem_calloc(last - first + 1, sizeof(unsigned char));
-  if (fc.messages == NULL)
+  if (!fc.messages)
     return -1;
 #ifdef USE_HCACHE
   fc.hc = hc;
@@ -2214,7 +2214,7 @@ static int nntp_mbox_close(struct Context *ctx)
     return 0;
 
   nntp_tmp = mutt_hash_find(nntp_data->nserv->groups_hash, nntp_data->group);
-  if (nntp_tmp == NULL || nntp_tmp != nntp_data)
+  if (!nntp_tmp || nntp_tmp != nntp_data)
     nntp_data_free(nntp_data);
   return 0;
 }
index addc6299b35a7275c4e03b21b20edf580e2b3eea..50754f933ef8c510297dc5068941e30645a1c345 100644 (file)
@@ -408,7 +408,7 @@ static bool windowed_query_from_query(const char *query, char *buf, size_t bufle
   }
 
   /* if the query has changed, reset the window position */
-  if (NmQueryWindowCurrentSearch == NULL || (strcmp(query, NmQueryWindowCurrentSearch) != 0))
+  if (!NmQueryWindowCurrentSearch || (strcmp(query, NmQueryWindowCurrentSearch) != 0))
     query_window_reset();
 
   if (!query_window_check_timebase(NmQueryWindowTimebase))
@@ -1974,14 +1974,14 @@ bool nm_normalize_uri(char *new_uri, const char *orig_uri, size_t new_uri_sz)
 
   mutt_debug(2, "#1 () -> db_query: %s\n", tmp_ctxdata->db_query);
 
-  if (get_query_string(tmp_ctxdata, false) == NULL)
+  if (!get_query_string(tmp_ctxdata, false))
     goto gone;
 
   mutt_debug(2, "#2 () -> db_query: %s\n", tmp_ctxdata->db_query);
 
   mutt_str_strfcpy(buf, tmp_ctxdata->db_query, sizeof(buf));
 
-  if (nm_uri_from_query(&tmp_ctx, buf, sizeof(buf)) == NULL)
+  if (!nm_uri_from_query(&tmp_ctx, buf, sizeof(buf)))
     goto gone;
 
   strncpy(new_uri, buf, new_uri_sz);
diff --git a/pager.c b/pager.c
index ce05d53614d0b6d2456e90c17acfab30403d8243..4f3b6e75cba4a7c6b51d7609c17d9e4dd64569e1 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -622,7 +622,7 @@ static struct QClass *classify_quote(struct QClass **quote_list, const char *qpt
       /* case 2: try subclassing the current top level node */
 
       /* tmp != NULL means we already found a shorter prefix at case 1 */
-      if (tmp == NULL && (mutt_str_strncmp(qptr, q_list->prefix, q_list->length) == 0))
+      if (!tmp && (mutt_str_strncmp(qptr, q_list->prefix, q_list->length) == 0))
       {
         /* ok, it's a subclass somewhere on this branch */
 
@@ -724,7 +724,7 @@ static struct QClass *classify_quote(struct QClass **quote_list, const char *qpt
           else
           {
             /* longer than the current prefix: try subclassing it */
-            if (tmp == NULL && (mutt_str_strncmp(tail_qptr, (q_list->prefix) + offset,
+            if (!tmp && (mutt_str_strncmp(tail_qptr, (q_list->prefix) + offset,
                                                  q_list->length - offset) == 0))
             {
               /* still a subclass: go down one level */
@@ -944,7 +944,7 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n,
 
         if (regexec(QuoteRegex->regex, buf, 1, pmatch, 0) == 0)
         {
-          if (q_classify && line_info[n].quote == NULL)
+          if (q_classify && !line_info[n].quote)
           {
             line_info[n].quote = classify_quote(quote_list, buf + pmatch[0].rm_so,
                                                 pmatch[0].rm_eo - pmatch[0].rm_so,
@@ -962,7 +962,7 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n,
     }
     else
     {
-      if (q_classify && line_info[n].quote == NULL)
+      if (q_classify && !line_info[n].quote)
       {
         line_info[n].quote = classify_quote(quote_list, buf + pmatch[0].rm_so,
                                             pmatch[0].rm_eo - pmatch[0].rm_so,
@@ -1638,7 +1638,7 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **line_info, int
    * length of the quote prefix.
    */
   if ((flags & MUTT_SHOWCOLOR) && !(*line_info)[n].continuation &&
-      (*line_info)[n].type == MT_COLOR_QUOTED && (*line_info)[n].quote == NULL)
+      ((*line_info)[n].type == MT_COLOR_QUOTED) && !(*line_info)[n].quote)
   {
     if (fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0)
     {
index a7a47ffa8a1548f0394da668affa92b3340540c7..2c039bd19b00b40fc337941de8c64302c7e5f2b4 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -1084,7 +1084,7 @@ static bool msg_search(struct Context *ctx, struct Pattern *pat, int msgno)
       if (*buf == '\0')
         break;
     }
-    else if (fgets(buf, blen - 1, fp) == NULL)
+    else if (!fgets(buf, blen - 1, fp))
       break; /* don't loop forever */
     if (patmatch(pat, buf) == 0)
     {
index a6d32e109d5437b119c0ccdb02e7b39efdc683c7..8e969d7a47610a8a0630dc5098e9c1aeac059ab2 100644 (file)
--- a/pop/pop.c
+++ b/pop/pop.c
@@ -968,7 +968,7 @@ void pop_fetch_mail(void)
     goto finish;
   }
 
-  if (mx_mbox_open(Spoolfile, MUTT_APPEND, &ctx) == NULL)
+  if (!mx_mbox_open(Spoolfile, MUTT_APPEND, &ctx))
     goto finish;
 
   delanswer = query_quadoption(PopDelete, _("Delete messages from server?"));
index 94c7118dc12cac210fbe0fcce8eebea32a399caa..b05051da5a6f0304c0ca776b8556301ffdbb8702 100644 (file)
@@ -162,7 +162,7 @@ int mutt_num_postponed(bool force)
     if (optnews)
       OptNews = false;
 #endif
-    if (mx_mbox_open(Postponed, MUTT_NOSORT | MUTT_QUIET, &ctx) == NULL)
+    if (!mx_mbox_open(Postponed, MUTT_NOSORT | MUTT_QUIET, &ctx))
       PostCount = 0;
     else
       PostCount = ctx.msgcount;
@@ -311,7 +311,7 @@ int mutt_get_postponed(struct Context *ctx, struct Header *hdr,
     /* only one message, so just use that one. */
     h = PostContext->hdrs[0];
   }
-  else if ((h = select_msg()) == NULL)
+  else if (!(h = select_msg()))
   {
     mx_mbox_close(PostContext, NULL);
     FREE(&PostContext);
@@ -568,7 +568,7 @@ int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Header *newhdr,
   struct State s = { 0 };
   int sec_type;
 
-  if (!fp && (msg = mx_msg_open(ctx, hdr->msgno)) == NULL)
+  if (!fp && !(msg = mx_msg_open(ctx, hdr->msgno)))
     return -1;
 
   if (!fp)
@@ -605,7 +605,7 @@ int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Header *newhdr,
       goto bail;
 
     mutt_message(_("Decrypting message..."));
-    if ((crypt_pgp_decrypt_mime(fp, &bfp, newhdr->content, &b) == -1) || b == NULL)
+    if ((crypt_pgp_decrypt_mime(fp, &bfp, newhdr->content, &b) == -1) || !b)
     {
       goto bail;
     }
index 47deb92ff1fac90c58ea3e31fb38d292a1a5b200..b595e60c58b1baba30c6934b4a3f4694520f9b9b 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -579,7 +579,7 @@ static void attach_forward_bodies(FILE *fp, struct Header *hdr, struct AttachCtx
       }
     }
 
-    if (mime_fwd_any && copy_problematic_attachments(last, actx, mime_fwd_all) == NULL)
+    if (mime_fwd_any && !copy_problematic_attachments(last, actx, mime_fwd_all))
       goto bail;
   }
 
@@ -1020,7 +1020,7 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx,
     mutt_make_post_indent(Context, parent_hdr, tmpfp);
 
     if (mime_reply_any && !cur &&
-        copy_problematic_attachments(&tmphdr->content, actx, false) == NULL)
+        !copy_problematic_attachments(&tmphdr->content, actx, false))
     {
       mutt_header_free(&tmphdr);
       mutt_file_fclose(&tmpfp);
index 4c9017b311819c2b6513d04aeb3898153bf512ad..e5cd659ff29c514f9324cdd31edeaaebf8d9fa4c 100644 (file)
@@ -782,7 +782,7 @@ int mix_check_message(struct Header *msg)
 
   for (struct Address *a = msg->env->to; a; a = a->next)
   {
-    if (!a->group && strchr(a->mailbox, '@') == NULL)
+    if (!a->group && !strchr(a->mailbox, '@'))
     {
       need_hostname = true;
       break;
diff --git a/send.c b/send.c
index b0ba7cdb946a38e0cbb144ce7c99b44496b50a9a..eea50f3a295a837d892489ea380564ac555ac6ee 100644 (file)
--- a/send.c
+++ b/send.c
@@ -334,7 +334,7 @@ static int edit_envelope(struct Envelope *en, int flags)
   else
 #endif
   {
-    if (edit_address(&en->to, _("To: ")) == -1 || en->to == NULL)
+    if (edit_address(&en->to, _("To: ")) == -1 || !en->to)
       return -1;
     if (Askcc && edit_address(&en->cc, _("Cc: ")) == -1)
       return -1;
@@ -1103,7 +1103,7 @@ static int generate_body(FILE *tempfp, struct Header *msg, int flags,
   {
     struct Body *b = NULL;
 
-    if (((WithCrypto & APPLICATION_PGP) != 0) && (b = crypt_pgp_make_key_attachment()) == NULL)
+    if (((WithCrypto & APPLICATION_PGP) != 0) && !(b = crypt_pgp_make_key_attachment()))
     {
       return -1;
     }
index b4b2629eb3b7f2b3f8c634aead66251a0c65c874..bf642b98e670858f3f40a9d68a95f96c5f8f31b0 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -2971,7 +2971,7 @@ static int bounce_message(FILE *fp, struct Header *h, struct Address *to,
   }
 
   /* If we failed to open a message, return with error */
-  if (!fp && (msg = mx_msg_open(Context, h->msgno)) == NULL)
+  if (!fp && !(msg = mx_msg_open(Context, h->msgno)))
     return -1;
 
   if (!fp)
@@ -3175,7 +3175,7 @@ int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid,
 #ifdef RECORD_FOLDER_HOOK
   mutt_folder_hook(path);
 #endif
-  if (mx_mbox_open(path, MUTT_APPEND | MUTT_QUIET, &f) == NULL)
+  if (!mx_mbox_open(path, MUTT_APPEND | MUTT_QUIET, &f))
   {
     mutt_debug(1, "unable to open mailbox %s in append-mode, aborting.\n", path);
     goto done;
diff --git a/sort.c b/sort.c
index 444ec7477b6bd611537694117412c7a4d9973cd8..1797e40f188665ea422583e936afcbcbc5508a92 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -408,8 +408,8 @@ void mutt_sort_headers(struct Context *ctx, bool init)
     }
     mutt_sort_threads(ctx, init);
   }
-  else if ((sortfunc = mutt_get_sort_func(Sort)) == NULL ||
-           (AuxSort = mutt_get_sort_func(SortAux)) == NULL)
+  else if (!(sortfunc = mutt_get_sort_func(Sort)) ||
+           !(AuxSort = mutt_get_sort_func(SortAux)))
   {
     mutt_error(_("Could not find sorting function [report this bug]"));
     return;