]> git.eshelyaron.com Git - emacs.git/commitdiff
(simple_search): Fix sync with HEAD.
authorKenichi Handa <handa@m17n.org>
Wed, 22 Nov 2006 01:57:16 +0000 (01:57 +0000)
committerKenichi Handa <handa@m17n.org>
Wed, 22 Nov 2006 01:57:16 +0000 (01:57 +0000)
src/search.c

index 15a7d54852ab01210754bb2e6ab5fa8345013529..ce4d18285855002c0615058ee332b222e70d8f2f 100644 (file)
@@ -1397,7 +1397,7 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
            int this_len = len;
            int this_len_byte = len_byte;
            unsigned char *p = pat;
-           if (pos + len > lim)
+           if (pos + len > lim || pos_byte + len_byte > lim_byte)
              goto stop;
 
            while (this_len > 0)
@@ -1481,14 +1481,13 @@ 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;
+           int this_pos_byte = CHAR_TO_BYTE (this_pos);
            int this_len = len;
            int this_len_byte = len_byte;
            unsigned char *p = pat;
 
-           if (pos - len < lim)
+           if (this_pos < lim || this_pos_byte < lim_byte)
              goto stop;
-           this_pos_byte = CHAR_TO_BYTE (this_pos);
            match_byte = pos_byte - this_pos_byte;
 
            while (this_len > 0)
@@ -1534,7 +1533,7 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
            int this_len = len;
            unsigned char *p = pat;
 
-           if (this_pos < lim || this_pos_byte < lim_byte)
+           if (this_pos < lim)
              goto stop;
 
            while (this_len > 0)