diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-04-03 16:30:50 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-04-03 16:30:50 +0200 |
commit | e1a1b64f433661188d9e5591f2137860dab0c18a (patch) | |
tree | 5ca0440e41dba4a9e7655cd04ed8d8ab9059fb85 | |
parent | 3e61b59ef326cdb800736f502e0240b109271076 (diff) | |
download | busybox-w32-e1a1b64f433661188d9e5591f2137860dab0c18a.tar.gz busybox-w32-e1a1b64f433661188d9e5591f2137860dab0c18a.tar.bz2 busybox-w32-e1a1b64f433661188d9e5591f2137860dab0c18a.zip |
vi: code shrink
function old new delta
new_screen 84 75 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | editors/vi.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/editors/vi.c b/editors/vi.c index ce261feca..38177dec4 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -722,20 +722,25 @@ static void screen_erase(void) | |||
722 | memset(screen, ' ', screensize); // clear new screen | 722 | memset(screen, ' ', screensize); // clear new screen |
723 | } | 723 | } |
724 | 724 | ||
725 | static char *new_screen(int ro, int co) | 725 | static void new_screen(int ro, int co) |
726 | { | 726 | { |
727 | int li; | 727 | char *s; |
728 | 728 | ||
729 | free(screen); | 729 | free(screen); |
730 | screensize = ro * co + 8; | 730 | screensize = ro * co + 8; |
731 | screen = xmalloc(screensize); | 731 | s = screen = xmalloc(screensize); |
732 | // initialize the new screen. assume this will be a empty file. | 732 | // initialize the new screen. assume this will be a empty file. |
733 | screen_erase(); | 733 | screen_erase(); |
734 | // non-existent text[] lines start with a tilde (~). | 734 | // non-existent text[] lines start with a tilde (~). |
735 | for (li = 1; li < ro - 1; li++) { | 735 | //screen[(1 * co) + 0] = '~'; |
736 | screen[(li * co) + 0] = '~'; | 736 | //screen[(2 * co) + 0] = '~'; |
737 | //.. | ||
738 | //screen[((ro-2) * co) + 0] = '~'; | ||
739 | ro -= 2; | ||
740 | while (--ro >= 0) { | ||
741 | s += co; | ||
742 | *s = '~'; | ||
737 | } | 743 | } |
738 | return screen; | ||
739 | } | 744 | } |
740 | 745 | ||
741 | //----- Synchronize the cursor to Dot -------------------------- | 746 | //----- Synchronize the cursor to Dot -------------------------- |