diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2022-03-09 02:32:29 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2022-06-27 21:13:32 +0200 |
commit | a2527ee53d9d8fe7a1c29b56f8450b9ef1f9c7bc (patch) | |
tree | a4dbac6cea35ef3c675c9a12b37dc67719b1b5ac /conf/confbase.Y | |
parent | f31f4e6eef1762a4b9bf54a274f1ba9e9e161802 (diff) |
Filter: Improve handling of stack frames in filter bytecode
When f_line is done, we have to pop the stack frame. The old code just
removed nominal number of args/vars. Change it to use stored ventry value
modified by number of returned values. This allows to allocate variables
on a stack frame during execution of f_lines instead of just at start.
But we need to know the number of returned values for a f_line. It is 1
for term, 0 for cmd. Store that to f_line during linearization.
Diffstat (limited to 'conf/confbase.Y')
-rw-r--r-- | conf/confbase.Y | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/conf/confbase.Y b/conf/confbase.Y index 18ca8489..1d5738ff 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -153,14 +153,14 @@ conf: definition ; definition: DEFINE symbol '=' term ';' { struct f_val *val = cfg_allocz(sizeof(struct f_val)); - if (f_eval(f_linearize($4), cfg_mem, val) > F_RETURN) cf_error("Runtime error"); + if (f_eval(f_linearize($4, 1), cfg_mem, val) > F_RETURN) cf_error("Runtime error"); cf_define_symbol($2, SYM_CONSTANT | val->type, val, val); } ; expr: NUM - | '(' term ')' { $$ = f_eval_int(f_linearize($2)); } + | '(' term ')' { $$ = f_eval_int(f_linearize($2, 1)); } | CF_SYM_KNOWN { if ($1->class != (SYM_CONSTANT | T_INT)) cf_error("Number constant expected"); $$ = SYM_VAL($1).i; } |