Subject: bug#4209: 23.1; Emacs 23.1 regression in re-search-forward

From: Matthew Dempsky <[email-masked]>
Date: Tue, 1 Dec 2009 16:21:07 -0800

This is a stab in the dark, but the patch below corrects this issue for me:

    $ ./retest.sh
    looking-at: t
    re-search-forward: 9

I don't see any reason this should cause regressions (searching
forward 0 steps seems to me it should be the same as searching
backward 0 steps), but I've only casually looked over regex.c.

--- a/src/regex.c
+++ b/src/regex.c
@@ -4524,7 +4524,7 @@ re_search_2 (bufp, str1, size1, str2, size2,
startpos, range, regs, stop)

          d = POS_ADDR_VSTRING (startpos);

-         if (range > 0)        /* Searching forwards.  */
+         if (range >= 0)       /* Searching forwards.  */
            {
              register int lim = 0;
              int irange = range;