From 1c845e0bd5ff897dc5e90f2c24db4ecd81a8f60c Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 5 Jan 2021 23:38:09 -0500 Subject: acme, sam, samterm: remove weird switch usage For whatever reason all three of these programs contain switches like: switch(x) { case 1: if(cond) case 2: f(); } Like Duff's device, this is legal C but more obscure than it really needs to be. This commit assumes those are intended as written and simply writes them more clearly. I did consider that maybe they are mistakes, but in the case of sam/regexp.c, my rewrite in this commit matches the acme/regx.c that has been in plan9port since I added acme in 2003. (I didn't bother to dig up the old Plan 9 releases.) Assuming acme/regx.c has been correct for the past two decades, this commit should be correct too. --- src/cmd/sam/regexp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmd/sam/regexp.c') diff --git a/src/cmd/sam/regexp.c b/src/cmd/sam/regexp.c index 2e369fe1..57c639d9 100644 --- a/src/cmd/sam/regexp.c +++ b/src/cmd/sam/regexp.c @@ -700,11 +700,11 @@ bexecute(File *f, Posn startp) break; case 1: /* expired; wrap to end */ if(sel.p[0].p1>=0) - case 3: goto Return; list[0][0].inst = list[1][0].inst = 0; p = f->b.nc; goto doloop; + case 3: default: goto Return; } -- cgit v1.2.3