]> diplodocus.org Git - nmh/commitdiff
Split some comma-operator terms into separate statements.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sun, 7 May 2017 21:35:41 +0000 (22:35 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sun, 7 May 2017 21:35:41 +0000 (22:35 +0100)
Some uses of the comma operator weren't the idiomatic `p++, len--'.
Split its terms into two statements instead, e.g. `close(fd); fd = -1'.

sbr/datetime.c
sbr/dtime.c
uip/distsbr.c
uip/mhparse.c

index 48f02d4..693c49e 100644 (file)
@@ -95,7 +95,8 @@ parse_datetime (const char *datetime, const char *zone, int dst,
         set_dotw (tws);
         /* set_dotw() sets TW_SIMP.  Replace that with TW_SEXP so that
            dasctime() outputs the dotw before the date instead of after. */
         set_dotw (tws);
         /* set_dotw() sets TW_SIMP.  Replace that with TW_SEXP so that
            dasctime() outputs the dotw before the date instead of after. */
-        tws->tw_flags &= ~TW_SDAY, tws->tw_flags |= TW_SEXP;
+        tws->tw_flags &= ~TW_SDAY;
+        tws->tw_flags |= TW_SEXP;
 
         /* For the call to dmktime():
            - don't need tw_yday
 
         /* For the call to dmktime():
            - don't need tw_yday
index 5a61f9a..481cfe6 100644 (file)
@@ -386,7 +386,8 @@ set_dotw (struct tws *tw)
     if (tw->tw_wday < 0)
        tw->tw_wday += 7;
 
     if (tw->tw_wday < 0)
        tw->tw_wday += 7;
 
-    tw->tw_flags &= ~TW_SDAY, tw->tw_flags |= TW_SIMP;
+    tw->tw_flags &= ~TW_SDAY;
+    tw->tw_flags |= TW_SIMP;
 }
 
 
 }
 
 
index 640b30a..91eb0a8 100644 (file)
@@ -129,10 +129,14 @@ ready_msg (char *msgnam)
     char *cp = NULL;
     m_getfld_state_t gstate = 0;
 
     char *cp = NULL;
     m_getfld_state_t gstate = 0;
 
-    if (hdrfd != NOTOK)
-       close (hdrfd), hdrfd = NOTOK;
-    if (txtfd != NOTOK)
-       close (txtfd), txtfd = NOTOK;
+    if (hdrfd != NOTOK) {
+        close (hdrfd);
+        hdrfd = NOTOK;
+    }
+    if (txtfd != NOTOK) {
+        close (txtfd);
+        txtfd = NOTOK;
+    }
 
     if ((ifp = fopen (msgnam, "r")) == NULL)
        adios (msgnam, "unable to open message");
 
     if ((ifp = fopen (msgnam, "r")) == NULL)
        adios (msgnam, "unable to open message");
index 983324e..b174951 100644 (file)
@@ -659,9 +659,11 @@ get_ctinfo (char *cp, CT ct, int magic)
 
     for (dp = cp; istoken (*dp); dp++)
        continue;
 
     for (dp = cp; istoken (*dp); dp++)
        continue;
-    c = *dp, *dp = '\0';
+    c = *dp;
+    *dp = '\0';
     ci->ci_type = mh_xstrdup(cp);      /* store content type */
     ci->ci_type = mh_xstrdup(cp);      /* store content type */
-    *dp = c, cp = dp;
+    *dp = c;
+    cp = dp;
 
     if (!*ci->ci_type) {
        inform("invalid %s: field in message %s (empty type)",
 
     if (!*ci->ci_type) {
        inform("invalid %s: field in message %s (empty type)",
@@ -693,9 +695,11 @@ get_ctinfo (char *cp, CT ct, int magic)
 
     for (dp = cp; istoken (*dp); dp++)
        continue;
 
     for (dp = cp; istoken (*dp); dp++)
        continue;
-    c = *dp, *dp = '\0';
+    c = *dp;
+    *dp = '\0';
     ci->ci_subtype = mh_xstrdup(cp);   /* store the content subtype */
     ci->ci_subtype = mh_xstrdup(cp);   /* store the content subtype */
-    *dp = c, cp = dp;
+    *dp = c;
+    cp = dp;
 
     if (!*ci->ci_subtype) {
        inform("invalid %s: field in message %s (empty subtype for \"%s\")",
 
     if (!*ci->ci_subtype) {
        inform("invalid %s: field in message %s (empty subtype for \"%s\")",
@@ -906,9 +910,11 @@ get_dispo (char *cp, CT ct, int buildflag)
 
     for (dp = cp; istoken (*dp); dp++)
        continue;
 
     for (dp = cp; istoken (*dp); dp++)
        continue;
-    c = *dp, *dp = '\0';
+    c = *dp;
+    *dp = '\0';
     ct->c_dispo_type = mh_xstrdup(cp); /* store disposition type */
     ct->c_dispo_type = mh_xstrdup(cp); /* store disposition type */
-    *dp = c, cp = dp;
+    *dp = c;
+    cp = dp;
 
     if (*cp == '(' && get_comment (ct->c_file, DISPO_FIELD, &cp, NULL) == NOTOK)
        return NOTOK;
 
     if (*cp == '(' && get_comment (ct->c_file, DISPO_FIELD, &cp, NULL) == NOTOK)
        return NOTOK;
@@ -2008,7 +2014,8 @@ openQuoted (CT ct, char **file)
        for (ep = (cp = bufp) + cc - 1; cp <= ep; ep--)
            if (!isspace ((unsigned char) *ep))
                break;
        for (ep = (cp = bufp) + cc - 1; cp <= ep; ep--)
            if (!isspace ((unsigned char) *ep))
                break;
-       *++ep = '\n', ep++;
+        *++ep = '\n';
+        ep++;
 
        for (; cp < ep; cp++) {
            if (quoted > 0) {
 
        for (; cp < ep; cp++) {
            if (quoted > 0) {