int posix;
{
register int np;
- int lim;
+ int lim, lim_byte;
int n = direction;
if (!NILP (count))
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),
{
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. */
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;
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));
}
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];