]> git.eshelyaron.com Git - emacs.git/commitdiff
(simple_search): Fix previous change.
authorKenichi Handa <handa@m17n.org>
Thu, 30 Nov 2006 00:41:33 +0000 (00:41 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 30 Nov 2006 00:41:33 +0000 (00:41 +0000)
src/search.c

index ce4d18285855002c0615058ee332b222e70d8f2f..9aa49af665fb6491ba5e0842b6915f25306a1c40 100644 (file)
@@ -1481,13 +1481,14 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
          {
            /* Try matching at position POS.  */
            int this_pos = pos - len;
-           int this_pos_byte = CHAR_TO_BYTE (this_pos);
+           int this_pos_byte;
            int this_len = len;
            int this_len_byte = len_byte;
            unsigned char *p = pat;
 
-           if (this_pos < lim || this_pos_byte < lim_byte)
+           if (this_pos < lim || (pos_byte - len_byte) < lim_byte)
              goto stop;
+           this_pos_byte = CHAR_TO_BYTE (this_pos);
            match_byte = pos_byte - this_pos_byte;
 
            while (this_len > 0)