APPROVE COMMIT 21.5
Vin: a separate, untested, patch follows for 21.4.
Julian's analysis is correct, and with his patch the test I added last
week passes. Julian's analysis follows the patch.
diff -r 38493c0fb952 src/ChangeLog
--- a/src/ChangeLog Sun Nov 02 00:12:13 2008 +0900
+++ b/src/ChangeLog Sun Nov 02 00:16:48 2008 +0900
@@ -0,0 +1,5 @@
+2008-11-01 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * regex.c (re_search_2): Fix at_dot by changing charpos to bytepos.
+ From Julian Bradfield <18654.1143.304851.782755(a)krk.inf.ed.ac.uk>.
+
diff -r 38493c0fb952 src/regex.c
--- a/src/regex.c Sun Nov 02 00:12:13 2008 +0900
+++ b/src/regex.c Sun Nov 02 00:16:48 2008 +0900
@@ -4313,8 +4313,8 @@
{
if (!BUFFERP (lispobj))
return -1;
- range = (BUF_PT (XBUFFER (lispobj)) - BUF_BEGV (XBUFFER (lispobj))
- - startpos);
+ range = (BYTE_BUF_PT (XBUFFER (lispobj))
+ - BYTE_BUF_BEGV (XBUFFER (lispobj)) - startpos);
if (range < 0)
return -1;
}
Julian Bradfield writes:
Actually, I do believe this may be a very simple problem.
Around line 4078 of regex.c, we have the code:
/* In a forward search for something that starts with \=.
don't keep searching past point. */
if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot
&& range > 0)
{
range = BUF_PT (regex_emacs_buffer) - BUF_BEGV (regex_emacs_buffer)
- startpos;
if (range < 0)
return -1;
}
I think BUF_PT and BUF_BEGV should be BI_BUF_PT and BI_BUF_BEGV, since
range and startpos are byte positions not buffer positions. (A proper
type system would have caught that, of course...)
Leastways, it seems to work for me after doing that!
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches