aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mackenzie2019-03-02 18:23:34 +0000
committerAlan Mackenzie2019-03-02 18:23:34 +0000
commit954c9c5bc344cdd6b201c2260b306ec0999aff24 (patch)
tree1f0a28cd728d91106ab7e8c2808c97340ac12ef5 /src
parentd2b5f445c1a5f9e105eb65e10b28a40645516656 (diff)
downloademacs-954c9c5bc344cdd6b201c2260b306ec0999aff24.tar.gz
emacs-954c9c5bc344cdd6b201c2260b306ec0999aff24.zip
Check by eassert that a bytepos argument isn't in the middle of a character
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/marker.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/marker.c b/src/marker.c
index b58051a8c2b..0b2e1bf5c6b 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -332,6 +332,10 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
332 if (best_above == best_above_byte) 332 if (best_above == best_above_byte)
333 return bytepos; 333 return bytepos;
334 334
335 /* Check bytepos is not in the middle of a character. */
336 eassert (bytepos >= BUF_Z_BYTE (b)
337 || CHAR_HEAD_P (BUF_FETCH_BYTE (b, bytepos)));
338
335 best_below = BEG; 339 best_below = BEG;
336 best_below_byte = BEG_BYTE; 340 best_below_byte = BEG_BYTE;
337 341