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.
This commit is contained in:
parent
0a513e6560
commit
1c845e0bd5
4 changed files with 10 additions and 6 deletions
|
|
@ -635,9 +635,11 @@ simpleaddr(void)
|
||||||
case '.':
|
case '.':
|
||||||
case '$':
|
case '$':
|
||||||
case '\'':
|
case '\'':
|
||||||
if(addr.type!='"')
|
if(addr.type=='"')
|
||||||
|
break;
|
||||||
|
/* fall through */
|
||||||
case '"':
|
case '"':
|
||||||
editerror("bad address syntax");
|
editerror("bad address syntax");
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
case '#':
|
case '#':
|
||||||
|
|
|
||||||
|
|
@ -559,9 +559,11 @@ simpleaddr(void)
|
||||||
case '.':
|
case '.':
|
||||||
case '$':
|
case '$':
|
||||||
case '\'':
|
case '\'':
|
||||||
if(addr.type!='"')
|
if(addr.type=='"')
|
||||||
|
break;
|
||||||
|
/* fall through */
|
||||||
case '"':
|
case '"':
|
||||||
error(Eaddress);
|
error(Eaddress);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
case '#':
|
case '#':
|
||||||
|
|
|
||||||
|
|
@ -700,11 +700,11 @@ bexecute(File *f, Posn startp)
|
||||||
break;
|
break;
|
||||||
case 1: /* expired; wrap to end */
|
case 1: /* expired; wrap to end */
|
||||||
if(sel.p[0].p1>=0)
|
if(sel.p[0].p1>=0)
|
||||||
case 3:
|
|
||||||
goto Return;
|
goto Return;
|
||||||
list[0][0].inst = list[1][0].inst = 0;
|
list[0][0].inst = list[1][0].inst = 0;
|
||||||
p = f->b.nc;
|
p = f->b.nc;
|
||||||
goto doloop;
|
goto doloop;
|
||||||
|
case 3:
|
||||||
default:
|
default:
|
||||||
goto Return;
|
goto Return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -169,8 +169,8 @@ newvisibilities(int redraw)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case V(Some, Some):
|
case V(Some, Some):
|
||||||
if(l->f.b==0 && redraw)
|
|
||||||
case V(None, Some):
|
case V(None, Some):
|
||||||
|
if(ov == None || (l->f.b==0 && redraw))
|
||||||
flprepare(l);
|
flprepare(l);
|
||||||
if(l->f.b && redraw){
|
if(l->f.b && redraw){
|
||||||
flrefresh(l, l->entire, 0);
|
flrefresh(l, l->entire, 0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue