summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-02-03 06:15:42 +0000
committerRichard M. Stallman <rms@gnu.org>1998-02-03 06:15:42 +0000
commitc7ef1245d7a732f7291d254052e5193183e4d12b (patch)
treeb8e92e396245684144b27d3f5fa2b9a46ed59925 /src
parentc33f2f82c5b25b6694a9abd62dba1b443d597060 (diff)
downloademacs-c7ef1245d7a732f7291d254052e5193183e4d12b.tar.gz
(search_buffer): New args pos_byte and lim_byte.
(search_command): Pass new args.
Diffstat (limited to 'src')
-rw-r--r--src/search.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/search.c b/src/search.c
index 5f5a3e60500..4404fdbe467 100644
--- a/src/search.c
+++ b/src/search.c
@@ -857,7 +857,7 @@ search_command (string, bound, noerror, count, direction, RE, posix)
int posix;
{
register int np;
- int lim;
+ int lim, lim_byte;
int n = direction;
if (!NILP (count))
@@ -868,20 +868,26 @@ search_command (string, bound, noerror, count, direction, RE, posix)
CHECK_STRING (string, 0);
if (NILP (bound))
- lim = n > 0 ? ZV : BEGV;
+ {
+ if (n > 0)
+ lim = ZV, lim_byte = ZV_BYTE;
+ else
+ lim = BEGV, lim_byte = BEGV_BYTE;
+ }
else
{
CHECK_NUMBER_COERCE_MARKER (bound, 1);
lim = XINT (bound);
+ lim_byte = CHAR_TO_BYTE (lim);
if (n > 0 ? lim < PT : lim > PT)
error ("Invalid search bound (wrong side of point)");
if (lim > ZV)
- lim = ZV;
+ lim = ZV, lim_byte = ZV_BYTE;
if (lim < BEGV)
- lim = BEGV;
+ lim = BEGV, lim_byte = BEGV_BYTE;
}
- np = search_buffer (string, PT, lim, n, RE,
+ np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE,
(!NILP (current_buffer->case_fold_search)
? XCHAR_TABLE (current_buffer->case_canon_table)->contents
: 0),
@@ -897,7 +903,7 @@ search_command (string, bound, noerror, count, direction, RE, posix)
{
if (lim < BEGV || lim > ZV)
abort ();
- SET_PT (lim);
+ SET_PT_BOTH (lim, lim_byte);
return Qnil;
#if 0 /* This would be clean, but maybe programs depend on
a value of nil here. */
@@ -965,10 +971,13 @@ trivial_regexp_p (regexp)
for this pattern. 0 means backtrack only enough to get a valid match. */
static int
-search_buffer (string, pos, lim, n, RE, trt, inverse_trt, posix)
+search_buffer (string, pos, pos_byte, lim, lim_byte, n,
+ RE, trt, inverse_trt, posix)
Lisp_Object string;
int pos;
+ int pos_byte;
int lim;
+ int lim_byte;
int n;
int RE;
Lisp_Object *trt;
@@ -1005,8 +1014,6 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt, posix)
if (RE && !trivial_regexp_p (string))
{
struct re_pattern_buffer *bufp;
- int pos_byte = CHAR_TO_BYTE (pos);
- int lim_byte = CHAR_TO_BYTE (lim);
bufp = compile_pattern (string, &search_regs, trt, posix,
!NILP (current_buffer->enable_multibyte_characters));
@@ -1105,8 +1112,6 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt, posix)
}
else /* non-RE case */
{
- int pos_byte = CHAR_TO_BYTE (pos);
- int lim_byte = CHAR_TO_BYTE (lim);
#ifdef C_ALLOCA
int BM_tab_space[0400];
BM_tab = &BM_tab_space[0];