[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 954c9c5: Check by eassert that a bytepos argument i
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] master 954c9c5: Check by eassert that a bytepos argument isn't in the middle of a character |
Date: |
Sat, 2 Mar 2019 13:30:59 -0500 (EST) |
branch: master
commit 954c9c5bc344cdd6b201c2260b306ec0999aff24
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>
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.
---
src/marker.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/marker.c b/src/marker.c
index b58051a..0b2e1bf 100644
--- 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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 954c9c5: Check by eassert that a bytepos argument isn't in the middle of a character,
Alan Mackenzie <=