From cd5c7866e328b502d946485ad1886ce26cffabfa Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 17 May 2007 16:37:22 +0000 Subject: 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 --- editors/vi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'editors/vi.c') 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; static int fn_start; // index of first cmd line file name static int save_argc; // how many file names on cmd line static int cmdcnt; // repetition count -static fd_set rfds; // use select() for small sleeps -static struct timeval tv; // use select() for small sleeps static int rows, columns; // the terminal screen is this size static int crow, ccol, offset; // cursor is on Crow x Ccol with Horz Ofset static char *status_buffer; // mesages to the user @@ -279,7 +277,7 @@ int vi_main(int argc, char **argv) #if ENABLE_FEATURE_VI_YANKMARK int i; #endif -#if defined(CONFIG_FEATURE_VI_USE_SIGNALS) || defined(CONFIG_FEATURE_VI_CRASHME) +#if ENABLE_FEATURE_VI_USE_SIGNALS || ENABLE_FEATURE_VI_CRASHME my_pid = getpid(); #endif #if ENABLE_FEATURE_VI_CRASHME @@ -2142,6 +2140,9 @@ static void catch_sig(int sig) static int mysleep(int hund) // sleep for 'h' 1/100 seconds { + fd_set rfds; + struct timeval tv; + // Don't hang- Wait 5/100 seconds- 1 Sec= 1000000 fflush(stdout); FD_ZERO(&rfds); @@ -2228,6 +2229,9 @@ static char readit(void) // read (maybe cursor) key from stdin if (n <= 0) return 0; // error if (readbuffer[0] == 27) { + fd_set rfds; + struct timeval tv; + // This is an ESC char. Is this Esc sequence? // Could be bare Esc key. See if there are any // more chars to read after the ESC. This would -- cgit v1.2.3