Use a for-loop instead of repeatedly calling ary_entry inside
a while-loop. The simple integer comparison will be faster
than the function call. (And in any case, the
_Wikitext_pop_from_stack function which is called here will
do an ary_entry call anyway; so what's really happening here
with this change is that we call ary_entry once for each item
instead of twice.)
Signed-off-by: Wincent Colaiuta <win@wincent.com>
void _Wikitext_pop_all_from_stack(parser_t *parser, VALUE target)
{
- while (!NO_ITEM(ary_entry(parser->scope, -1)))
+ for (int i = 0, max = parser->scope->count; i < max; i++)
_Wikitext_pop_from_stack(parser, target);
}