Commit f3374d7e authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #122 from monaka/pr-simplify-peek_n-20110512

Simplify while loop in peek_n().
parents e6631bf5 40d122de
...@@ -3056,12 +3056,11 @@ peek_n(parser_state *p, int c, int n) ...@@ -3056,12 +3056,11 @@ peek_n(parser_state *p, int c, int n)
node *list = 0; node *list = 0;
int c0; int c0;
n++; /* must read 1 char */ do {
while (n--) {
c0 = nextc(p); c0 = nextc(p);
if (c0 < 0) return FALSE; if (c0 < 0) return FALSE;
list = push(list, (node*)(intptr_t)c0); list = push(list, (node*)(intptr_t)c0);
} } while(n--);
if (p->pb) { if (p->pb) {
p->pb = push(p->pb, (node*)list); p->pb = push(p->pb, (node*)list);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment