mcedit (allmost)dead-loop and memory leak

Pavel Roskin proski at gnu.org
Wed Jun 25 00:21:09 UTC 2003


On Mon, 23 Jun 2003, GoTaR wrote:

> http://student.uci.agh.edu.pl/~gotar/license.h
>
> choose replace (f4) or search (f7), type $ as search string and mark it
> as regular expression, press enter. Voila.
>
> Source of problem is in "..." lines.
>
> PS. I'm not subscriber of this list.

This patch helps:

=============================
--- edit/editcmd.c
+++ edit/editcmd.c
@@ -1486,12 +1486,6 @@ edit_find_string (long start, unsigned c
 		    }
 		    else if (found_start == -1)	/* not found: try next line */
 			break;
-		    else if (*len == 0) { /* null pattern: try again at next character */
-			q--;
-			buf++;
-			match_bol = 0;
-			continue;
-		    }
 		    else	/* found */
 			return (start + offset - q + found_start);
 		}
=============================

Now "$" matches the beginning of line.  Not quite correct (it should be
end of line), but still better than the current behavior.

Can anybody with good understanding of the editor and the regular
expressions comment on this?

The code in question is prehistoric, i.e. it appears in the first revision
on CVS.

-- 
Regards,
Pavel Roskin



More information about the mc-devel mailing list