diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-08 23:36:28 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-08 23:36:28 +0100 |
commit | ebc41c9d9439feda167e12b27e83f7941246d76c (patch) | |
tree | 6c6163a4e06949cf50721b90f4783d63418cf087 | |
parent | 5f1b90b91af1076e6ba63afa7e4d7a3dbf841ce2 (diff) | |
download | busybox-w32-ebc41c9d9439feda167e12b27e83f7941246d76c.tar.gz busybox-w32-ebc41c9d9439feda167e12b27e83f7941246d76c.tar.bz2 busybox-w32-ebc41c9d9439feda167e12b27e83f7941246d76c.zip |
bc: remove redundant error checks in bc_parse_print()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | miscutils/bc.c | 18 |
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) | |||
4097 | { | 4097 | { |
4098 | BcStatus s; | 4098 | BcStatus s; |
4099 | BcLexType type; | 4099 | BcLexType type; |
4100 | bool comma = false; | 4100 | bool comma; |
4101 | 4101 | ||
4102 | s = bc_lex_next(&p->l); | 4102 | s = bc_lex_next(&p->l); |
4103 | if (s) return s; | 4103 | if (s) return s; |
@@ -4107,24 +4107,26 @@ static BcStatus bc_parse_print(BcParse *p) | |||
4107 | if (type == BC_LEX_SCOLON || type == BC_LEX_NLINE) | 4107 | if (type == BC_LEX_SCOLON || type == BC_LEX_NLINE) |
4108 | return bc_error("bad print statement"); | 4108 | return bc_error("bad print statement"); |
4109 | 4109 | ||
4110 | while (!s && type != BC_LEX_SCOLON && type != BC_LEX_NLINE) { | 4110 | comma = false; |
4111 | while (type != BC_LEX_SCOLON && type != BC_LEX_NLINE) { | ||
4111 | 4112 | ||
4112 | if (type == BC_LEX_STR) | 4113 | if (type == BC_LEX_STR) { |
4113 | s = bc_parse_string(p, BC_INST_PRINT_POP); | 4114 | s = bc_parse_string(p, BC_INST_PRINT_POP); |
4114 | else { | 4115 | if (s) return s; |
4116 | } else { | ||
4115 | s = bc_parse_expr(p, 0, bc_parse_next_print); | 4117 | s = bc_parse_expr(p, 0, bc_parse_next_print); |
4116 | if (s) return s; | 4118 | if (s) return s; |
4117 | bc_parse_push(p, BC_INST_PRINT_POP); | 4119 | bc_parse_push(p, BC_INST_PRINT_POP); |
4118 | } | 4120 | } |
4119 | 4121 | ||
4120 | if (s) return s; | ||
4121 | |||
4122 | comma = p->l.t.t == BC_LEX_COMMA; | 4122 | comma = p->l.t.t == BC_LEX_COMMA; |
4123 | if (comma) s = bc_lex_next(&p->l); | 4123 | if (comma) { |
4124 | s = bc_lex_next(&p->l); | ||
4125 | if (s) return s; | ||
4126 | } | ||
4124 | type = p->l.t.t; | 4127 | type = p->l.t.t; |
4125 | } | 4128 | } |
4126 | 4129 | ||
4127 | if (s) return s; | ||
4128 | if (comma) return bc_error_bad_token(); | 4130 | if (comma) return bc_error_bad_token(); |
4129 | 4131 | ||
4130 | return bc_lex_next(&p->l); | 4132 | return bc_lex_next(&p->l); |