Re: [patch] viewer lockup due to recent signed->unsigned change



Hi Jindrich,

On Thu, 2004-08-19 at 18:24, Jindrich Makovicka wrote:
> -	for (q = p = current - 1; p >= view->first; p--)
> +	for (q = p = current - 1;; p--) {

--- view.c.000	2004-08-17 22:57:08.000000000 +0200
+++ view.c	2004-08-20 01:41:23.000000000 +0200
@@ -1296,7 +1296,10 @@ move_backward2 (WView *view, offset_type
 	    line = 1;
 	else
 	    line = 0;
-	for (q = p = current - 1; p >= view->first; p--)
+	q = (p = current) - 1;
+	if (p > view->first)
+	do {
+	    p--;
 	    if (get_byte (view, p) == '\n' || p == view->first) {
 		pm = p > view->first ? p + 1 : view->first;
 		if (!view->wrap_mode) {
@@ -1315,6 +1318,7 @@ move_backward2 (WView *view, offset_type
 		    q = p + 1;
 		}
 	    }
+	} while (p > view->first);
     }
     return p > view->first ? p : view->first;
 }

Is the above patch functionally identical to what you try to achieve?
Your patch assumes the initial test if (p >[=] view->first) is no longer
necessary. In that case it can be removed from this patch.

The break you use assumes we don't want a decrement of p on exit, so I
didn't add it. Correct?

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]