From 7b54dc788c1bafcc0452790403758f84f0852854 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 17 Jul 2008 21:32:32 +0000 Subject: vi: using array data after it fell out of scope is stupid. --- editors/vi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'editors/vi.c') diff --git a/editors/vi.c b/editors/vi.c index 1f1d3ca39..27f2a3abd 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -2492,6 +2492,14 @@ static int file_write(char *fn, char *first, char *last) static void place_cursor(int row, int col, int optimize) { char cm1[sizeof(CMrc) + sizeof(int)*3 * 2]; +#if ENABLE_FEATURE_VI_OPTIMIZE_CURSOR + enum { + SZ_UP = sizeof(CMup), + SZ_DN = sizeof(CMdown), + SEQ_SIZE = SZ_UP > SZ_DN ? SZ_UP : SZ_DN, + }; + char cm2[SEQ_SIZE * 5 + 32]; // bigger than worst case size +#endif char *cm; if (row < 0) row = 0; @@ -2505,12 +2513,6 @@ static void place_cursor(int row, int col, int optimize) #if ENABLE_FEATURE_VI_OPTIMIZE_CURSOR if (optimize && col < 16) { - enum { - SZ_UP = sizeof(CMup), - SZ_DN = sizeof(CMdown), - SEQ_SIZE = SZ_UP > SZ_DN ? SZ_UP : SZ_DN, - }; - char cm2[SEQ_SIZE * 5 + 32]; // bigger than worst case size char *screenp; int Rrow = last_row; int diff = Rrow - row; -- cgit v1.2.3