summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2006-11-30 00:41:33 +0000
committerKenichi Handa <handa@m17n.org>2006-11-30 00:41:33 +0000
commit3dcf00668c2ed1ca2d9591f7d6ac827400273c3f (patch)
tree20abe3c98decefeaf59ade432a2ccdd469e317f6 /src/search.c
parent7faa8095342cd1b16f6d95d20cd27136789b755e (diff)
downloademacs-3dcf00668c2ed1ca2d9591f7d6ac827400273c3f.tar.gz
(simple_search): Fix previous change.
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/search.c b/src/search.c
index ce4d1828585..9aa49af665f 100644
--- a/src/search.c
+++ b/src/search.c
@@ -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)