hush: make getch/peek functions directly called
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 8 Nov 2016 21:35:05 +0000 (22:35 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 8 Nov 2016 21:35:05 +0000 (22:35 +0100)
commit87e039d0160be16a9a242f74af2e90cdb9f97e12
tree6d426cbcb065ba5dc1a7e10717d67a1e74987d88
parent00a06b971531031103c25d650e2078c801afbe39
hush: make getch/peek functions directly called

Indirect calls are more difficult to predict.
Unfortunately, on x64 direct call is 5 bytes while indirect "call (reg+ofs)"
is 3 bytes:

function                                             old     new   delta
i_getch                                                -      82     +82
i_peek                                                 -      63     +63
parse_stream                                        2531    2579     +48
parse_dollar                                         771     797     +26
parse_redirect                                       296     321     +25
add_till_closing_bracket                             408     420     +12
encode_string                                        256     265      +9
i_peek_and_eat_bkslash_nl                             93      99      +6
add_till_backquote                                   110     114      +4
parse_and_run_stream                                 139     141      +2
expand_vars_to_list                                 1143    1144      +1
static_peek                                            6       -      -6
setup_string_in_str                                   39      18     -21
setup_file_in_str                                     40      19     -21
static_get                                            27       -     -27
file_peek                                             52       -     -52
file_get                                              65       -     -65
------------------------------------------------------------------------------
(add/remove: 2/4 grow/shrink: 9/2 up/down: 278/-192)           Total: 86 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/hush.c