svn commit: trunk/busybox/editors

vda at busybox.net vda at busybox.net
Thu Jul 17 21:32:34 UTC 2008


Author: vda
Date: 2008-07-17 14:32:32 -0700 (Thu, 17 Jul 2008)
New Revision: 22875

Log:
vi: using array data after it fell out of scope is stupid.



Modified:
   trunk/busybox/editors/vi.c


Changeset:
Modified: trunk/busybox/editors/vi.c
===================================================================
--- trunk/busybox/editors/vi.c	2008-07-17 20:01:44 UTC (rev 22874)
+++ trunk/busybox/editors/vi.c	2008-07-17 21:32:32 UTC (rev 22875)
@@ -2492,6 +2492,14 @@
 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 @@
 
 #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;




More information about the busybox-cvs mailing list