APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1534892711 -3600
# Wed Aug 22 00:05:11 2018 +0100
# Node ID 68a9e72bc26775c4e0d1aae4cfde4a6c7a1e8c9a
# Parent 483ea92098737f7a89dc002092032e6c6a9ad1e3
Fix my bug with #'read, a marker STREAM, and a variable-length buffer.
src/ChangeLog addition:
2018-08-21 Aidan Kehoe <kehoea(a)parhasard.net>
* lread.c (readchar):
Fix my bug here, BYTE_BUF_FETCH_CHAR() is the macro to use with a
Bytebpos, using BUF_FETCH_CHAR () gives a bug with byte marker
position.
* editfns.c (save_restriction_restore):
Work around what is almost certainly a compiler bug here, store
the result of bytebpos_to_charbpos (BUF, BYTE_START) in a local
variable, instead of passing it as an argument directly, avoiding
incorrect calculated values for the character position.
tests/ChangeLog addition:
2018-08-22 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/mule-tests.el:
Test that #'read doesn't get confused with a marker STREAM and a
multibyte buffer.
diff -r 483ea9209873 -r 68a9e72bc267 src/ChangeLog
--- a/src/ChangeLog Mon Aug 20 21:29:10 2018 +0100
+++ b/src/ChangeLog Wed Aug 22 00:05:11 2018 +0100
@@ -1,3 +1,15 @@
+2018-08-21 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * lread.c (readchar):
+ Fix my bug here, BYTE_BUF_FETCH_CHAR() is the macro to use with a
+ Bytebpos, using BUF_FETCH_CHAR () gives a bug with byte marker
+ position.
+ * editfns.c (save_restriction_restore):
+ Work around what is almost certainly a compiler bug here, store
+ the result of bytebpos_to_charbpos (BUF, BYTE_START) in a local
+ variable, instead of passing it as an argument directly, avoiding
+ incorrect calculated values for the character position.
+
2018-08-20 Aidan Kehoe <kehoea(a)parhasard.net>
* callint.c (check_mark):
diff -r 483ea9209873 -r 68a9e72bc267 src/editfns.c
--- a/src/editfns.c Mon Aug 20 21:29:10 2018 +0100
+++ b/src/editfns.c Wed Aug 22 00:05:11 2018 +0100
@@ -2167,16 +2167,16 @@
if (BYTE_BUF_BEGV (buf) != byte_start)
{
+ Charbpos cstart = bytebpos_to_charbpos (buf, byte_start);
local_clip_changed = 1;
- SET_BOTH_BUF_BEGV (buf, bytebpos_to_charbpos (buf, byte_start),
- byte_start);
+ SET_BOTH_BUF_BEGV (buf, cstart, byte_start);
narrow_line_number_cache (buf);
}
if (BYTE_BUF_ZV (buf) != byte_end)
{
+ Charbpos cend = bytebpos_to_charbpos (buf, byte_end);
local_clip_changed = 1;
- SET_BOTH_BUF_ZV (buf, bytebpos_to_charbpos (buf, byte_end),
- byte_end);
+ SET_BOTH_BUF_ZV (buf, cend, byte_end);
}
if (local_clip_changed)
diff -r 483ea9209873 -r 68a9e72bc267 src/lread.c
--- a/src/lread.c Mon Aug 20 21:29:10 2018 +0100
+++ b/src/lread.c Wed Aug 22 00:05:11 2018 +0100
@@ -269,7 +269,7 @@
if (mpos >= BYTE_BUF_ZV (inbuffer))
return -1;
- c = BUF_FETCH_CHAR (inbuffer, mpos);
+ c = BYTE_BUF_FETCH_CHAR (inbuffer, mpos);
INC_BYTEBPOS (inbuffer, mpos);
set_byte_marker_position (readcharfun, mpos, wrap_buffer (inbuffer));
return c;
diff -r 483ea9209873 -r 68a9e72bc267 tests/ChangeLog
--- a/tests/ChangeLog Mon Aug 20 21:29:10 2018 +0100
+++ b/tests/ChangeLog Wed Aug 22 00:05:11 2018 +0100
@@ -1,3 +1,9 @@
+2018-08-22 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/mule-tests.el:
+ Test that #'read doesn't get confused with a marker STREAM and a
+ multibyte buffer.
+
2018-08-15 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
diff -r 483ea9209873 -r 68a9e72bc267 tests/automated/mule-tests.el
--- a/tests/automated/mule-tests.el Mon Aug 20 21:29:10 2018 +0100
+++ b/tests/automated/mule-tests.el Wed Aug 22 00:05:11 2018 +0100
@@ -170,6 +170,15 @@
(set-buffer-modified-p nil)
(kill-buffer nil)))
(delete-file existing-file-name))
+
+;; Make sure #'read isn't confused by a marker STREAM in a variable-length
+;; buffer.
+
+(with-temp-buffer
+ (insert "\xe4quivalent")
+ (goto-char (point-min))
+ (Assert (eq (read (copy-marker (point)))
+ (intern (concat (list ?\xe4) "quivalent")))))
;;-----------------------------------------------------------------
;; Test string modification functions that modify the length of a char.
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)
Show replies by date