bc: further zbc_vm_stdin() optimizations
function old new delta bc_vm_run 534 514 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
40534bb6e2
commit
7dc0a51286
@ -7072,11 +7072,9 @@ static BC_STATUS zbc_vm_stdin(void)
|
|||||||
else if (buf.v[0] == G.sbgn)
|
else if (buf.v[0] == G.sbgn)
|
||||||
str += 1;
|
str += 1;
|
||||||
} else {
|
} else {
|
||||||
size_t i;
|
while (*string) {
|
||||||
for (i = 0; i < len; ++i) {
|
char c = *string;
|
||||||
char c = string[i];
|
if (string != buf.v && string[-1] != '\\') {
|
||||||
|
|
||||||
if (i - 1 > len || string[i - 1] != '\\') {
|
|
||||||
// checking applet type is cheaper than accessing sbgn/send
|
// checking applet type is cheaper than accessing sbgn/send
|
||||||
if (IS_DC) // dc: sbgn = send = '"'
|
if (IS_DC) // dc: sbgn = send = '"'
|
||||||
str ^= (c == '"');
|
str ^= (c == '"');
|
||||||
@ -7087,16 +7085,15 @@ static BC_STATUS zbc_vm_stdin(void)
|
|||||||
str += 1;
|
str += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
string++;
|
||||||
if (c == '/' && !comment && string[i + 1] == '*') {
|
if (c == '/' && *string == '*') {
|
||||||
comment = true;
|
comment = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (c == '*' && comment && string[i + 1] == '/')
|
if (c == '*' && *string == '/')
|
||||||
comment = false;
|
comment = false;
|
||||||
}
|
}
|
||||||
|
if (str || comment || string[-2] == '\\') {
|
||||||
if (str || comment || string[len - 2] == '\\') {
|
|
||||||
bc_vec_concat(&buffer, buf.v);
|
bc_vec_concat(&buffer, buf.v);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user