diff options
author | Ron Yorston <rmy@pobox.com> | 2021-03-28 13:23:51 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-03-29 12:16:21 +0200 |
commit | a25b4c2c4245083411011e5054ba859d7c6b8dd6 (patch) | |
tree | 63b44eb29af921279b99ddace1f3d7d5a14c1085 /editors/vi.c | |
parent | d56da680577ae5ad43833040a310706e8331c684 (diff) | |
download | busybox-w32-a25b4c2c4245083411011e5054ba859d7c6b8dd6.tar.gz busybox-w32-a25b4c2c4245083411011e5054ba859d7c6b8dd6.tar.bz2 busybox-w32-a25b4c2c4245083411011e5054ba859d7c6b8dd6.zip |
vi: code shrink
- In the '+' and '-' commands the call to dot_skip_over_ws() is
only needed for the final line processed so it can be moved out
of the while loop.
- Marking sync_cursor() NOINLINE doesn't seem to offer the same
advantages it did in 2009 (commit adf922ec2).
function old new delta
refresh 694 974 +280
do_cmd 4900 4887 -13
sync_cursor 336 - -336
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 280/-349) Total: -69 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors/vi.c')
-rw-r--r-- | editors/vi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/editors/vi.c b/editors/vi.c index 323ca4427..4fa67a110 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -757,7 +757,7 @@ static void new_screen(int ro, int co) | |||
757 | } | 757 | } |
758 | 758 | ||
759 | //----- Synchronize the cursor to Dot -------------------------- | 759 | //----- Synchronize the cursor to Dot -------------------------- |
760 | static NOINLINE void sync_cursor(char *d, int *row, int *col) | 760 | static void sync_cursor(char *d, int *row, int *col) |
761 | { | 761 | { |
762 | char *beg_cur; // begin and end of "d" line | 762 | char *beg_cur; // begin and end of "d" line |
763 | char *tp; | 763 | char *tp; |
@@ -3302,8 +3302,8 @@ static void do_cmd(int c) | |||
3302 | case '+': // +- goto next line | 3302 | case '+': // +- goto next line |
3303 | do { | 3303 | do { |
3304 | dot_next(); | 3304 | dot_next(); |
3305 | dot_skip_over_ws(); | ||
3306 | } while (--cmdcnt > 0); | 3305 | } while (--cmdcnt > 0); |
3306 | dot_skip_over_ws(); | ||
3307 | break; | 3307 | break; |
3308 | case 21: // ctrl-U scroll up half screen | 3308 | case 21: // ctrl-U scroll up half screen |
3309 | dot_scroll((rows - 2) / 2, -1); | 3309 | dot_scroll((rows - 2) / 2, -1); |
@@ -3451,8 +3451,8 @@ static void do_cmd(int c) | |||
3451 | case '-': // -- goto prev line | 3451 | case '-': // -- goto prev line |
3452 | do { | 3452 | do { |
3453 | dot_prev(); | 3453 | dot_prev(); |
3454 | dot_skip_over_ws(); | ||
3455 | } while (--cmdcnt > 0); | 3454 | } while (--cmdcnt > 0); |
3455 | dot_skip_over_ws(); | ||
3456 | break; | 3456 | break; |
3457 | #if ENABLE_FEATURE_VI_DOT_CMD | 3457 | #if ENABLE_FEATURE_VI_DOT_CMD |
3458 | case '.': // .- repeat the last modifying command | 3458 | case '.': // .- repeat the last modifying command |