summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2003-04-06 20:33:59 +0000
committerRichard M. Stallman <rms@gnu.org>2003-04-06 20:33:59 +0000
commit55a91ea3b58f0bf998f5138b7b61fada48cf25c0 (patch)
tree964c648ed41aa09e66e631f5882a8d1a95a9e81f
parent727fec2d40c0eaffc9f48e9d2da0cb33c5ccff0f (diff)
downloademacs-55a91ea3b58f0bf998f5138b7b61fada48cf25c0.tar.gz
(verify_bytepos): New function.
-rw-r--r--src/marker.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/marker.c b/src/marker.c
index 0c1635fd2cb..b91609ca084 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -252,6 +252,24 @@ buf_charpos_to_bytepos (b, charpos)
}
#undef CONSIDER
+
+/* Used for debugging: recompute the bytepos corresponding to CHARPOS
+ in the simplest, most reliable way. */
+
+int
+verify_bytepos (charpos)
+{
+ int below = 1;
+ int below_byte = 1;
+
+ while (below != charpos)
+ {
+ below++;
+ BUF_INC_POS (current_buffer, below_byte);
+ }
+
+ return below_byte;
+}
/* bytepos_to_charpos returns the char position corresponding to BYTEPOS. */