cproc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/cproc
Log | Files | Refs | Submodules | README | LICENSE

commit 6f65c9e5564d89e0512a80ae0301330c31dbc6e5
parent 4c697d5087e5f5aaa01bada73396058eed88525d
Author: Michael Forney <mforney@mforney.org>
Date:   Fri,  5 Apr 2019 20:08:55 -0700

Simplify a couple loops

Diffstat:
Mdecl.c | 12+++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/decl.c b/decl.c @@ -486,9 +486,7 @@ declaratortypes(struct scope *s, struct list *result, char **name, bool allowabs *p = mkparam(tok.lit, NULL, QUALNONE); p = &(*p)->next; next(); - if (!consume(TCOMMA)) - break; - } while (tok.kind == TIDENT); + } while (consume(TCOMMA) && tok.kind == TIDENT); break; } /* fallthrough */ @@ -517,12 +515,8 @@ declaratortypes(struct scope *s, struct list *result, char **name, bool allowabs case TLBRACK: /* array declarator */ next(); tq = QUALNONE; - for (;;) { - if (tok.kind == TSTATIC) - next(); /* ignore */ - else if (!typequal(&tq)) - break; - } + while (consume(TSTATIC) || typequal(&tq)) + ; if (tok.kind == TMUL) error(&tok.loc, "VLAs are not yet supported"); if (tok.kind == TRBRACK) {