changeset 50472:674bfa5d582d

(verify_bytepos): New function.
author Richard M. Stallman <rms@gnu.org>
date Sun, 06 Apr 2003 20:33:59 +0000
parents dc1f6aa29285
children d89a8e99c73b
files src/marker.c
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/marker.c	Sun Apr 06 20:32:52 2003 +0000
+++ b/src/marker.c	Sun Apr 06 20:33:59 2003 +0000
@@ -252,6 +252,24 @@
 }
 
 #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.  */