mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-24 18:28:55 -06:00
slight optimization for the linearizer in the C runtime
This commit is contained in:
@@ -181,23 +181,24 @@ pgf_lzn_resolve_app(PgfLzn* lzn, GuBuf* buf, GuBuf* args, GuPool* pool)
|
|||||||
GuChoiceMark mark = gu_choice_mark(lzn->ch);
|
GuChoiceMark mark = gu_choice_mark(lzn->ch);
|
||||||
int save_fid = lzn->fid;
|
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:;
|
redo:;
|
||||||
int index = gu_choice_next(lzn->ch, gu_buf_length(buf));
|
int index = gu_choice_next(lzn->ch, gu_buf_length(buf));
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return gu_null_variant;
|
return gu_null_variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t n_args = gu_buf_length(args);
|
|
||||||
|
|
||||||
PgfProductionApply* papply =
|
PgfProductionApply* papply =
|
||||||
gu_buf_get(buf, PgfProductionApply*, index);
|
gu_buf_get(buf, PgfProductionApply*, index);
|
||||||
gu_assert(n_args == gu_seq_length(papply->args));
|
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->fun = papply->fun;
|
||||||
capp->fid = 0;
|
capp->fid = 0;
|
||||||
capp->n_args = n_args;
|
capp->n_args = n_args;
|
||||||
|
|||||||
Reference in New Issue
Block a user