From: Ralph Corderoy Date: Tue, 23 May 2017 11:56:00 +0000 (+0100) Subject: Replace some "FALLTHRU" comments with control flow. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/1e18bf0ab892a2ae9d3151c248b652898f7d7116?hp=04b46522d25e71bc8e5066215b4ce1cd4f903486 Replace some "FALLTHRU" comments with control flow. 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. --- diff --git a/sbr/mf.c b/sbr/mf.c index b6c72912..cf5b6d81 100644 --- 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; diff --git a/sbr/seq_read.c b/sbr/seq_read.c index 500ea0b9..c9cc9240 100644 --- a/sbr/seq_read.c +++ b/sbr/seq_read.c @@ -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; diff --git a/uip/aliasbr.c b/uip/aliasbr.c index 3e456782..489b707b 100644 --- a/uip/aliasbr.c +++ b/uip/aliasbr.c @@ -194,7 +194,7 @@ alias (char *file) fclose (fp); return i; } - /* FALLTHRU */ + continue; case ':': /* comment */ case ';': case '#': diff --git a/uip/fmttest.c b/uip/fmttest.c index c59348f0..ccfe25c0 100644 --- a/uip/fmttest.c +++ b/uip/fmttest.c @@ -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; diff --git a/uip/inc.c b/uip/inc.c index b44e89e5..529be75e 100644 --- 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: diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 8bd7be2d..501bb88b 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -331,7 +331,7 @@ finish_field: case BODY: fseek (in, (long) (-strlen (buf)), SEEK_CUR); - /* FALLTHRU */ + break; case FILEEOF: break; diff --git a/uip/new.c b/uip/new.c index 49aba332..c82979ec 100644 --- 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; diff --git a/uip/post.c b/uip/post.c index 681556b3..9723d26f 100644 --- a/uip/post.c +++ b/uip/post.c @@ -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)); diff --git a/uip/rmf.c b/uip/rmf.c index ec2f8fa0..cede3b09 100644 --- 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; diff --git a/uip/scansbr.c b/uip/scansbr.c index 7d81b513..569991ec 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -260,7 +260,7 @@ body:; state = BODY; goto body; } - /* FALLTHRU */ + goto finished; case FILEEOF: goto finished; diff --git a/uip/show.c b/uip/show.c index 9430e009..ac012927 100644 --- a/uip/show.c +++ b/uip/show.c @@ -414,7 +414,7 @@ invalid: continue; case '(': i++; - /* FALLTHRU */ + continue; default: continue; case ')': diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index 164a552a..802535b3 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -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; }