]> granicus.if.org Git - neomutt/commitdiff
tidy char pointers
authorRichard Russon <rich@flatcap.org>
Wed, 15 May 2019 19:01:38 +0000 (20:01 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 16 May 2019 13:45:44 +0000 (14:45 +0100)
Make char-pointer dereferencing more consistent.
Any functions that used both `*ptr` and `ptr[0]` notation have been tidied.

16 files changed:
email/rfc2231.c
email/tags.c
handler.c
imap/imap.c
imap/util.c
init.c
mutt/date.c
mutt_header.c
muttlib.c
ncrypt/crypt_gpgme.c
ncrypt/gnupgparse.c
notmuch/mutt_notmuch.c
pager.c
pattern.c
postpone.c
sendlib.c

index 15363d344aaeae2699c4daa53cceeb7c6c3e15f6..ef17b563c5334cbf7796f7641c655fa61858bfe8 100644 (file)
@@ -115,10 +115,10 @@ static void decode_one(char *dest, char *src)
 
   for (d = dest; *src; src++)
   {
-    if ((*src == '%') && isxdigit((unsigned char) *(src + 1)) &&
-        isxdigit((unsigned char) *(src + 2)))
+    if ((src[0] == '%') && isxdigit((unsigned char) src[1]) &&
+        isxdigit((unsigned char) src[2]))
     {
-      *d++ = (hexval(*(src + 1)) << 4) | (hexval(*(src + 2)));
+      *d++ = (hexval(src[1]) << 4) | hexval(src[2]);
       src += 2;
     }
     else
@@ -267,9 +267,9 @@ void rfc2231_decode_parameters(struct ParameterList *p)
       else if (C_AssumedCharset)
         mutt_ch_convert_nonmime_string(&np->value);
     }
-    else if (*(s + 1) == '\0')
+    else if (s[1] == '\0')
     {
-      *s = '\0';
+      s[0] = '\0';
 
       s = get_charset(np->value, charset, sizeof(charset));
       decode_one(np->value, s);
@@ -279,12 +279,12 @@ void rfc2231_decode_parameters(struct ParameterList *p)
     }
     else
     {
-      *s = '\0';
+      s[0] = '\0';
       s++; /* let s point to the first character of index. */
-      for (t = s; *t && isdigit((unsigned char) *t); t++)
+      for (t = s; (t[0] != '\0') && isdigit((unsigned char) t[0]); t++)
         ;
-      encoded = (*t == '*');
-      *t = '\0';
+      encoded = (t[0] == '*');
+      t[0] = '\0';
 
       /* RFC2231 says that the index starts at 0 and increments by 1,
        * thus an overflow should never occur in a valid message, thus
index c4383345e4d766d1f8c6edfda32364d67be85214..ca0d8bf3e5a78e1ed7b3a0b8318c666fddb58b0e 100644 (file)
@@ -94,8 +94,8 @@ static void driver_tags_add(struct TagHead *head, char *new_tag)
     char *p = strstr(C_HiddenTags, new_tag);
     size_t xsz = p ? mutt_str_strlen(new_tag) : 0;
 
-    if (p && ((p == C_HiddenTags) || (*(p - 1) == ',') || (*(p - 1) == ' ')) &&
-        ((*(p + xsz) == '\0') || (*(p + xsz) == ',') || (*(p + xsz) == ' ')))
+    if (p && ((p == C_HiddenTags) || (p[-1] == ',') || (p[-1] == ' ')) &&
+        ((p[xsz] == '\0') || (p[xsz] == ',') || (p[xsz] == ' ')))
     {
       np->hidden = true;
     }
index b50a34d818654cf5d2f9307baf521dea73537112..f3bb0b9c560362a483c9276b261209de47375b96 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -215,14 +215,13 @@ static void decode_xbit(struct State *s, long len, bool istext, iconv_t cd)
 static int qp_decode_triple(char *s, char *d)
 {
   /* soft line break */
-  if ((*s == '=') && !(*(s + 1)))
+  if ((s[0] == '=') && (s[1] == '\0'))
     return 1;
 
   /* quoted-printable triple */
-  if ((*s == '=') && isxdigit((unsigned char) *(s + 1)) &&
-      isxdigit((unsigned char) *(s + 2)))
+  if ((s[0] == '=') && isxdigit((unsigned char) s[1]) && isxdigit((unsigned char) s[2]))
   {
-    *d = (hexval(*(s + 1)) << 4) | hexval(*(s + 2));
+    *d = (hexval(s[1]) << 4) | hexval(s[2]);
     return 0;
   }
 
@@ -450,7 +449,7 @@ static bool is_mmnoask(const char *buf)
     q = strrchr(p, '/');
     if (q)
     {
-      if (*(q + 1) == '*')
+      if (q[1] == '*')
       {
         if (mutt_str_strncasecmp(buf, p, q - p) == 0)
           return true;
index 4685861b5ebb474f62f7d2e4aff94332b4ae2ef5..7d752da8f38273288bb1e8f1634698c3d7db7811 100644 (file)
@@ -2333,7 +2333,7 @@ static int imap_tags_edit(struct Mailbox *m, const char *tags, char *buf, size_t
     }
 
     /* Skip duplicate space */
-    while ((*checker == ' ') && (*(checker + 1) == ' '))
+    while ((checker[0] == ' ') && (checker[1] == ' '))
       checker++;
 
     /* copy char to new and go the next one */
index 729e532b8f8f649f185d51493b28049fa27b99a2..ad75599e0b42f54abfe2dd872b0844fc633961d8 100644 (file)
@@ -822,13 +822,13 @@ void imap_cachepath(char delim, const char *mailbox, char *dest, size_t dlen)
   char *s = NULL;
   const char *p = mailbox;
 
-  for (s = dest; p && *p && dlen; dlen--)
+  for (s = dest; p && (p[0] != '\0') && (dlen > 0); dlen--)
   {
-    if (*p == delim)
+    if (p[0] == delim)
     {
       *s = '/';
       /* simple way to avoid collisions with UIDs */
-      if ((*(p + 1) >= '0') && (*(p + 1) <= '9'))
+      if ((p[1] >= '0') && (p[1] <= '9'))
       {
         if (--dlen)
           *++s = '_';
diff --git a/init.c b/init.c
index 5085ad6837a19b2ab7b25e8933f4c213935a5ef7..a1725408e38c109a72d71b85fb1209b2422e8c4d 100644 (file)
--- a/init.c
+++ b/init.c
@@ -2688,15 +2688,15 @@ int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags
       qc = ch;
     else if ((ch == '\\') && (qc != '\''))
     {
-      if (!*tok->dptr)
+      if (tok->dptr[0] == '\0')
         return -1; /* premature end of token */
       switch (ch = *tok->dptr++)
       {
         case 'c':
         case 'C':
-          if (!*tok->dptr)
+          if (tok->dptr[0] == '\0')
             return -1; /* premature end of token */
-          mutt_buffer_addch(dest, (toupper((unsigned char) *tok->dptr) - '@') & 0x7f);
+          mutt_buffer_addch(dest, (toupper((unsigned char) tok->dptr[0]) - '@') & 0x7f);
           tok->dptr++;
           break;
         case 'e':
@@ -2715,10 +2715,10 @@ int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags
           mutt_buffer_addch(dest, '\t');
           break;
         default:
-          if (isdigit((unsigned char) ch) && isdigit((unsigned char) *tok->dptr) &&
-              isdigit((unsigned char) *(tok->dptr + 1)))
+          if (isdigit((unsigned char) ch) && isdigit((unsigned char) tok->dptr[0]) &&
+              isdigit((unsigned char) tok->dptr[1]))
           {
-            mutt_buffer_addch(dest, (ch << 6) + (*tok->dptr << 3) + *(tok->dptr + 1) - 3504);
+            mutt_buffer_addch(dest, (ch << 6) + (tok->dptr[0] << 3) + tok->dptr[1] - 3504);
             tok->dptr += 2;
           }
           else
@@ -2727,7 +2727,7 @@ int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags
     }
     else if ((ch == '^') && (flags & MUTT_TOKEN_CONDENSE))
     {
-      if (!*tok->dptr)
+      if (tok->dptr[0] == '\0')
         return -1; /* premature end of token */
       ch = *tok->dptr++;
       if (ch == '^')
@@ -2761,7 +2761,7 @@ int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags
           if (*pc == '\\')
             pc += 2;
         }
-      } while (pc && *pc != '`');
+      } while (pc && (pc[0] != '`'));
       if (!pc)
       {
         mutt_debug(LL_DEBUG1, "mismatched backticks\n");
@@ -2825,12 +2825,12 @@ int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags
       }
     }
     else if ((ch == '$') && (!qc || (qc == '"')) &&
-             ((*tok->dptr == '{') || isalpha((unsigned char) *tok->dptr)))
+             ((tok->dptr[0] == '{') || isalpha((unsigned char) tok->dptr[0])))
     {
       const char *env = NULL;
       char *var = NULL;
 
-      if (*tok->dptr == '{')
+      if (tok->dptr[0] == '{')
       {
         pc = strchr(tok->dptr, '}');
         if (pc)
@@ -2850,7 +2850,7 @@ int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags
       }
       else
       {
-        for (pc = tok->dptr; isalnum((unsigned char) *pc) || *pc == '_'; pc++)
+        for (pc = tok->dptr; isalnum((unsigned char) *pc) || (pc[0] == '_'); pc++)
           ;
         var = mutt_str_substr_dup(tok->dptr, pc);
         tok->dptr = pc;
index af12e1459f11c3e6f27c514c0099e7ee7406da0b..ab1b7465d4584c32143181e2e40a7039bcaadf9c 100644 (file)
@@ -424,7 +424,7 @@ int mutt_date_check_month(const char *s)
  */
 bool mutt_date_is_day_name(const char *s)
 {
-  if (!s || (strlen(s) < 3) || !*(s + 3) || !IS_SPACE(*(s + 3)))
+  if (!s || (strlen(s) < 3) || (s[3] == '\0') || !IS_SPACE(s[3]))
     return false;
 
   for (int i = 0; i < mutt_array_size(Weekdays); i++)
index 15ec5033a8393ad9f4a2050d5220ebb2479a93bc..689c6586f2d6382e4605c0bf0d130d6c257937f0 100644 (file)
@@ -305,15 +305,15 @@ void mutt_edit_headers(const char *editor, const char *body, struct Email *msg,
       if (*p)
       {
         size_t l = 0;
-        for (; *p && *p != ' ' && *p != '\t'; p++)
+        for (; (p[0] != '\0') && (p[0] != ' ') && (p[0] != '\t'); p++)
         {
-          if (*p == '\\')
+          if (p[0] == '\\')
           {
-            if (!*(p + 1))
+            if (p[1] == '\0')
               break;
             p++;
           }
-          if (l < sizeof(path) - 1)
+          if (l < (sizeof(path) - 1))
             path[l++] = *p;
         }
         p = mutt_str_skip_email_wsp(p);
index 852002df2823c311b05c8908dd8f211454702ab9..fbdcfe42553d1876b324f389063bbfd66b239d5a 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -156,7 +156,7 @@ void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex)
     {
       case '~':
       {
-        if ((*(s + 1) == '/') || (*(s + 1) == 0))
+        if ((s[1] == '/') || (s[1] == '\0'))
         {
           mutt_buffer_strcpy(p, HomeDir);
           tail = s + 1;
@@ -258,7 +258,7 @@ void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex)
 
       case '!':
       {
-        if (*(s + 1) == '!')
+        if (s[1] == '!')
         {
           mutt_buffer_strcpy(p, LastFolder);
           tail = s + 2;
index c5cd0823aac0e78ca1b235359886a17dbfdc8b4d..59dec0c8414ed2f99eab40a15b6ae7ee75672b16 100644 (file)
@@ -3812,9 +3812,9 @@ static const char *parse_dn_part(struct DnArray *array, const char *str)
   char *p = NULL;
 
   /* parse attribute type */
-  for (s = str + 1; *s && *s != '='; s++)
+  for (s = str + 1; (s[0] != '\0') && (s[0] != '='); s++)
     ;
-  if (!*s)
+  if (s[0] == '\0')
     return NULL; /* error */
   n = s - str;
   if (n == 0)
@@ -3852,7 +3852,7 @@ static const char *parse_dn_part(struct DnArray *array, const char *str)
         {
           n++;
         }
-        else if (isxdigit(*s) && isxdigit(*(s + 1)))
+        else if (isxdigit(s[0]) && isxdigit(s[1]))
         {
           s++;
           n++;
@@ -3912,9 +3912,9 @@ static struct DnArray *parse_dn(const char *str)
   arrayidx = 0;
   while (*str)
   {
-    while (*str == ' ')
+    while (str[0] == ' ')
       str++;
-    if (!*str)
+    if (str[0] == '\0')
       break; /* ready */
     if (arrayidx >= arraysize)
     {
@@ -3935,11 +3935,11 @@ static struct DnArray *parse_dn(const char *str)
     arrayidx++;
     if (!str)
       goto failure;
-    while (*str == ' ')
+    while (str[0] == ' ')
       str++;
-    if (*str && (*str != ',') && (*str != ';') && (*str != '+'))
+    if ((str[0] != '\0') && (str[0] != ',') && (str[0] != ';') && (str[0] != '+'))
       goto failure; /* invalid delimiter */
-    if (*str)
+    if (str[0] != '\0')
       str++;
   }
   array[arrayidx].key = NULL;
index a8214ac407b209df0cb5b0c7c6416a8f9b7610db..35f0dc4b14e49f61618bc13c4101899d0326b54a 100644 (file)
@@ -82,10 +82,10 @@ static void fix_uid(char *uid)
 
   for (s = uid, d = uid; *s;)
   {
-    if ((*s == '\\') && (*(s + 1) == 'x') &&
-        isxdigit((unsigned char) *(s + 2)) && isxdigit((unsigned char) *(s + 3)))
+    if ((s[0] == '\\') && (s[1] == 'x') && isxdigit((unsigned char) s[2]) &&
+        isxdigit((unsigned char) s[3]))
     {
-      *d++ = hexval(*(s + 2)) << 4 | hexval(*(s + 3));
+      *d++ = (hexval(s[2]) << 4) | hexval(s[3]);
       s += 4;
     }
     else
@@ -110,7 +110,7 @@ static void fix_uid(char *uid)
         memcpy(uid, buf, ob - buf);
         uid[ob - buf] = '\0';
       }
-      else if ((n >= 0) && (ob - buf == n) && (buf[n] = 0, (strlen(buf) < (size_t) n)))
+      else if ((n >= 0) && ((ob - buf) == n) && (buf[n] = 0, (strlen(buf) < (size_t) n)))
         memcpy(uid, buf, n);
     }
     FREE(&buf);
index 7218df1460190904da2d4dbbc1d15d6607438782..b2c411ae583078602eb19c9aab0c4a2af033ed42 100644 (file)
@@ -565,15 +565,15 @@ static void apply_exclude_tags(notmuch_query_t *query)
 
   char *buf = mutt_str_strdup(C_NmExcludeTags);
 
-  for (char *p = buf; p && *p; p++)
+  for (char *p = buf; p && (p[0] != '\0'); p++)
   {
     if (!tag && isspace(*p))
       continue;
     if (!tag)
       tag = p; /* begin of the tag */
-    if ((*p == ',') || (*p == ' '))
+    if ((p[0] == ',') || (p[0] == ' '))
       end = p; /* terminate the tag */
-    else if (*(p + 1) == '\0')
+    else if (p[1] == '\0')
       end = p + 1; /* end of optstr */
     if (!tag || !end)
       continue;
@@ -1264,23 +1264,23 @@ static int update_tags(notmuch_message_t *msg, const char *tags)
       continue;
     if (!tag)
       tag = p; /* begin of the tag */
-    if ((*p == ',') || (*p == ' '))
+    if ((p[0] == ',') || (p[0] == ' '))
       end = p; /* terminate the tag */
-    else if (*(p + 1) == '\0')
+    else if (p[1] == '\0')
       end = p + 1; /* end of optstr */
     if (!tag || !end)
       continue;
     if (tag >= end)
       break;
 
-    *end = '\0';
+    end[0] = '\0';
 
-    if (*tag == '-')
+    if (tag[0] == '-')
     {
       mutt_debug(LL_DEBUG1, "nm: remove tag: '%s'\n", tag + 1);
       notmuch_message_remove_tag(msg, tag + 1);
     }
-    else if (*tag == '!')
+    else if (tag[0] == '!')
     {
       mutt_debug(LL_DEBUG1, "nm: toggle tag: '%s'\n", tag + 1);
       if (nm_message_has_tag(msg, tag + 1))
@@ -1294,8 +1294,8 @@ static int update_tags(notmuch_message_t *msg, const char *tags)
     }
     else
     {
-      mutt_debug(LL_DEBUG1, "nm: add tag: '%s'\n", (*tag == '+') ? tag + 1 : tag);
-      notmuch_message_add_tag(msg, (*tag == '+') ? tag + 1 : tag);
+      mutt_debug(LL_DEBUG1, "nm: add tag: '%s'\n", (tag[0] == '+') ? tag + 1 : tag);
+      notmuch_message_add_tag(msg, (tag[0] == '+') ? tag + 1 : tag);
     }
     end = NULL;
     tag = NULL;
@@ -1331,20 +1331,20 @@ static int update_email_flags(struct Mailbox *m, struct Email *e, const char *ta
       continue;
     if (!tag)
       tag = p; /* begin of the tag */
-    if ((*p == ',') || (*p == ' '))
+    if ((p[0] == ',') || (p[0] == ' '))
       end = p; /* terminate the tag */
-    else if (*(p + 1) == '\0')
+    else if (p[1] == '\0')
       end = p + 1; /* end of optstr */
     if (!tag || !end)
       continue;
     if (tag >= end)
       break;
 
-    *end = '\0';
+    end[0] = '\0';
 
-    if (*tag == '-')
+    if (tag[0] == '-')
     {
-      tag = tag + 1;
+      tag++;
       if (strcmp(tag, C_NmUnreadTag) == 0)
         mutt_set_flag(m, e, MUTT_READ, true);
       else if (strcmp(tag, C_NmRepliedTag) == 0)
@@ -1354,7 +1354,7 @@ static int update_email_flags(struct Mailbox *m, struct Email *e, const char *ta
     }
     else
     {
-      tag = (*tag == '+') ? tag + 1 : tag;
+      tag = (tag[0] == '+') ? tag + 1 : tag;
       if (strcmp(tag, C_NmUnreadTag) == 0)
         mutt_set_flag(m, e, MUTT_READ, false);
       else if (strcmp(tag, C_NmRepliedTag) == 0)
diff --git a/pager.c b/pager.c
index bc9496cc43d80c4799c148943616338adebf738e..3d7048102773e6fc869ec55fe31e1dc3d418d514 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -836,8 +836,12 @@ static int braille_col = -1;
  */
 static int check_marker(const char *q, const char *p)
 {
-  for (; *p == *q && *q && *p && *q != '\a' && *p != '\a'; p++, q++)
-    ;
+  for (; (p[0] == q[0]) && (q[0] != '\0') && (p[0] != '\0') && (q[0] != '\a') &&
+         (p[0] != '\a');
+       p++, q++)
+  {
+  }
+
   return (int) (*p - *q);
 }
 
@@ -1319,24 +1323,24 @@ static int fill_buffer(FILE *fp, LOFF_T *last_pos, LOFF_T offset, unsigned char
     q = *fmt;
     while (*p)
     {
-      if ((*p == '\010') && (p > *buf)) // Ctrl-H (backspace)
+      if ((p[0] == '\010') && (p > *buf)) // Ctrl-H (backspace)
       {
-        if (*(p + 1) == '_') /* underline */
+        if (p[1] == '_') /* underline */
           p += 2;
-        else if (*(p + 1) && (q > *fmt)) /* bold or overstrike */
+        else if ((p[1] != '\0') && (q > *fmt)) /* bold or overstrike */
         {
-          *(q - 1) = *(p + 1);
+          q[-1] = p[1];
           p += 2;
         }
         else /* ^H */
           *q++ = *p++;
       }
-      else if ((*p == '\033') && (*(p + 1) == '[') && is_ansi(p + 2)) // Escape
+      else if ((p[0] == '\033') && (p[1] == '[') && is_ansi(p + 2)) // Escape
       {
         while (*p++ != 'm') /* skip ANSI sequence */
           ;
       }
-      else if ((*p == '\033') && (*(p + 1) == ']') && // Escape
+      else if ((p[0] == '\033') && (p[1] == ']') && // Escape
                ((check_attachment_marker((char *) p) == 0) ||
                 (check_protected_header_marker((char *) p) == 0)))
       {
index e41da2c1c9e4dc00086babb7ea0f57b8fa95d94d..619957be0f0ee2f108a98e0a62daf7d4e1334798 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -1460,17 +1460,17 @@ struct PatternHead *mutt_pattern_comp(/* const */ char *s, int flags, struct Buf
       case '~':
       {
         struct Pattern *pat = NULL;
-        if (!*(ps.dptr + 1))
+        if (ps.dptr[1] == '\0')
         {
           mutt_buffer_printf(err, _("missing pattern: %s"), ps.dptr);
           goto cleanup;
         }
         thread_op = 0;
-        if (*(ps.dptr + 1) == '(')
+        if (ps.dptr[1] == '(')
           thread_op = MUTT_PAT_THREAD;
-        else if ((*(ps.dptr + 1) == '<') && (*(ps.dptr + 2) == '('))
+        else if ((ps.dptr[1] == '<') && (ps.dptr[2] == '('))
           thread_op = MUTT_PAT_PARENT;
-        else if ((*(ps.dptr + 1) == '>') && (*(ps.dptr + 2) == '('))
+        else if ((ps.dptr[1] == '>') && (ps.dptr[2] == '('))
           thread_op = MUTT_PAT_CHILDREN;
         if (thread_op)
         {
@@ -1478,7 +1478,7 @@ struct PatternHead *mutt_pattern_comp(/* const */ char *s, int flags, struct Buf
           if ((thread_op == MUTT_PAT_PARENT) || (thread_op == MUTT_PAT_CHILDREN))
             ps.dptr++;
           p = find_matching_paren(ps.dptr + 1);
-          if (*p != ')')
+          if (p[0] != ')')
           {
             mutt_buffer_printf(err, _("mismatched parentheses: %s"), ps.dptr);
             goto cleanup;
@@ -1527,8 +1527,8 @@ struct PatternHead *mutt_pattern_comp(/* const */ char *s, int flags, struct Buf
         pat->not = not;
         pat->alladdr = alladdr;
         pat->isalias = isalias;
-        pat->stringmatch = (*ps.dptr == '=');
-        pat->groupmatch = (*ps.dptr == '%');
+        pat->stringmatch = (ps.dptr[0] == '=');
+        pat->groupmatch = (ps.dptr[0] == '%');
         not = false;
         alladdr = false;
         isalias = false;
@@ -1560,7 +1560,7 @@ struct PatternHead *mutt_pattern_comp(/* const */ char *s, int flags, struct Buf
 
         if (entry->eat_arg)
         {
-          if (!*ps.dptr)
+          if (ps.dptr[0] == '\0')
           {
             mutt_buffer_printf(err, "%s", _("missing parameter"));
             goto cleanup;
@@ -1577,7 +1577,7 @@ struct PatternHead *mutt_pattern_comp(/* const */ char *s, int flags, struct Buf
       case '(':
       {
         p = find_matching_paren(ps.dptr + 1);
-        if (*p != ')')
+        if (p[0] != ')')
         {
           mutt_buffer_printf(err, _("mismatched parentheses: %s"), ps.dptr);
           goto cleanup;
@@ -2268,11 +2268,11 @@ void mutt_check_simple(struct Buffer *buf, const char *simple)
 {
   bool do_simple = true;
 
-  for (const char *p = mutt_b2s(buf); p && *p; p++)
+  for (const char *p = mutt_b2s(buf); p && (p[0] != '\0'); p++)
   {
-    if ((*p == '\\') && *(p + 1))
+    if ((p[0] == '\\') && (p[1] != '\0'))
       p++;
-    else if ((*p == '~') || (*p == '=') || (*p == '%'))
+    else if ((p[0] == '~') || (p[0] == '=') || (p[0] == '%'))
     {
       do_simple = false;
       break;
index 4c321e9e074845f931f0c2a9325ca1b93fa4c0e2..a385afbddaa59b9f55d2f750ae25858934f0b439 100644 (file)
@@ -457,23 +457,23 @@ SecurityFlags mutt_parse_crypt_hdr(const char *p, bool set_empty_signas, Securit
     return SEC_NO_FLAGS;
 
   p = mutt_str_skip_email_wsp(p);
-  for (; *p; p++)
+  for (; p[0] != '\0'; p++)
   {
-    switch (*p)
+    switch (p[0])
     {
       case 'c':
       case 'C':
         q = smime_cryptalg;
 
-        if (*(p + 1) == '<')
+        if (p[1] == '<')
         {
-          for (p += 2; *p && (*p != '>') &&
+          for (p += 2; (p[0] != '\0') && (p[0] != '>') &&
                        (q < (smime_cryptalg + sizeof(smime_cryptalg) - 1));
                *q++ = *p++)
           {
           }
 
-          if (*p != '>')
+          if (p[0] != '>')
           {
             mutt_error(_("Illegal S/MIME header"));
             return SEC_NO_FLAGS;
@@ -499,11 +499,11 @@ SecurityFlags mutt_parse_crypt_hdr(const char *p, bool set_empty_signas, Securit
        * to be able to recall old messages.  */
       case 'm':
       case 'M':
-        if (*(p + 1) == '<')
+        if (p[1] == '<')
         {
-          for (p += 2; *p && (*p != '>'); p++)
+          for (p += 2; (p[0] != '\0') && (p[0] != '>'); p++)
             ;
-          if (*p != '>')
+          if (p[0] != '>')
           {
             mutt_error(_("Illegal crypto header"));
             return SEC_NO_FLAGS;
@@ -522,21 +522,22 @@ SecurityFlags mutt_parse_crypt_hdr(const char *p, bool set_empty_signas, Securit
         flags |= SEC_SIGN;
         q = sign_as;
 
-        if (*(p + 1) == '<')
+        if (p[1] == '<')
         {
-          for (p += 2; *p && (*p != '>') && (q < (sign_as + sizeof(sign_as) - 1));
+          for (p += 2;
+               (p[0] != '\0') && (*p != '>') && (q < (sign_as + sizeof(sign_as) - 1));
                *q++ = *p++)
           {
           }
 
-          if (*p != '>')
+          if (p[0] != '>')
           {
             mutt_error(_("Illegal crypto header"));
             return SEC_NO_FLAGS;
           }
         }
 
-        *q = '\0';
+        q[0] = '\0';
         break;
 
       default:
index e203c07365a1735e6e32ad5362c4119e34187354..9f37753d271d989704e3ed65593423a33c199108 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1848,7 +1848,7 @@ void mutt_write_references(const struct ListHead *r, FILE *fp, size_t trim)
 static int print_val(FILE *fp, const char *pfx, const char *value,
                      CopyHeaderFlags chflags, size_t col)
 {
-  while (value && *value)
+  while (value && (value[0] != '\0'))
   {
     if (fputc(*value, fp) == EOF)
       return -1;
@@ -1862,13 +1862,13 @@ static int print_val(FILE *fp, const char *pfx, const char *value,
     }
     if (*value == '\n')
     {
-      if (*(value + 1) && pfx && *pfx && (fputs(pfx, fp) == EOF))
+      if ((value[1] != '\0') && pfx && (pfx[0] != '\0') && (fputs(pfx, fp) == EOF))
         return -1;
       /* for display, turn folding spaces into folding tabs */
-      if ((chflags & CH_DISPLAY) && ((*(value + 1) == ' ') || (*(value + 1) == '\t')))
+      if ((chflags & CH_DISPLAY) && ((value[1] == ' ') || (value[1] == '\t')))
       {
         value++;
-        while (*value && ((*value == ' ') || (*value == '\t')))
+        while ((value[0] != '\0') && ((value[0] == ' ') || (value[0] == '\t')))
           value++;
         if (fputc('\t', fp) == EOF)
           return -1;
@@ -1906,7 +1906,7 @@ static int fold_one_header(FILE *fp, const char *tag, const char *value,
     return -1;
   col = mutt_str_strlen(tag) + ((tag && (tag[0] != '\0')) ? 2 : 0) + mutt_str_strlen(pfx);
 
-  while (p && *p)
+  while (p && (p[0] != '\0'))
   {
     int fold = 0;
 
@@ -1927,7 +1927,7 @@ static int fold_one_header(FILE *fp, const char *tag, const char *value,
     /* insert a folding \n before the current word's lwsp except for
      * header name, first word on a line (word longer than wrap width)
      * and encoded words */
-    if (!first && !enc && col && (col + w >= wraplen))
+    if (!first && !enc && col && ((col + w) >= wraplen))
     {
       col = mutt_str_strlen(pfx);
       fold = 1;
@@ -1940,7 +1940,7 @@ static int fold_one_header(FILE *fp, const char *tag, const char *value,
     if (display && fold)
     {
       char *pc = buf;
-      while (*pc && ((*pc == ' ') || (*pc == '\t')))
+      while ((pc[0] != '\0') && ((pc[0] == ' ') || (pc[0] == '\t')))
       {
         pc++;
         col--;
@@ -1962,9 +1962,9 @@ static int fold_one_header(FILE *fp, const char *tag, const char *value,
      * XXX this covers ASCII space only, for display we probably
      * want something like iswspace() here */
     const char *sp = next;
-    while (*sp && ((*sp == ' ') || (*sp == '\t')))
+    while ((sp[0] != '\0') && ((sp[0] == ' ') || (sp[0] == '\t')))
       sp++;
-    if (*sp == '\n')
+    if (sp[0] == '\n')
     {
       next = sp;
       col = 0;
@@ -1994,18 +1994,18 @@ static char *unfold_header(char *s)
 {
   char *p = s, *q = s;
 
-  while (p && *p)
+  while (p && (p[0] != '\0'))
   {
     /* remove CRLF prior to FWSP, turn \t into ' ' */
-    if ((*p == '\r') && *(p + 1) && (*(p + 1) == '\n') && *(p + 2) &&
-        ((*(p + 2) == ' ') || (*(p + 2) == '\t')))
+    if ((p[0] == '\r') && (p[1] != '\0') && (p[1] == '\n') && (p[2] != '\0') &&
+        ((p[2] == ' ') || (p[2] == '\t')))
     {
       *q++ = ' ';
       p += 3;
       continue;
     }
     /* remove LF prior to FWSP, turn \t into ' ' */
-    else if ((*p == '\n') && *(p + 1) && ((*(p + 1) == ' ') || (*(p + 1) == '\t')))
+    else if ((p[0] == '\n') && (p[1] != '\0') && ((p[1] == ' ') || (p[1] == '\t')))
     {
       *q++ = ' ';
       p += 2;
@@ -2014,7 +2014,7 @@ static char *unfold_header(char *s)
     *q++ = *p++;
   }
   if (q)
-    *q = '\0';
+    q[0] = '\0';
 
   return s;
 }