changeset 21760:f97c01dfd603

(re_search_2): Fix handling of at_dot. Fix the way RANGE is set when handling begbuf.
author Richard M. Stallman <rms@gnu.org>
date Sat, 25 Apr 1998 03:37:36 +0000
parents 53f1e474e639
children 7c159e118cd4
files src/regex.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/regex.c	Fri Apr 24 21:25:31 1998 +0000
+++ b/src/regex.c	Sat Apr 25 03:37:36 1998 +0000
@@ -3710,13 +3710,13 @@
     range = total_size - startpos;
 
   /* If the search isn't to be a backwards one, don't waste time in a
-     search for a pattern that must be anchored.  */
+     search for a pattern anchored at beginning of buffer.  */
   if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0)
     {
       if (startpos > 0)
 	return -1;
       else
-	range = 1;
+	range = 0;
     }
 
 #ifdef emacs
@@ -3724,8 +3724,8 @@
      don't keep searching past point.  */
   if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0)
     {
-      range = PT - startpos;
-      if (range <= 0)
+      range = PT_BYTE - BEGV_BYTE - startpos;
+      if (range < 0)
 	return -1;
     }
 #endif /* emacs */