projects
/
emacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d2b5f44
)
Check by eassert that a bytepos argument isn't in the middle of a character
author
Alan Mackenzie
<acm@muc.de>
Sat, 2 Mar 2019 18:23:34 +0000
(18:23 +0000)
committer
Alan Mackenzie
<acm@muc.de>
Sat, 2 Mar 2019 18:23:34 +0000
(18:23 +0000)
* src/marker.c (buf_bytepos_to_charpos): Add an eassert to check that the
parameter bytepos is at the beginning of a character or EOB.
src/marker.c
patch
|
blob
|
history
diff --git
a/src/marker.c
b/src/marker.c
index b58051a8c2b9dc2739f804b8e9034d441345d013..0b2e1bf5c6b8f78b5db09e84d7e0420f5d374067 100644
(file)
--- a/
src/marker.c
+++ b/
src/marker.c
@@
-332,6
+332,10
@@
buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
if (best_above == best_above_byte)
return bytepos;
+ /* Check bytepos is not in the middle of a character. */
+ eassert (bytepos >= BUF_Z_BYTE (b)
+ || CHAR_HEAD_P (BUF_FETCH_BYTE (b, bytepos)));
+
best_below = BEG;
best_below_byte = BEG_BYTE;