emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108911: Fix marker debugging code.


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108911: Fix marker debugging code.
Date: Fri, 06 Jul 2012 18:16:54 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108911
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2012-07-06 18:16:54 +0400
message:
  Fix marker debugging code.
  * marker.c (byte_char_debug_check): Do not perform the check
  if buffer is not multibyte.
  (buf_charpos_to_bytepos, buf_bytepos_to_charpos): Call
  byte_char_debug_check with correct arguments.
modified:
  src/ChangeLog
  src/marker.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-06 09:20:41 +0000
+++ b/src/ChangeLog     2012-07-06 14:16:54 +0000
@@ -1,5 +1,13 @@
 2012-07-06  Dmitry Antipov  <address@hidden>
 
+       Fix marker debugging code.
+       * marker.c (byte_char_debug_check): Do not perform the check
+       if buffer is not multibyte.
+       (buf_charpos_to_bytepos, buf_bytepos_to_charpos): Call
+       byte_char_debug_check with correct arguments.
+
+2012-07-06  Dmitry Antipov  <address@hidden>
+
        Compile marker debugging code only if ENABLE_CHECKING is defined.
        * marker.c (byte_char_debug_check, count_markers): Use
        only if ENABLE_CHECKING is defined.

=== modified file 'src/marker.c'
--- a/src/marker.c      2012-07-06 09:20:41 +0000
+++ b/src/marker.c      2012-07-06 14:16:54 +0000
@@ -38,15 +38,17 @@
 static void
 byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos)
 {
-  ptrdiff_t nchars = 0;
+  ptrdiff_t nchars;
+
+  if (NILP (BVAR (b, enable_multibyte_characters)))
+    return;
 
   if (bytepos > BUF_GPT_BYTE (b))
-    {
-      nchars = multibyte_chars_in_text (BUF_BEG_ADDR (b),
-                                       BUF_GPT_BYTE (b) - BUF_BEG_BYTE (b));
-      nchars += multibyte_chars_in_text (BUF_GAP_END_ADDR (b),
-                                        bytepos - BUF_GPT_BYTE (b));
-    }
+    nchars
+      = multibyte_chars_in_text (BUF_BEG_ADDR (b),
+                                BUF_GPT_BYTE (b) - BUF_BEG_BYTE (b))
+      + multibyte_chars_in_text (BUF_GAP_END_ADDR (b),
+                                bytepos - BUF_GPT_BYTE (b));
   else
     nchars = multibyte_chars_in_text (BUF_BEG_ADDR (b),
                                      bytepos - BUF_BEG_BYTE (b));
@@ -197,7 +199,7 @@
       if (record)
        build_marker (b, best_below, best_below_byte);
 
-      byte_char_debug_check (b, charpos, best_below_byte);
+      byte_char_debug_check (b, best_below, best_below_byte);
 
       cached_buffer = b;
       cached_modiff = BUF_MODIFF (b);
@@ -222,7 +224,7 @@
       if (record)
        build_marker (b, best_above, best_above_byte);
 
-      byte_char_debug_check (b, charpos, best_above_byte);
+      byte_char_debug_check (b, best_above, best_above_byte);
 
       cached_buffer = b;
       cached_modiff = BUF_MODIFF (b);
@@ -363,7 +365,7 @@
       if (record && BUF_MARKERS (b))
        build_marker (b, best_below, best_below_byte);
 
-      byte_char_debug_check (b, best_below, bytepos);
+      byte_char_debug_check (b, best_below, best_below_byte);
 
       cached_buffer = b;
       cached_modiff = BUF_MODIFF (b);
@@ -390,7 +392,7 @@
       if (record && BUF_MARKERS (b))
        build_marker (b, best_above, best_above_byte);
 
-      byte_char_debug_check (b, best_above, bytepos);
+      byte_char_debug_check (b, best_above, best_above_byte);
 
       cached_buffer = b;
       cached_modiff = BUF_MODIFF (b);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]