diff options
-rw-r--r-- | miscutils/bc.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 7ab320a4d..9c7e69fc1 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -7072,11 +7072,9 @@ static BC_STATUS zbc_vm_stdin(void) | |||
7072 | else if (buf.v[0] == G.sbgn) | 7072 | else if (buf.v[0] == G.sbgn) |
7073 | str += 1; | 7073 | str += 1; |
7074 | } else { | 7074 | } else { |
7075 | size_t i; | 7075 | while (*string) { |
7076 | for (i = 0; i < len; ++i) { | 7076 | char c = *string; |
7077 | char c = string[i]; | 7077 | if (string != buf.v && string[-1] != '\\') { |
7078 | |||
7079 | if (i - 1 > len || string[i - 1] != '\\') { | ||
7080 | // checking applet type is cheaper than accessing sbgn/send | 7078 | // checking applet type is cheaper than accessing sbgn/send |
7081 | if (IS_DC) // dc: sbgn = send = '"' | 7079 | if (IS_DC) // dc: sbgn = send = '"' |
7082 | str ^= (c == '"'); | 7080 | str ^= (c == '"'); |
@@ -7087,16 +7085,15 @@ static BC_STATUS zbc_vm_stdin(void) | |||
7087 | str += 1; | 7085 | str += 1; |
7088 | } | 7086 | } |
7089 | } | 7087 | } |
7090 | 7088 | string++; | |
7091 | if (c == '/' && !comment && string[i + 1] == '*') { | 7089 | if (c == '/' && *string == '*') { |
7092 | comment = true; | 7090 | comment = true; |
7093 | break; | 7091 | break; |
7094 | } | 7092 | } |
7095 | else if (c == '*' && comment && string[i + 1] == '/') | 7093 | if (c == '*' && *string == '/') |
7096 | comment = false; | 7094 | comment = false; |
7097 | } | 7095 | } |
7098 | 7096 | if (str || comment || string[-2] == '\\') { | |
7099 | if (str || comment || string[len - 2] == '\\') { | ||
7100 | bc_vec_concat(&buffer, buf.v); | 7097 | bc_vec_concat(&buffer, buf.v); |
7101 | continue; | 7098 | continue; |
7102 | } | 7099 | } |