summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2006-11-22 01:57:16 +0000
committerKenichi Handa <handa@m17n.org>2006-11-22 01:57:16 +0000
commiteef4e1514021db62fb1dfead50b6a85cbda8f2da (patch)
treed65bdadc6f8eb16106abe22d20b58961c2887238 /src/search.c
parentc64c7580fca10ece856b99d54059f36db703fb36 (diff)
downloademacs-eef4e1514021db62fb1dfead50b6a85cbda8f2da.tar.gz
(simple_search): Fix sync with HEAD.
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/search.c b/src/search.c
index 15a7d54852a..ce4d1828585 100644
--- a/src/search.c
+++ b/src/search.c
@@ -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)