]> diplodocus.org Git - nmh/commitdiff
Replace some "FALLTHRU" comments with control flow.
authorRalph Corderoy <ralph@inputplus.co.uk>
Tue, 23 May 2017 11:56:00 +0000 (12:56 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Tue, 23 May 2017 11:59:06 +0000 (12:59 +0100)
Instead of a case statement falling through, with a "FALLTHRU" comment,
to the follow case that just does a break, continue, goto, etc.,
control-flow statement, duplicate the statement in place of the comment.
Fall-through should be the exception, and saving a break statement
doesn't offset the cognitive cost when reading the source.

12 files changed:
sbr/mf.c
sbr/seq_read.c
uip/aliasbr.c
uip/fmttest.c
uip/inc.c
uip/mhbuildsbr.c
uip/new.c
uip/post.c
uip/rmf.c
uip/scansbr.c
uip/show.c
uip/whatnowsbr.c

index b6c7291..cf5b6d8 100644 (file)
--- a/sbr/mf.c
+++ b/sbr/mf.c
@@ -367,7 +367,7 @@ again: ;
                        strcpy (err, "extraneous semi-colon");
                        return NOTOK;
                    }
-                   /* FALLTHRU */
+                   return OK;
                case LX_COMA: 
                case LX_END: 
                    return OK;
index 500ea0b..c9cc924 100644 (file)
@@ -103,7 +103,7 @@ seq_public (struct msgs *mp, int lockflag, int *failed_to_lock)
            case BODY:
                lkfclosedata (fp, seqfile);
                adios (NULL, "no blank lines are permitted in %s", seqfile);
-               /* FALLTHRU */
+               break;
 
            case FILEEOF:
                break;
index 3e45678..489b707 100644 (file)
@@ -194,7 +194,7 @@ alias (char *file)
                    fclose (fp);
                    return i;
                }
-               /* FALLTHRU */
+               continue;
            case ':':           /* comment */
            case ';': 
            case '#':
index c59348f..ccfe25c 100644 (file)
@@ -647,7 +647,7 @@ process_single_file(FILE *in, struct msgs_array *comps, int *dat, int msgsize,
 
                fmt_addcomptext("body", rbuf);
            }
-           /* FALLTHRU */
+           goto finished;
 
        default:
            goto finished;
index b44e89e..529be75 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -691,7 +691,7 @@ go_to_it:
                trnflag = 0;
                noisy++;
                /* advise (cp, "unable to read"); already advised */
-               /* FALLTHRU */
+               break;
 
            case SCNERR:
            case SCNNUM:
@@ -852,7 +852,7 @@ go_to_it:
                trnflag = 0;
                noisy++;
                /* advise (cp, "unable to read"); already advised */
-               /* FALLTHRU */
+               break;
 
            case SCNERR:
            case SCNNUM:
index 8bd7be2..501bb88 100644 (file)
@@ -331,7 +331,7 @@ finish_field:
 
        case BODY:
            fseek (in, (long) (-strlen (buf)), SEEK_CUR);
-           /* FALLTHRU */
+           break;
        case FILEEOF:
            break;
 
index 49aba33..c82979e 100644 (file)
--- a/uip/new.c
+++ b/uip/new.c
@@ -178,7 +178,7 @@ get_msgnums(char *folder, char *sequences[])
 
             case BODY:
                 adios (NULL, "no blank lines are permitted in %s", seqfile);
-               /* FALLTHRU */
+                break;
 
             case FILEEOF:
                 break;
index 681556b..9723d26 100644 (file)
@@ -1866,7 +1866,7 @@ do_text (char *file, int fd)
        case RP_NO: 
        case RP_NDEL: 
            die (NULL, "posting failed; %s", rp_string (retval));
-           /* FALLTHRU */
+           break;
 
        default: 
            die (NULL, "unexpected response; %s", rp_string (retval));
index ec2f8fa..cede3b0 100644 (file)
--- a/uip/rmf.c
+++ b/uip/rmf.c
@@ -164,7 +164,7 @@ rmf (char *folder)
                if (strcmp (dp->d_name, ".") == 0
                        || strcmp (dp->d_name, "..") == 0)
                    continue;
-               /* FALLTHRU */
+               break;
 
            case ',': 
                break;
index 7d81b51..569991e 100644 (file)
@@ -260,7 +260,7 @@ body:;
                    state = BODY;
                    goto body;
                }
-               /* FALLTHRU */
+               goto finished;
 
            case FILEEOF:
                goto finished;
index 9430e00..ac01292 100644 (file)
@@ -414,7 +414,7 @@ invalid:
                            continue;
                        case '(':
                            i++;
-                           /* FALLTHRU */
+                           continue;
                        default:
                            continue;
                        case ')':
index 164a552..802535b 100644 (file)
@@ -1174,7 +1174,7 @@ sendit (char *sp, char **arg, char *file, int pushed)
                        inform("missing argument to %s", argp[-2]);
                        return;
                    }
-                   /* FALLTHRU */
+                   continue;
                case SNDRFSW:
                    continue;
            }