diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-02 20:16:52 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-05 15:43:35 +0100 |
commit | a0c421c118abde7636d4d2b9bee93ca78e656d30 (patch) | |
tree | b78e216f281b49f20d574da91ed01b0390b9ff43 | |
parent | 71e1fc6b376e1fde2c3b0dbcf94c4261eed9c6c5 (diff) | |
download | busybox-a0c421c118abde7636d4d2b9bee93ca78e656d30.tar.gz |
bc: simplify bc_vm_stdin()
function old new delta
bc_vm_run 2020 2006 -14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | miscutils/bc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 63b745dc7..78c64355b 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c @@ -7005,11 +7005,10 @@ err: static BcStatus bc_vm_stdin(void) { - BcStatus s = BC_STATUS_SUCCESS; + BcStatus s; BcVec buf, buffer; - char c; size_t len, i, str = 0; - bool comment = false, notend; + bool comment = false; G.prog.file = bc_program_stdin_name; bc_lex_file(&G.prs.l, bc_program_stdin_name); @@ -7022,7 +7021,7 @@ static BcStatus bc_vm_stdin(void) // with a backslash to the parser. The reason for that is because the parser // treats a backslash+newline combo as whitespace, per the bc spec. In that // case, and for strings and comments, the parser will expect more stuff. - for (s = bc_read_line(&buf, ">>> "); !s; s = bc_read_line(&buf, ">>> ")) { + while ((s = bc_read_line(&buf, ">>> ")) == BC_STATUS_SUCCESS) { char *string = buf.v; @@ -7038,8 +7037,8 @@ static BcStatus bc_vm_stdin(void) for (i = 0; i < len; ++i) { - notend = len > i + 1; - c = string[i]; + bool notend = len > i + 1; + char c = string[i]; if (i - 1 > len || string[i - 1] != '\\') { if (G.sbgn == G.send) |