diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-03-29 14:40:01 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-03-29 14:40:01 +0100 |
commit | eabf4b2b5786c1d196cb36711d5a4fb38e980940 (patch) | |
tree | 6665f79ca91c276cd40f333fb389cc765a4b51e1 | |
parent | e6f51ac6975963e538a28fe2060dd4511143449b (diff) | |
download | busybox-w32-eabf4b2b5786c1d196cb36711d5a4fb38e980940.tar.gz busybox-w32-eabf4b2b5786c1d196cb36711d5a4fb38e980940.tar.bz2 busybox-w32-eabf4b2b5786c1d196cb36711d5a4fb38e980940.zip |
vi: code shrink, proper printf formatting for strlen()
function old new delta
yank_delete 98 99 +1
what_reg 34 33 -1
text_yank 56 54 -2
end_cmd_q 17 14 -3
do_cmd 4718 4705 -13
colon 2875 2861 -14
edit_file 668 648 -20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/6 up/down: 1/-53) Total: -52 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | editors/vi.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/editors/vi.c b/editors/vi.c index 065a1068e..5e5e13111 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -345,7 +345,8 @@ struct globals { | |||
345 | 345 | ||
346 | /* a few references only */ | 346 | /* a few references only */ |
347 | #if ENABLE_FEATURE_VI_YANKMARK | 347 | #if ENABLE_FEATURE_VI_YANKMARK |
348 | int YDreg, Ureg; // default delete register and orig line for "U" | 348 | smalluint YDreg;//,Ureg;// default delete register and orig line for "U" |
349 | #define Ureg 27 | ||
349 | char *reg[28]; // named register a-z, "D", and "U" 0-25,26,27 | 350 | char *reg[28]; // named register a-z, "D", and "U" 0-25,26,27 |
350 | char *mark[28]; // user marks points somewhere in text[]- a-z and previous context '' | 351 | char *mark[28]; // user marks points somewhere in text[]- a-z and previous context '' |
351 | char *context_start, *context_end; | 352 | char *context_start, *context_end; |
@@ -455,7 +456,7 @@ struct globals { | |||
455 | #define format_edit_status__tot (G.format_edit_status__tot) | 456 | #define format_edit_status__tot (G.format_edit_status__tot) |
456 | 457 | ||
457 | #define YDreg (G.YDreg ) | 458 | #define YDreg (G.YDreg ) |
458 | #define Ureg (G.Ureg ) | 459 | //#define Ureg (G.Ureg ) |
459 | #define mark (G.mark ) | 460 | #define mark (G.mark ) |
460 | #define context_start (G.context_start ) | 461 | #define context_start (G.context_start ) |
461 | #define context_end (G.context_end ) | 462 | #define context_end (G.context_end ) |
@@ -794,7 +795,7 @@ static void edit_file(char *fn) | |||
794 | 795 | ||
795 | #if ENABLE_FEATURE_VI_YANKMARK | 796 | #if ENABLE_FEATURE_VI_YANKMARK |
796 | YDreg = 26; // default Yank/Delete reg | 797 | YDreg = 26; // default Yank/Delete reg |
797 | Ureg = 27; // hold orig line for "U" cmd | 798 | // Ureg = 27; - const // hold orig line for "U" cmd |
798 | mark[26] = mark[27] = text; // init "previous context" | 799 | mark[26] = mark[27] = text; // init "previous context" |
799 | #endif | 800 | #endif |
800 | 801 | ||
@@ -4174,8 +4175,8 @@ static void do_cmd(int c) | |||
4174 | if (*p == '\n') | 4175 | if (*p == '\n') |
4175 | cnt++; | 4176 | cnt++; |
4176 | } | 4177 | } |
4177 | status_line("%s %d lines (%d chars) using [%c]", | 4178 | status_line("%s %u lines (%u chars) using [%c]", |
4178 | buf, cnt, strlen(reg[YDreg]), what_reg()); | 4179 | buf, cnt, (unsigned)strlen(reg[YDreg]), what_reg()); |
4179 | #endif | 4180 | #endif |
4180 | end_cmd_q(); // stop adding to q | 4181 | end_cmd_q(); // stop adding to q |
4181 | } | 4182 | } |