Browse Source

frontend/define.c, ntharg(), #14/15 rewrite for(;;) loop

pre-master-46
rlar 11 years ago
parent
commit
a7f776872b
  1. 8
      src/frontend/define.c

8
src/frontend/define.c

@ -408,9 +408,7 @@ static struct pnode *
ntharg(int num, struct pnode *args) ntharg(int num, struct pnode *args)
{ {
// fact: num >= 1 for all known invocations of ntharg() // fact: num >= 1 for all known invocations of ntharg()
for (;;) {
if (!args)
return NULL;
for (; args; args = args->pn_right, --num) {
if (num <= 1) { if (num <= 1) {
if (args->pn_op && (args->pn_op->op_num == PT_OP_COMMA)) if (args->pn_op && (args->pn_op->op_num == PT_OP_COMMA))
return args->pn_left; return args->pn_left;
@ -421,9 +419,9 @@ ntharg(int num, struct pnode *args)
return args; return args;
return NULL; return NULL;
} }
num--;
args = args->pn_right;
} }
return NULL;
} }

Loading…
Cancel
Save