hush: rework input char buffering to allow more than one-deep peek
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 29 Sep 2016 14:59:06 +0000 (16:59 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 29 Sep 2016 14:59:06 +0000 (16:59 +0200)
commit8286513838beaf9ccaab15bb5905248c3b7b8a69
treeb7d72f0867668509260ea6b074c416702fb6fa2b
parent3b4d04b77eb5cfdb8ac6a799a3f3ccf1e455d0e7
hush: rework input char buffering to allow more than one-deep peek

This fixes backslash+newline continuation in
$VAR\
NAME
construct. (ash has a bug there as well).

function                                             old     new   delta
file_peek2                                             -      74     +74
parse_dollar                                         746     773     +27
expand_vars_to_list                                 1143    1167     +24
setup_string_in_str                                   32      46     +14
setup_file_in_str                                     33      47     +14
file_get                                             264     278     +14
static_peek2                                           -       7      +7
file_peek                                             91      72     -19
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 5/1 up/down: 174/-19)           Total: 155 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash_test/ash-vars/var_serial.right [new file with mode: 0644]
shell/ash_test/ash-vars/var_serial.tests [new file with mode: 0755]
shell/ash_test/ash-vars/var_subst_in_for.right [new file with mode: 0644]
shell/ash_test/ash-vars/var_subst_in_for.tests [new file with mode: 0755]
shell/ash_test/ash-vars/var_unbackslash.right [new file with mode: 0644]
shell/ash_test/ash-vars/var_unbackslash.tests [new file with mode: 0755]
shell/ash_test/ash-vars/var_unbackslash1.right [new file with mode: 0644]
shell/ash_test/ash-vars/var_unbackslash1.tests [new file with mode: 0755]
shell/hush_test/hush-vars/var_unbackslash1.right [new file with mode: 0644]
shell/hush_test/hush-vars/var_unbackslash1.tests [new file with mode: 0755]