aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-12-08 23:36:28 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-12-08 23:36:28 +0100
commitebc41c9d9439feda167e12b27e83f7941246d76c (patch)
tree6c6163a4e06949cf50721b90f4783d63418cf087 /miscutils
parent5f1b90b91af1076e6ba63afa7e4d7a3dbf841ce2 (diff)
downloadbusybox-ebc41c9d9439feda167e12b27e83f7941246d76c.tar.gz
bc: remove redundant error checks in bc_parse_print()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/bc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 4fb6e77ab..aeb06a97b 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -4097,7 +4097,7 @@ static BcStatus bc_parse_print(BcParse *p)
{
BcStatus s;
BcLexType type;
- bool comma = false;
+ bool comma;
s = bc_lex_next(&p->l);
if (s) return s;
@@ -4107,24 +4107,26 @@ static BcStatus bc_parse_print(BcParse *p)
if (type == BC_LEX_SCOLON || type == BC_LEX_NLINE)
return bc_error("bad print statement");
- while (!s && type != BC_LEX_SCOLON && type != BC_LEX_NLINE) {
+ comma = false;
+ while (type != BC_LEX_SCOLON && type != BC_LEX_NLINE) {
- if (type == BC_LEX_STR)
+ if (type == BC_LEX_STR) {
s = bc_parse_string(p, BC_INST_PRINT_POP);
- else {
+ if (s) return s;
+ } else {
s = bc_parse_expr(p, 0, bc_parse_next_print);
if (s) return s;
bc_parse_push(p, BC_INST_PRINT_POP);
}
- if (s) return s;
-
comma = p->l.t.t == BC_LEX_COMMA;
- if (comma) s = bc_lex_next(&p->l);
+ if (comma) {
+ s = bc_lex_next(&p->l);
+ if (s) return s;
+ }
type = p->l.t.t;
}
- if (s) return s;
if (comma) return bc_error_bad_token();
return bc_lex_next(&p->l);