]> granicus.if.org Git - neomutt/commitdiff
kill unnecessary != NULL
authorRichard Russon <rich@flatcap.org>
Fri, 17 Aug 2018 00:47:53 +0000 (01:47 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 19 Aug 2018 12:43:45 +0000 (13:43 +0100)
44 files changed:
alias.c
bcache.c
browser.c
commands.c
complete.c
compose.c
conn/conn_raw.c
conn/getdomain.c
conn/ssl.c
conn/ssl_gnutls.c
curs_main.c
edit.c
email/address.c
email/idna.c
email/mime.h
email/parse.c
email/rfc2047.c
email/thread.c
handler.c
hcache/hcache.c
hcache/serialize.c
init.c
mailbox.c
maildir/mh.c
mbox/mbox.c
mutt/charset.c
mutt/date.c
mutt/history.c
mutt/logging.c
mutt/mbyte.c
mutt/string.c
mutt_header.c
mutt_parse.c
mx.c
ncrypt/crypt_gpgme.c
ncrypt/pgp.c
ncrypt/pgpmicalg.c
ncrypt/smime.c
pager.c
query.c
recvattach.c
rfc1524.c
sendlib.c
sort.c

diff --git a/alias.c b/alias.c
index 3c02e2a298cd6e7512c6330eb8858f21abd9b1f2..077a0c09da6d687152c53aee33c17df23656514d 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -59,7 +59,7 @@ static struct Address *expand_aliases_r(struct Address *a, struct ListHead *expn
 
   while (a)
   {
-    if (!a->group && !a->personal && a->mailbox && strchr(a->mailbox, '@') == NULL)
+    if (!a->group && !a->personal && a->mailbox && !strchr(a->mailbox, '@'))
     {
       t = mutt_alias_lookup(a->mailbox);
 
index 0527f3666b10709b2c6a8d436fd80419d01f0215..9eedbe6acf4492cddd34bd2b0436f461072e5092 100644 (file)
--- a/bcache.c
+++ b/bcache.c
@@ -179,7 +179,7 @@ FILE *mutt_bcache_get(struct BodyCache *bcache, const char *id)
 
   fp = mutt_file_fopen(path, "r");
 
-  mutt_debug(3, "bcache: get: '%s': %s\n", path, fp == NULL ? "no" : "yes");
+  mutt_debug(3, "bcache: get: '%s': %s\n", path, fp ? "yes" : "no");
 
   return fp;
 }
index 4cb599893282fdb5289fb4a73592b83f3c1c0860..3c0a1ebbc2629a6cdccdf40b74ec60bd2d75e368 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -849,7 +849,7 @@ static int examine_directory(struct Menu *menu, struct BrowserState *state,
 
     init_state(state, menu);
 
-    while ((de = readdir(dp)) != NULL)
+    while ((de = readdir(dp)))
     {
       if (mutt_str_strcmp(de->d_name, ".") == 0)
         continue; /* we don't need . */
index 9102096aba11a0b1f64b32386d95585c6778fa9c..09e6084403f07d685e6dcade23482826a4984e1b 100644 (file)
@@ -199,7 +199,7 @@ int mutt_display_message(struct Header *cur)
     return 0;
   }
 
-  if (fpfilterout != NULL && mutt_wait_filter(filterpid) != 0)
+  if (fpfilterout && mutt_wait_filter(filterpid) != 0)
     mutt_any_key_to_continue(NULL);
 
   mutt_file_fclose(&fpfilterout); /* XXX - check result? */
@@ -986,7 +986,7 @@ int mutt_save_message(struct Header *h, bool delete, bool decode, bool decrypt)
   }
 #endif
 
-  if (mx_mbox_open(buf, MUTT_APPEND, &ctx) != NULL)
+  if (mx_mbox_open(buf, MUTT_APPEND, &ctx))
   {
 #ifdef USE_COMPRESSED
     /* If we're saving to a compressed mailbox, the stats won't be updated
index e83deb4a4f7151068f00cb3fa670a340f44adaee..67d242dd03318393f3ce69dfaf33cbe116341752 100644 (file)
@@ -214,7 +214,7 @@ int mutt_complete(char *buf, size_t buflen)
   len = mutt_str_strlen(filepart);
   if (len == 0)
   {
-    while ((de = readdir(dirp)) != NULL)
+    while ((de = readdir(dirp)))
     {
       if ((mutt_str_strcmp(".", de->d_name) != 0) &&
           (mutt_str_strcmp("..", de->d_name) != 0))
@@ -226,7 +226,7 @@ int mutt_complete(char *buf, size_t buflen)
     }
   }
 
-  while ((de = readdir(dirp)) != NULL)
+  while ((de = readdir(dirp)))
   {
     if (mutt_str_strncmp(de->d_name, filepart, len) == 0)
     {
index f1b4df5bc1c0f2d3f1d014ab939607ca1cd95938..ab32cc73f4fdffb73b14ebd65081ff8768e2d58e 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -1486,7 +1486,7 @@ int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen,
 
           new = (struct AttachPtr *) mutt_mem_calloc(1, sizeof(struct AttachPtr));
           new->content = mutt_make_message_attach(Context, Context->hdrs[i], true);
-          if (new->content != NULL)
+          if (new->content)
             update_idx(menu, actx, new);
           else
           {
index 8dada104732c02dd8bece22d20c8dbe42b2ba921..b7a60d8e4ca1670ea426ccb5ec5eb5596c697143 100644 (file)
@@ -291,7 +291,7 @@ int raw_socket_open(struct Connection *conn)
     mutt_message(_("Connecting to %s..."), conn->account.host);
 
   rc = -1;
-  for (cur = res; cur != NULL; cur = cur->ai_next)
+  for (cur = res; cur; cur = cur->ai_next)
   {
     int fd = socket(cur->ai_family, cur->ai_socktype, cur->ai_protocol);
     if (fd >= 0)
@@ -350,7 +350,7 @@ int raw_socket_open(struct Connection *conn)
     mutt_message(_("Connecting to %s..."), conn->account.host);
 
   rc = -1;
-  for (int i = 0; he->h_addr_list[i] != NULL; i++)
+  for (int i = 0; he->h_addr_list[i]; i++)
   {
     memcpy(&sin.sin_addr, he->h_addr_list[i], he->h_length);
     int fd = socket(PF_INET, SOCK_STREAM, IPPROTO_IP);
index 0428b81938e348fedac17f2a8b6bfd5214c9c8e2..34683180e5f4f66f8f5ca75102615164d0736b25 100644 (file)
@@ -99,7 +99,7 @@ int getdnsdomainname(char *d, size_t len)
 #endif
 
   char *p = NULL;
-  if (h != NULL && h->ai_canonname && (p = strchr(h->ai_canonname, '.')))
+  if (h && h->ai_canonname && (p = strchr(h->ai_canonname, '.')))
   {
     mutt_str_strfcpy(d, ++p, len);
     rc = 0;
index 0276f21bf54f1620cda1331d0a1c146df7ca0e75..a23549cde01d1b23eb10aa4dee4509f1657fbe0d 100644 (file)
@@ -771,7 +771,7 @@ static bool check_certificate_file(X509 *peercert)
     return false;
   }
 
-  while (PEM_read_X509(fp, &cert, NULL, NULL) != NULL)
+  while (PEM_read_X509(fp, &cert, NULL, NULL))
   {
     if (compare_certificates(cert, peercert, peermd, peermdlen) &&
         check_certificate_expiration(cert, true))
@@ -1139,7 +1139,7 @@ static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
    * In this case, all following certificates need to be treated as non-verified
    * until one is actually verified.
    */
-  skip_mode = (SSL_get_ex_data(ssl, SkipModeExDataIndex) != NULL);
+  skip_mode = (SSL_get_ex_data(ssl, SkipModeExDataIndex));
 
   cert = X509_STORE_CTX_get_current_cert(ctx);
   pos = X509_STORE_CTX_get_error_depth(ctx);
index a29aa18027b004148606337b29c5e3266b9865a1..3763b5bf8af03d00fd80e3003264a544567b858c 100644 (file)
@@ -310,7 +310,7 @@ static int tls_check_stored_hostname(const gnutls_datum_t *cert, const char *hos
     char buf[80];
     buf[0] = '\0';
     tls_fingerprint(GNUTLS_DIG_MD5, buf, sizeof(buf), cert);
-    while ((linestr = mutt_file_read_line(linestr, &linestrsize, fp, &linenum, 0)) != NULL)
+    while ((linestr = mutt_file_read_line(linestr, &linestrsize, fp, &linenum, 0)))
     {
       if (linestr[0] == '#' && linestr[1] == 'H')
       {
index 9b2378002a0792e22bef323d67a6e4865fe2bbc1..dd6de7407e8bf7011ce1dd86a3d181946b528c1c 100644 (file)
@@ -199,7 +199,7 @@ static void collapse_all(struct Menu *menu, int toggle)
   /* Iterate all threads, perform collapse/uncollapse as needed */
   top = Context->tree;
   Context->collapsed = toggle ? !Context->collapsed : true;
-  while ((thread = top) != NULL)
+  while ((thread = top))
   {
     while (!thread->message)
       thread = thread->child;
diff --git a/edit.c b/edit.c
index d471fa69dd0841138c095ad193d4a7fa5c8e576d..dda2d5b4c2234a7faa82cd001cd698744cf1b2be 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -208,7 +208,7 @@ static char **be_include_messages(char *msg, char **buf, int *bufmax,
   if (!msg || !buf || !bufmax || !buflen)
     return buf;
 
-  while ((msg = strtok(msg, " ,")) != NULL)
+  while ((msg = strtok(msg, " ,")))
   {
     if (mutt_str_atoi(msg, &n) == 0 && n > 0 && n <= Context->msgcount)
     {
index 2b2160d0f7a7b66b423d4a84470e4e92040d342a..55b6ba0dcdd298f270833a78f9cf46afa00d71c3 100644 (file)
@@ -637,7 +637,7 @@ struct Address *mutt_addr_parse_list2(struct Address *p, const char *s)
 
     mutt_str_strfcpy(tmp, s, sizeof(tmp));
     char *r = tmp;
-    while ((r = strtok(r, " \t")) != NULL)
+    while ((r = strtok(r, " \t")))
     {
       p = mutt_addr_parse_list(p, r);
       r = NULL;
index 491dbf20d2fa8060de55c0c6d731f53819d92765..01057904fdd73c501f4f526db882a96b520e6883 100644 (file)
@@ -83,7 +83,7 @@ static bool check_idn(char *domain)
   if (mutt_str_strncasecmp(domain, "xn--", 4) == 0)
     return true;
 
-  while ((domain = strchr(domain, '.')) != NULL)
+  while ((domain = strchr(domain, '.')))
   {
     if (mutt_str_strncasecmp(++domain, "xn--", 4) == 0)
       return true;
index 5253f7fc4b2ce26c03f488e1f2700cc0ce97c761..2047841e9e3b1c14e9341999f6002ef0e70c4b71 100644 (file)
@@ -74,13 +74,13 @@ extern const char MimeSpecials[];
 
 #define hexval(c) IndexHex[(unsigned int) (c)]
 
-#define is_multipart(x)                                                             \
+#define is_multipart(x)                                                               \
   (((x)->type == TYPE_MULTIPART) || (((x)->type == TYPE_MESSAGE) && ((x)->subtype) && \
-                                    ((strcasecmp((x)->subtype, "rfc822") == 0) ||   \
-                                     (strcasecmp((x)->subtype, "news") == 0))))
+                                     ((strcasecmp((x)->subtype, "rfc822") == 0) ||    \
+                                      (strcasecmp((x)->subtype, "news") == 0))))
 
 #define TYPE(X)                                                                \
-  ((X->type == TYPE_OTHER) && (X->xtype != NULL) ? X->xtype : BodyTypes[(X->type)])
+  ((X->type == TYPE_OTHER) && X->xtype ? X->xtype : BodyTypes[(X->type)])
 #define ENCODING(X) BodyEncodings[(X)]
 
 #endif /* _EMAIL_MIME_H */
index 5c0e911246ad15379258311e61d7a4a15df8de99..89082197127465592c755ddc2d6bb30dde223401 100644 (file)
@@ -304,7 +304,7 @@ char *mutt_extract_message_id(const char *s, const char **saveptr)
   else
     return NULL;
 
-  for (s = NULL, o = NULL, onull = NULL; (p = strpbrk(p, "<> \t;")) != NULL; ++p)
+  for (s = NULL, o = NULL, onull = NULL; (p = strpbrk(p, "<> \t;")); ++p)
   {
     if (*p == '<')
     {
index db87493a8edb12f795d1755c499de87ec0e58908..162b878583c6a2a7d070c17ef851579e9acb0d5f 100644 (file)
@@ -767,7 +767,7 @@ void rfc2047_decode_addrlist(struct Address *a)
   while (a)
   {
     if (a->personal &&
-        ((strstr(a->personal, "=?") != NULL) || (AssumedCharset && *AssumedCharset)))
+        ((strstr(a->personal, "=?")) || (AssumedCharset && *AssumedCharset)))
     {
       rfc2047_decode(&a->personal);
     }
index 0b7e8480b068cb2255486a01d5e70832abe7815c..d7709de279d2a439a47d1046afb4ad80bdf8020b 100644 (file)
@@ -197,7 +197,7 @@ void clean_references(struct MuttThread *brk, struct MuttThread *cur)
 
       /* clearing the References: header from obsolete Message-ID(s) */
       struct ListNode *np = NULL;
-      while ((np = STAILQ_NEXT(ref, entries)) != NULL)
+      while ((np = STAILQ_NEXT(ref, entries)))
       {
         STAILQ_REMOVE_AFTER(&cur->message->env->references, ref, entries);
         FREE(&np->data);
index 0e4aaafb6cc155f6ec6de006edad7075e03d0b4c..bf70ec1af9119fe76f99ca8b4e6b3b57a29616fe 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -438,7 +438,7 @@ static bool is_mmnoask(const char *buf)
   mutt_str_strfcpy(tmp, val, sizeof(tmp));
   p = tmp;
 
-  while ((p = strtok(p, ",")) != NULL)
+  while ((p = strtok(p, ",")))
   {
     q = strrchr(p, '/');
     if (q)
@@ -592,7 +592,7 @@ static int autoview_handler(struct Body *a, struct State *s)
 
     if (s->prefix)
     {
-      while (fgets(buffer, sizeof(buffer), fpout) != NULL)
+      while (fgets(buffer, sizeof(buffer), fpout))
       {
         state_puts(s->prefix, s);
         state_puts(buffer, s);
@@ -608,7 +608,7 @@ static int autoview_handler(struct Body *a, struct State *s)
 
         state_puts(s->prefix, s);
         state_puts(buffer, s);
-        while (fgets(buffer, sizeof(buffer), fperr) != NULL)
+        while (fgets(buffer, sizeof(buffer), fperr))
         {
           state_puts(s->prefix, s);
           state_puts(buffer, s);
index 6de331386ad065c88bacbfafcd3507f1b032215f..e5f5fc41d800fe691a74a90db7bcd95972e5c338 100644 (file)
@@ -485,5 +485,5 @@ const char *mutt_hcache_backend_list(void)
  */
 bool mutt_hcache_is_valid_backend(const char *s)
 {
-  return hcache_get_backend_ops(s) != NULL;
+  return hcache_get_backend_ops(s);
 }
index 267457ee7aa1c5a6bf6e8493c30615e96ce1cce2..34c1b77347c15f91ba5e0f61fbee57867fe28e1e 100644 (file)
@@ -66,7 +66,7 @@ static void lazy_realloc(void *ptr, size_t size)
 {
   void **p = (void **) ptr;
 
-  if (p != NULL && size < 4096)
+  if (p && (size < 4096))
     return;
 
   mutt_mem_realloc(ptr, size);
diff --git a/init.c b/init.c
index 29cd3466ac6a9e28379667baa323fd14991db0d8..4cd780daced7a2eb439fde21ec28ec8c55ad850d 100644 (file)
--- a/init.c
+++ b/init.c
@@ -246,7 +246,7 @@ static int complete_all_nm_tags(const char *pt)
   /* Free the old list, if any. */
   if (nm_tags)
   {
-    for (int i = 0; nm_tags[i] != NULL; i++)
+    for (int i = 0; nm_tags[i]; i++)
       FREE(&nm_tags[i]);
     FREE(&nm_tags);
   }
@@ -836,7 +836,7 @@ static int source_rc(const char *rcfile_path, struct Buffer *err)
   }
 
   mutt_buffer_init(&token);
-  while ((linebuf = mutt_file_read_line(linebuf, &buflen, f, &line, MUTT_CONT)) != NULL)
+  while ((linebuf = mutt_file_read_line(linebuf, &buflen, f, &line, MUTT_CONT)))
   {
     const int conv = ConfigCharset && (*ConfigCharset) && Charset;
     if (conv)
index 38feba5a2c427b3e8a657ea8bb5cd6e66f242a00..8fbe1a1fe002cda4b1d9fd391886e7419b7e9bc9 100644 (file)
--- a/mailbox.c
+++ b/mailbox.c
@@ -242,7 +242,7 @@ static int mailbox_maildir_check_dir(struct Mailbox *mailbox, const char *dir_na
     return 0;
   }
 
-  while ((de = readdir(dirp)) != NULL)
+  while ((de = readdir(dirp)))
   {
     if (*de->d_name == '.')
       continue;
@@ -354,7 +354,7 @@ static int mailbox_mbox_check(struct Mailbox *mailbox, struct stat *sb, bool che
   if (check_stats && (mailbox->stats_last_checked < sb->st_mtime))
   {
     if (mx_mbox_open(mailbox->path, MUTT_READONLY | MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK,
-                     &ctx) != NULL)
+                     &ctx))
     {
       mailbox->msg_count = ctx.msgcount;
       mailbox->msg_unread = ctx.unread;
index aa610a0532858608ba52a8a1de76252b5614715c..f94bd5723420b06a1f7daa068159ca2fc42dcd56 100644 (file)
@@ -414,7 +414,7 @@ bool mh_mailbox(struct Mailbox *mailbox, bool check_stats)
     dirp = opendir(mailbox->path);
     if (dirp)
     {
-      while ((de = readdir(dirp)) != NULL)
+      while ((de = readdir(dirp)))
       {
         if (*de->d_name == '.')
           continue;
@@ -968,7 +968,7 @@ static int maildir_parse_dir(struct Context *ctx, struct Maildir ***last,
   if (!dirp)
     return -1;
 
-  while (((de = readdir(dirp)) != NULL) && (SigInt != 1))
+  while (((de = readdir(dirp))) && (SigInt != 1))
   {
     if ((ctx->magic == MUTT_MH && !mh_valid_message(de->d_name)) ||
         (ctx->magic == MUTT_MAILDIR && *de->d_name == '.'))
@@ -1364,7 +1364,7 @@ static void maildir_delayed_parsing(struct Context *ctx, struct Maildir **md,
     void *data = mutt_hcache_fetch(hc, key, keylen);
     struct timeval *when = (struct timeval *) data;
 
-    if (data != NULL && !ret && lastchanged.st_mtime <= when->tv_sec)
+    if (data && !ret && lastchanged.st_mtime <= when->tv_sec)
     {
       struct Header *h = mutt_hcache_restore((unsigned char *) data);
       h->old = p->h->old;
@@ -1928,7 +1928,7 @@ static int mh_commit_msg(struct Context *ctx, struct Message *msg,
   }
 
   /* figure out what the next message number is */
-  while ((de = readdir(dirp)) != NULL)
+  while ((de = readdir(dirp)))
   {
     dep = de->d_name;
     if (*dep == ',')
index 5fa8503e06d1955fe03c10adaa07c7d0bf3df8a2..23e23f1a65f9b150c768bb6e6c8b73c39fd284fe 100644 (file)
@@ -304,7 +304,7 @@ static int mbox_parse_mailbox(struct Context *ctx)
   }
 
   loc = ftello(ctx->fp);
-  while ((fgets(buf, sizeof(buf), ctx->fp) != NULL) && (SigInt != 1))
+  while ((fgets(buf, sizeof(buf), ctx->fp)) && (SigInt != 1))
   {
     if (is_from(buf, return_path, sizeof(return_path), &t))
     {
@@ -842,7 +842,7 @@ static int mbox_mbox_check(struct Context *ctx, int *index_hint)
       char buffer[LONG_STRING];
       if (fseeko(ctx->fp, ctx->size, SEEK_SET) != 0)
         mutt_debug(1, "#1 fseek() failed\n");
-      if (fgets(buffer, sizeof(buffer), ctx->fp) != NULL)
+      if (fgets(buffer, sizeof(buffer), ctx->fp))
       {
         if ((ctx->magic == MUTT_MBOX && (mutt_str_strncmp("From ", buffer, 5) == 0)) ||
             (ctx->magic == MUTT_MMDF && (mutt_str_strcmp(MMDF_SEP, buffer) == 0)))
index c0f7e7a2fe62ab57adf47c74e81f263272b9577b..edafdff7dfde40af12965611b2a77f8a43219c41 100644 (file)
@@ -1003,7 +1003,7 @@ char *mutt_ch_choose(const char *fromcode, const char *charsets, char *u,
     t[n] = '\0';
 
     s = mutt_str_substr_dup(u, u + ulen);
-    const int rc = (d != NULL) ? mutt_ch_convert_string(&s, fromcode, t, 0) :
+    const int rc = d ? mutt_ch_convert_string(&s, fromcode, t, 0) :
                                  mutt_ch_check(s, ulen, fromcode, t);
     if (rc)
     {
index b32fd71b67058764255106a29b2d5809dff0122e..b066bedb115846fd93ec8f196e0dd82ee506768f 100644 (file)
@@ -470,7 +470,7 @@ time_t mutt_date_parse_date(const char *s, struct Tz *tz_out)
 
   memset(&tm, 0, sizeof(tm));
 
-  while ((t = strtok(t, " \t")) != NULL)
+  while ((t = strtok(t, " \t")))
   {
     switch (count)
     {
index 83b7e68976d34ee5b783c279097d33d03b78ba69..e29e9f1c300c53887adb6cfe5a92486658363248 100644 (file)
@@ -221,7 +221,7 @@ static void shrink_histfile(void)
       dup_hashes[hclass] = mutt_hash_create(MAX(10, SaveHistory * 2), MUTT_HASH_STRDUP_KEYS);
 
   line = 0;
-  while ((linebuf = mutt_file_read_line(linebuf, &buflen, f, &line, 0)) != NULL)
+  while ((linebuf = mutt_file_read_line(linebuf, &buflen, f, &line, 0)))
   {
     if (sscanf(linebuf, "%d:%n", &hclass, &read) < 1 || read == 0 ||
         *(p = linebuf + strlen(linebuf) - 1) != '|' || hclass < 0)
@@ -263,7 +263,7 @@ static void shrink_histfile(void)
     }
     rewind(f);
     line = 0;
-    while ((linebuf = mutt_file_read_line(linebuf, &buflen, f, &line, 0)) != NULL)
+    while ((linebuf = mutt_file_read_line(linebuf, &buflen, f, &line, 0)))
     {
       if (sscanf(linebuf, "%d:%n", &hclass, &read) < 1 || read == 0 ||
           *(p = linebuf + strlen(linebuf) - 1) != '|' || hclass < 0)
@@ -289,7 +289,7 @@ cleanup:
   FREE(&linebuf);
   if (tmpfp)
   {
-    if (fflush(tmpfp) == 0 && (f = fopen(HistoryFile, "w")) != NULL)
+    if ((fflush(tmpfp) == 0) && (f = fopen(HistoryFile, "w")))
     {
       rewind(tmpfp);
       mutt_file_copy_stream(tmpfp, f);
@@ -593,7 +593,7 @@ void mutt_hist_read_file(void)
   if (!f)
     return;
 
-  while ((linebuf = mutt_file_read_line(linebuf, &buflen, f, &line, 0)) != NULL)
+  while ((linebuf = mutt_file_read_line(linebuf, &buflen, f, &line, 0)))
   {
     read = 0;
     if (sscanf(linebuf, "%d:%n", &hclass, &read) < 1 || read == 0 ||
index 13d372bbaea93fa3de053cee962c4f9aa91a26fa..76ccbe893784b3639950e2bf2a07ee6756a6bc06 100644 (file)
@@ -214,7 +214,7 @@ void log_file_set_version(const char *version)
  */
 bool log_file_running(void)
 {
-  return LogFileFP != NULL;
+  return LogFileFP;
 }
 
 /**
index 48ab891e0a043d68b3463b3f65f059493a2855f6..620c1812a425043fa5dd5efcf422f2466fd0f24c 100644 (file)
@@ -332,7 +332,7 @@ size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, char *buf)
 bool mutt_mb_is_shell_char(wchar_t ch)
 {
   static const wchar_t shell_chars[] = L"<>&()$?*;{}| "; /* ! not included because it can be part of a pathname in NeoMutt */
-  return wcschr(shell_chars, ch) != NULL;
+  return wcschr(shell_chars, ch);
 }
 
 /**
index a8698e02fd49812ccfe00da30c953b45198ea7da..9b872f7cb5dba2c180c258e484225ab22cb34df8 100644 (file)
@@ -681,7 +681,7 @@ char *mutt_str_skip_email_wsp(const char *s)
  */
 bool mutt_str_is_email_wsp(char c)
 {
-  return c && (strchr(EMAIL_WSP, c) != NULL);
+  return c && (strchr(EMAIL_WSP, c));
 }
 
 /**
index db983849b4ea5872f586dbc9e454f443b7d0df81..4ab10c87955bf01c83059177c6d462b6284d109f 100644 (file)
@@ -126,7 +126,7 @@ int mutt_label_message(struct Header *hdr)
     return 0;
 
   *buf = '\0';
-  if (hdr != NULL && hdr->env->x_label != NULL)
+  if (hdr && hdr->env->x_label)
   {
     mutt_str_strfcpy(buf, hdr->env->x_label, sizeof(buf));
   }
index d0f678e1240f18081190e1de79101c1a0c2d9160..f4e83c45b36216dbc4875cc187593a14569e4a5f 100644 (file)
@@ -119,7 +119,7 @@ static int count_body_parts(struct Body *body, int flags)
   if (!body)
     return 0;
 
-  for (struct Body *bp = body; bp != NULL; bp = bp->next)
+  for (struct Body *bp = body; bp; bp = bp->next)
   {
     /* Initial disposition is to count and not to recurse this part. */
     bool shallcount = true; /* default */
diff --git a/mx.c b/mx.c
index 9f05f78918d13b5185e1ae9b8b1acf90125f6a18..cafc57c8797e4a8e923949f8f4bde9a82cb63ea0 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -289,7 +289,7 @@ enum MailboxType mx_get_magic(const char *path)
     else
       return MUTT_MBOX;
   }
-  else if ((f = fopen(path, "r")) != NULL)
+  else if ((f = fopen(path, "r")))
   {
     struct utimbuf times;
     int ch;
@@ -656,7 +656,7 @@ static int trash_append(struct Context *ctx)
   }
 #endif
 
-  if (mx_mbox_open(Trash, MUTT_APPEND, &ctx_trash) != NULL)
+  if (mx_mbox_open(Trash, MUTT_APPEND, &ctx_trash))
   {
     /* continue from initial scan above */
     for (i = first_del; i < ctx->msgcount; i++)
index 66e81cfb058a2e3a23829a28014fb045f9fb4fb1..57ec0691239556d2389253784cd2ae8d7816a00d 100644 (file)
@@ -2496,8 +2496,8 @@ static void copy_clearsigned(gpgme_data_t data, struct State *s, char *charset)
    */
   struct FgetConv *fc = mutt_ch_fgetconv_open(fp, charset, Charset, MUTT_ICONV_HOOK_FROM);
 
-  for (complete = true, armor_header = true; mutt_ch_fgetconvs(buf, sizeof(buf), fc) != NULL;
-       complete = (strchr(buf, '\n') != NULL))
+  for (complete = true, armor_header = true; mutt_ch_fgetconvs(buf, sizeof(buf), fc);
+       complete = (strchr(buf, '\n')))
   {
     if (!complete)
     {
index 2ea5cea5a10d2d21eaacc14fb2122d2694cb3eea..70f3900ce9872c0c67d5fe567c6b48fbcb35ea62 100644 (file)
@@ -257,7 +257,7 @@ static int pgp_copy_checksig(FILE *fpin, FILE *fpout)
     int lineno = 0;
     size_t linelen;
 
-    while ((line = mutt_file_read_line(line, &linelen, fpin, &lineno, 0)) != NULL)
+    while ((line = mutt_file_read_line(line, &linelen, fpin, &lineno, 0)))
     {
       if (regexec(PgpGoodSign->regex, line, 0, NULL, 0) == 0)
       {
@@ -304,7 +304,7 @@ static int pgp_check_pgp_decryption_okay_regex(FILE *fpin)
     int lineno = 0;
     size_t linelen;
 
-    while ((line = mutt_file_read_line(line, &linelen, fpin, &lineno, 0)) != NULL)
+    while ((line = mutt_file_read_line(line, &linelen, fpin, &lineno, 0)))
     {
       if (regexec(PgpDecryptionOkay->regex, line, 0, NULL, 0) == 0)
       {
@@ -357,7 +357,7 @@ static int pgp_check_decryption_okay(FILE *fpin)
   if (!PgpCheckGpgDecryptStatusFd)
     return pgp_check_pgp_decryption_okay_regex(fpin);
 
-  while ((line = mutt_file_read_line(line, &linelen, fpin, &lineno, 0)) != NULL)
+  while ((line = mutt_file_read_line(line, &linelen, fpin, &lineno, 0)))
   {
     if (mutt_str_strncmp(line, "[GNUPG:] ", 9) != 0)
       continue;
@@ -423,8 +423,8 @@ static void pgp_copy_clearsigned(FILE *fpin, struct State *s, char *charset)
    */
   struct FgetConv *fc = mutt_ch_fgetconv_open(fpin, charset, Charset, MUTT_ICONV_HOOK_FROM);
 
-  for (complete = true, armor_header = true; mutt_ch_fgetconvs(buf, sizeof(buf), fc) != NULL;
-       complete = (strchr(buf, '\n') != NULL))
+  for (complete = true, armor_header = true; mutt_ch_fgetconvs(buf, sizeof(buf), fc);
+       complete = (strchr(buf, '\n')))
   {
     if (!complete)
     {
@@ -537,7 +537,7 @@ int pgp_class_application_handler(struct Body *m, struct State *s)
       }
 
       fputs(buf, tmpfp);
-      while (bytes > 0 && fgets(buf, sizeof(buf) - 1, s->fpin) != NULL)
+      while (bytes > 0 && fgets(buf, sizeof(buf) - 1, s->fpin))
       {
         offset = ftello(s->fpin);
         bytes -= (offset - last_pos); /* don't rely on mutt_str_strlen(buf) */
@@ -1043,7 +1043,7 @@ static struct Body *pgp_decrypt_part(struct Body *a, struct State *s,
   /* Read the output from PGP, and make sure to change CRLF to LF, otherwise
    * read_mime_header has a hard time parsing the message.
    */
-  while (fgets(buf, sizeof(buf) - 1, pgpout) != NULL)
+  while (fgets(buf, sizeof(buf) - 1, pgpout))
   {
     size_t len = mutt_str_strlen(buf);
     if (len > 1 && buf[len - 2] == '\r')
@@ -1306,7 +1306,7 @@ struct Body *pgp_class_sign_message(struct Body *a)
   /* Read back the PGP signature.  Also, change MESSAGE=>SIGNATURE as
    * recommended for future releases of PGP.
    */
-  while (fgets(buffer, sizeof(buffer) - 1, pgpout) != NULL)
+  while (fgets(buffer, sizeof(buffer) - 1, pgpout))
   {
     if (mutt_str_strcmp("-----BEGIN PGP MESSAGE-----\n", buffer) == 0)
       fputs("-----BEGIN PGP SIGNATURE-----\n", fp);
@@ -1319,7 +1319,7 @@ struct Body *pgp_class_sign_message(struct Body *a)
 
   /* check for errors from PGP */
   err = false;
-  while (fgets(buffer, sizeof(buffer) - 1, pgperr) != NULL)
+  while (fgets(buffer, sizeof(buffer) - 1, pgperr))
   {
     err = true;
     fputs(buffer, stdout);
@@ -1580,7 +1580,7 @@ struct Body *pgp_class_encrypt_message(struct Body *a, char *keylist, bool sign)
 
   fflush(pgperr);
   rewind(pgperr);
-  while (fgets(buf, sizeof(buf) - 1, pgperr) != NULL)
+  while (fgets(buf, sizeof(buf) - 1, pgperr))
   {
     err = 1;
     fputs(buf, stdout);
index 39e4c5bca0fcb7a2689e6fe526c3413894b311ba..c0c204e51abc83606e255aeb28cc12c04b631a08 100644 (file)
@@ -78,7 +78,7 @@ static void pgp_dearmor(FILE *in, FILE *out)
 
   /* find the beginning of ASCII armor */
 
-  while ((r = fgets(line, sizeof(line), in)) != NULL)
+  while ((r = fgets(line, sizeof(line), in)))
   {
     if (strncmp(line, "-----BEGIN", 10) == 0)
       break;
@@ -91,7 +91,7 @@ static void pgp_dearmor(FILE *in, FILE *out)
 
   /* skip the armor header */
 
-  while ((r = fgets(line, sizeof(line), in)) != NULL)
+  while ((r = fgets(line, sizeof(line), in)))
   {
     SKIPWS(r);
     if (!*r)
@@ -110,7 +110,7 @@ static void pgp_dearmor(FILE *in, FILE *out)
 
   /* find the checksum */
 
-  while ((r = fgets(line, sizeof(line), in)) != NULL)
+  while ((r = fgets(line, sizeof(line), in)))
   {
     if (*line == '=' || (strncmp(line, "-----END", 8) == 0))
       break;
index 115d2cfa989843e4ffe3aa3891dd0de25f1059a5..24c95c3c505b403123ba33a2108709fa3bd9940c 100644 (file)
@@ -1624,7 +1624,7 @@ struct Body *smime_class_build_smime_entity(struct Body *a, char *certlist)
 
   fflush(smimeerr);
   rewind(smimeerr);
-  while (fgets(buf, sizeof(buf) - 1, smimeerr) != NULL)
+  while (fgets(buf, sizeof(buf) - 1, smimeerr))
   {
     err = 1;
     fputs(buf, stdout);
@@ -1773,7 +1773,7 @@ struct Body *smime_class_sign_message(struct Body *a)
   err = 0;
   fflush(smimeerr);
   rewind(smimeerr);
-  while (fgets(buffer, sizeof(buffer) - 1, smimeerr) != NULL)
+  while (fgets(buffer, sizeof(buffer) - 1, smimeerr))
   {
     err = 1;
     fputs(buffer, stdout);
@@ -2130,7 +2130,7 @@ static struct Body *smime_handle_entity(struct Body *m, struct State *s, FILE *o
       }
     }
     char buf[HUGE_STRING];
-    while (fgets(buf, sizeof(buf) - 1, smimeout) != NULL)
+    while (fgets(buf, sizeof(buf) - 1, smimeout))
     {
       const size_t len = mutt_str_strlen(buf);
       if (len > 1 && buf[len - 2] == '\r')
diff --git a/pager.c b/pager.c
index 09f62064f63942adddffd506b1e0ca197eb74ff4..ce05d53614d0b6d2456e90c17acfab30403d8243 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -1142,7 +1142,7 @@ static int grok_ansi(unsigned char *buf, int pos, struct AnsiAttr *a)
     x++;
 
   /* Character Attributes */
-  if (AllowAnsi && a != NULL && buf[x] == 'm')
+  if (AllowAnsi && a && (buf[x] == 'm'))
   {
     if (pos == x)
     {
diff --git a/query.c b/query.c
index b2506102214fa8246c4aa6565aeb95852b02df6f..cecc89f43fb5666e35f28c080b7d9fbaaa74e0d6 100644 (file)
--- a/query.c
+++ b/query.c
@@ -153,7 +153,7 @@ static struct Query *run_query(char *s, int quiet)
   p = strrchr(msg, '\n');
   if (p)
     *p = '\0';
-  while ((buf = mutt_file_read_line(buf, &buflen, fp, &dummy, 0)) != NULL)
+  while ((buf = mutt_file_read_line(buf, &buflen, fp, &dummy, 0)))
   {
     p = strtok(buf, "\t\n");
     if (p)
index 15f19297d4f6a7bb67c725c1feb472d69d5e30c0..6049c543a7ff182ef494d2868eae569498559d22 100644 (file)
@@ -612,7 +612,7 @@ void mutt_save_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag,
           if (mutt_check_overwrite(top->filename, buf, tfile, sizeof(tfile), &append, NULL))
             return;
           rc = mutt_save_attachment(fp, top, tfile, append, hdr);
-          if (rc == 0 && AttachSep && (fpout = fopen(tfile, "a")) != NULL)
+          if ((rc == 0) && AttachSep && (fpout = fopen(tfile, "a")))
           {
             fprintf(fpout, "%s", AttachSep);
             mutt_file_fclose(&fpout);
@@ -621,7 +621,7 @@ void mutt_save_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag,
         else
         {
           rc = mutt_save_attachment(fp, top, tfile, MUTT_SAVE_APPEND, hdr);
-          if (rc == 0 && AttachSep && (fpout = fopen(tfile, "a")) != NULL)
+          if ((rc == 0) && AttachSep && (fpout = fopen(tfile, "a")))
           {
             fprintf(fpout, "%s", AttachSep);
             mutt_file_fclose(&fpout);
index 4c165ed114e693aea7dd208ada72d3978648a388..3a9b0b5d299ddb4f0381d0d8509b82afa888a4da 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -110,7 +110,7 @@ int rfc1524_expand_command(struct Body *a, char *filename, char *type, char *com
 
         y += mutt_file_quote_filename(buf + y, sizeof(buf) - y, pvalue);
       }
-      else if (command[x] == 's' && filename != NULL)
+      else if (command[x] == 's' && filename)
       {
         y += mutt_file_quote_filename(buf + y, sizeof(buf) - y, filename);
         needspipe = false;
@@ -143,7 +143,7 @@ static char *get_field(char *s)
   if (!s)
     return NULL;
 
-  while ((ch = strpbrk(s, ";\\")) != NULL)
+  while ((ch = strpbrk(s, ";\\")))
   {
     if (*ch == '\\')
     {
@@ -231,7 +231,7 @@ static int rfc1524_mailcap_parse(struct Body *a, char *filename, char *type,
   if (fp)
   {
     size_t buflen;
-    while (!found && (buf = mutt_file_read_line(buf, &buflen, fp, &line, MUTT_CONT)) != NULL)
+    while (!found && (buf = mutt_file_read_line(buf, &buflen, fp, &line, MUTT_CONT)))
     {
       /* ignore comments */
       if (*buf == '#')
index 5f45b3d6a1be1a229518a1c192b466c447e39c5a..b4b2629eb3b7f2b3f8c634aead66251a0c65c874 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1006,7 +1006,7 @@ struct Content *mutt_get_content_info(const char *fname, struct Body *b)
 
   info = mutt_mem_calloc(1, sizeof(struct Content));
 
-  if (b != NULL && b->type == TYPE_TEXT && (!b->noconv && !b->force_charset))
+  if (b && b->type == TYPE_TEXT && (!b->noconv && !b->force_charset))
   {
     char *chs = mutt_param_get(&b->parameter, "charset");
     char *fchs = b->use_disp ?
@@ -1037,7 +1037,7 @@ struct Content *mutt_get_content_info(const char *fname, struct Body *b)
 
   mutt_file_fclose(&fp);
 
-  if (b != NULL && b->type == TYPE_TEXT && (!b->noconv && !b->force_charset))
+  if (b && b->type == TYPE_TEXT && (!b->noconv && !b->force_charset))
   {
     mutt_param_set(&b->parameter, "charset",
                    (!info->hibin ? "us-ascii" :
@@ -1107,7 +1107,7 @@ int mutt_lookup_mime_type(struct Body *att, const char *path)
     {
       found_mimetypes = true;
 
-      while (fgets(buf, sizeof(buf) - 1, f) != NULL)
+      while (fgets(buf, sizeof(buf) - 1, f))
       {
         /* weed out any comments */
         p = strchr(buf, '#');
@@ -3127,7 +3127,7 @@ int mutt_write_multiple_fcc(const char *path, struct Header *hdr, const char *ms
   if (status != 0)
     return status;
 
-  while ((tok = strtok(NULL, ",")) != NULL)
+  while ((tok = strtok(NULL, ",")))
   {
     if (!*tok)
       continue;
@@ -3331,7 +3331,7 @@ int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid,
 
     /* count the number of lines */
     rewind(tempfp);
-    while (fgets(sasha, sizeof(sasha), tempfp) != NULL)
+    while (fgets(sasha, sizeof(sasha), tempfp))
       lines++;
     fprintf(msg->fp, "Content-Length: " OFF_T_FMT "\n", (LOFF_T) ftello(tempfp));
     fprintf(msg->fp, "Lines: %d\n\n", lines);
diff --git a/sort.c b/sort.c
index 2c8ca592edf834bb6824626dbd8213477c336b86..444ec7477b6bd611537694117412c7a4d9973cd8 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -435,7 +435,7 @@ void mutt_sort_headers(struct Context *ctx, bool init)
   if ((Sort & SORT_MASK) == SORT_THREADS)
   {
     top = ctx->tree;
-    while ((thread = top) != NULL)
+    while ((thread = top))
     {
       while (!thread->message)
         thread = thread->child;