bc: in bc_program_execStr(), push two variables into inner scope
function old new delta bc_program_execStr 502 496 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
927a7d6853
commit
5ec4b49125
@ -6505,8 +6505,6 @@ static BcStatus bc_program_execStr(char *code, size_t *bgn,
|
|||||||
BcParse prs;
|
BcParse prs;
|
||||||
BcInstPtr ip;
|
BcInstPtr ip;
|
||||||
size_t fidx, sidx;
|
size_t fidx, sidx;
|
||||||
BcNum *n;
|
|
||||||
bool exec;
|
|
||||||
|
|
||||||
if (!BC_PROG_STACK(&G.prog.results, 1))
|
if (!BC_PROG_STACK(&G.prog.results, 1))
|
||||||
return bc_error_stack_has_too_few_elements();
|
return bc_error_stack_has_too_few_elements();
|
||||||
@ -6514,8 +6512,11 @@ static BcStatus bc_program_execStr(char *code, size_t *bgn,
|
|||||||
r = bc_vec_top(&G.prog.results);
|
r = bc_vec_top(&G.prog.results);
|
||||||
|
|
||||||
if (cond) {
|
if (cond) {
|
||||||
|
BcNum *n = n; // for compiler
|
||||||
char *name, *then_name = bc_program_name(code, bgn), *else_name = NULL;
|
bool exec;
|
||||||
|
char *name;
|
||||||
|
char *then_name = bc_program_name(code, bgn);
|
||||||
|
char *else_name = NULL;
|
||||||
|
|
||||||
if (code[*bgn] == BC_PARSE_STREND)
|
if (code[*bgn] == BC_PARSE_STREND)
|
||||||
(*bgn) += 1;
|
(*bgn) += 1;
|
||||||
@ -6523,10 +6524,8 @@ static BcStatus bc_program_execStr(char *code, size_t *bgn,
|
|||||||
else_name = bc_program_name(code, bgn);
|
else_name = bc_program_name(code, bgn);
|
||||||
|
|
||||||
exec = r->d.n.len != 0;
|
exec = r->d.n.len != 0;
|
||||||
|
|
||||||
if (exec)
|
|
||||||
name = then_name;
|
name = then_name;
|
||||||
else if (else_name != NULL) {
|
if (!exec && else_name != NULL) {
|
||||||
exec = true;
|
exec = true;
|
||||||
name = else_name;
|
name = else_name;
|
||||||
}
|
}
|
||||||
@ -6547,17 +6546,15 @@ static BcStatus bc_program_execStr(char *code, size_t *bgn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sidx = n->rdx;
|
sidx = n->rdx;
|
||||||
}
|
} else {
|
||||||
else {
|
if (r->t == BC_RESULT_STR) {
|
||||||
|
|
||||||
if (r->t == BC_RESULT_STR)
|
|
||||||
sidx = r->d.id.idx;
|
sidx = r->d.id.idx;
|
||||||
else if (r->t == BC_RESULT_VAR) {
|
} else if (r->t == BC_RESULT_VAR) {
|
||||||
|
BcNum *n;
|
||||||
s = bc_program_num(r, &n, false);
|
s = bc_program_num(r, &n, false);
|
||||||
if (s || !BC_PROG_STR(n)) goto exit;
|
if (s || !BC_PROG_STR(n)) goto exit;
|
||||||
sidx = n->rdx;
|
sidx = n->rdx;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user