diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-17 16:37:22 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-17 16:37:22 +0000 |
commit | cd5c7866e328b502d946485ad1886ce26cffabfa (patch) | |
tree | b0d636908765bba8b8d9bd26d0dd289299d17311 /editors/vi.c | |
parent | c8be5ee325a374525f503d11eccb5da3ee35a509 (diff) | |
download | busybox-w32-cd5c7866e328b502d946485ad1886ce26cffabfa.tar.gz busybox-w32-cd5c7866e328b502d946485ad1886ce26cffabfa.tar.bz2 busybox-w32-cd5c7866e328b502d946485ad1886ce26cffabfa.zip |
vi: remove two globals
awk: some 'lineno' vars were shorts, made them ints (code got smaller)
awk: rename global t to global ttt. still an awful name, but at least
you can grep for it now.
function old new delta
ttt - 28 +28
mysleep 104 120 +16
readit 408 418 +10
lineno 2 4 +2
parse_program 338 339 +1
evaluate 6446 6445 -1
syntax_error 25 23 -2
next_token 917 915 -2
new_node 26 24 -2
tv 16 8 -8
skip_spaces 68 53 -15
t 28 - -28
rfds 128 - -128
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 4/6 up/down: 57/-186) Total: -129 bytes
Diffstat (limited to 'editors/vi.c')
-rw-r--r-- | editors/vi.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/editors/vi.c b/editors/vi.c index a103776d2..66b01e26b 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -111,8 +111,6 @@ static int last_file_modified = -1; | |||
111 | static int fn_start; // index of first cmd line file name | 111 | static int fn_start; // index of first cmd line file name |
112 | static int save_argc; // how many file names on cmd line | 112 | static int save_argc; // how many file names on cmd line |
113 | static int cmdcnt; // repetition count | 113 | static int cmdcnt; // repetition count |
114 | static fd_set rfds; // use select() for small sleeps | ||
115 | static struct timeval tv; // use select() for small sleeps | ||
116 | static int rows, columns; // the terminal screen is this size | 114 | static int rows, columns; // the terminal screen is this size |
117 | static int crow, ccol, offset; // cursor is on Crow x Ccol with Horz Ofset | 115 | static int crow, ccol, offset; // cursor is on Crow x Ccol with Horz Ofset |
118 | static char *status_buffer; // mesages to the user | 116 | static char *status_buffer; // mesages to the user |
@@ -279,7 +277,7 @@ int vi_main(int argc, char **argv) | |||
279 | #if ENABLE_FEATURE_VI_YANKMARK | 277 | #if ENABLE_FEATURE_VI_YANKMARK |
280 | int i; | 278 | int i; |
281 | #endif | 279 | #endif |
282 | #if defined(CONFIG_FEATURE_VI_USE_SIGNALS) || defined(CONFIG_FEATURE_VI_CRASHME) | 280 | #if ENABLE_FEATURE_VI_USE_SIGNALS || ENABLE_FEATURE_VI_CRASHME |
283 | my_pid = getpid(); | 281 | my_pid = getpid(); |
284 | #endif | 282 | #endif |
285 | #if ENABLE_FEATURE_VI_CRASHME | 283 | #if ENABLE_FEATURE_VI_CRASHME |
@@ -2142,6 +2140,9 @@ static void catch_sig(int sig) | |||
2142 | 2140 | ||
2143 | static int mysleep(int hund) // sleep for 'h' 1/100 seconds | 2141 | static int mysleep(int hund) // sleep for 'h' 1/100 seconds |
2144 | { | 2142 | { |
2143 | fd_set rfds; | ||
2144 | struct timeval tv; | ||
2145 | |||
2145 | // Don't hang- Wait 5/100 seconds- 1 Sec= 1000000 | 2146 | // Don't hang- Wait 5/100 seconds- 1 Sec= 1000000 |
2146 | fflush(stdout); | 2147 | fflush(stdout); |
2147 | FD_ZERO(&rfds); | 2148 | FD_ZERO(&rfds); |
@@ -2228,6 +2229,9 @@ static char readit(void) // read (maybe cursor) key from stdin | |||
2228 | if (n <= 0) | 2229 | if (n <= 0) |
2229 | return 0; // error | 2230 | return 0; // error |
2230 | if (readbuffer[0] == 27) { | 2231 | if (readbuffer[0] == 27) { |
2232 | fd_set rfds; | ||
2233 | struct timeval tv; | ||
2234 | |||
2231 | // This is an ESC char. Is this Esc sequence? | 2235 | // This is an ESC char. Is this Esc sequence? |
2232 | // Could be bare Esc key. See if there are any | 2236 | // Could be bare Esc key. See if there are any |
2233 | // more chars to read after the ESC. This would | 2237 | // more chars to read after the ESC. This would |