summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-09-04 07:11:14 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-09-04 07:11:14 +0000
commit0aef8d1c72559e4306d50e863bafe538628a35aa (patch)
treebe69102e8c288d493682f2fd8efa37852f2e3e93 /src
parent69e71b6a4ea33219d65afebffcfffcf14f71e8fa (diff)
slight optimization for the linearizer in the C runtime
Diffstat (limited to 'src')
-rw-r--r--src/runtime/c/pgf/linearizer.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/runtime/c/pgf/linearizer.c b/src/runtime/c/pgf/linearizer.c
index 7dd9dbbc4..81d2529c7 100644
--- a/src/runtime/c/pgf/linearizer.c
+++ b/src/runtime/c/pgf/linearizer.c
@@ -181,23 +181,24 @@ pgf_lzn_resolve_app(PgfLzn* lzn, GuBuf* buf, GuBuf* args, GuPool* pool)
GuChoiceMark mark = gu_choice_mark(lzn->ch);
int save_fid = lzn->fid;
+ size_t n_args = gu_buf_length(args);
+
+ PgfCncTree ret = gu_null_variant;
+ PgfCncTreeApp* capp =
+ gu_new_flex_variant(PGF_CNC_TREE_APP,
+ PgfCncTreeApp,
+ args, n_args, &ret, pool);
+
redo:;
int index = gu_choice_next(lzn->ch, gu_buf_length(buf));
if (index < 0) {
return gu_null_variant;
}
- size_t n_args = gu_buf_length(args);
-
PgfProductionApply* papply =
gu_buf_get(buf, PgfProductionApply*, index);
gu_assert(n_args == gu_seq_length(papply->args));
- PgfCncTree ret = gu_null_variant;
- PgfCncTreeApp* capp =
- gu_new_flex_variant(PGF_CNC_TREE_APP,
- PgfCncTreeApp,
- args, n_args, &ret, pool);
capp->fun = papply->fun;
capp->fid = 0;
capp->n_args = n_args;