aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-07-06 18:16:54 +0400
committerDmitry Antipov2012-07-06 18:16:54 +0400
commit9d44f8ce16669f862eb901435593193c54ac09dd (patch)
tree5c4fe5db309b05659b5f14846e73a5bf10b6bed0 /src
parentef091c97708639d01fff5e185516d8455a620de7 (diff)
downloademacs-9d44f8ce16669f862eb901435593193c54ac09dd.tar.gz
emacs-9d44f8ce16669f862eb901435593193c54ac09dd.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/marker.c24
2 files changed, 21 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 986c398b7fc..cfc4a00512f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,13 @@
12012-07-06 Dmitry Antipov <dmantipov@yandex.ru> 12012-07-06 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 Fix marker debugging code.
4 * marker.c (byte_char_debug_check): Do not perform the check
5 if buffer is not multibyte.
6 (buf_charpos_to_bytepos, buf_bytepos_to_charpos): Call
7 byte_char_debug_check with correct arguments.
8
92012-07-06 Dmitry Antipov <dmantipov@yandex.ru>
10
3 Compile marker debugging code only if ENABLE_CHECKING is defined. 11 Compile marker debugging code only if ENABLE_CHECKING is defined.
4 * marker.c (byte_char_debug_check, count_markers): Use 12 * marker.c (byte_char_debug_check, count_markers): Use
5 only if ENABLE_CHECKING is defined. 13 only if ENABLE_CHECKING is defined.
diff --git a/src/marker.c b/src/marker.c
index ac444fcec08..ba98a78f0e4 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -38,15 +38,17 @@ extern int count_markers (struct buffer *) EXTERNALLY_VISIBLE;
38static void 38static void
39byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) 39byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos)
40{ 40{
41 ptrdiff_t nchars = 0; 41 ptrdiff_t nchars;
42
43 if (NILP (BVAR (b, enable_multibyte_characters)))
44 return;
42 45
43 if (bytepos > BUF_GPT_BYTE (b)) 46 if (bytepos > BUF_GPT_BYTE (b))
44 { 47 nchars
45 nchars = multibyte_chars_in_text (BUF_BEG_ADDR (b), 48 = multibyte_chars_in_text (BUF_BEG_ADDR (b),
46 BUF_GPT_BYTE (b) - BUF_BEG_BYTE (b)); 49 BUF_GPT_BYTE (b) - BUF_BEG_BYTE (b))
47 nchars += multibyte_chars_in_text (BUF_GAP_END_ADDR (b), 50 + multibyte_chars_in_text (BUF_GAP_END_ADDR (b),
48 bytepos - BUF_GPT_BYTE (b)); 51 bytepos - BUF_GPT_BYTE (b));
49 }
50 else 52 else
51 nchars = multibyte_chars_in_text (BUF_BEG_ADDR (b), 53 nchars = multibyte_chars_in_text (BUF_BEG_ADDR (b),
52 bytepos - BUF_BEG_BYTE (b)); 54 bytepos - BUF_BEG_BYTE (b));
@@ -197,7 +199,7 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
197 if (record) 199 if (record)
198 build_marker (b, best_below, best_below_byte); 200 build_marker (b, best_below, best_below_byte);
199 201
200 byte_char_debug_check (b, charpos, best_below_byte); 202 byte_char_debug_check (b, best_below, best_below_byte);
201 203
202 cached_buffer = b; 204 cached_buffer = b;
203 cached_modiff = BUF_MODIFF (b); 205 cached_modiff = BUF_MODIFF (b);
@@ -222,7 +224,7 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
222 if (record) 224 if (record)
223 build_marker (b, best_above, best_above_byte); 225 build_marker (b, best_above, best_above_byte);
224 226
225 byte_char_debug_check (b, charpos, best_above_byte); 227 byte_char_debug_check (b, best_above, best_above_byte);
226 228
227 cached_buffer = b; 229 cached_buffer = b;
228 cached_modiff = BUF_MODIFF (b); 230 cached_modiff = BUF_MODIFF (b);
@@ -363,7 +365,7 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
363 if (record && BUF_MARKERS (b)) 365 if (record && BUF_MARKERS (b))
364 build_marker (b, best_below, best_below_byte); 366 build_marker (b, best_below, best_below_byte);
365 367
366 byte_char_debug_check (b, best_below, bytepos); 368 byte_char_debug_check (b, best_below, best_below_byte);
367 369
368 cached_buffer = b; 370 cached_buffer = b;
369 cached_modiff = BUF_MODIFF (b); 371 cached_modiff = BUF_MODIFF (b);
@@ -390,7 +392,7 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
390 if (record && BUF_MARKERS (b)) 392 if (record && BUF_MARKERS (b))
391 build_marker (b, best_above, best_above_byte); 393 build_marker (b, best_above, best_above_byte);
392 394
393 byte_char_debug_check (b, best_above, bytepos); 395 byte_char_debug_check (b, best_above, best_above_byte);
394 396
395 cached_buffer = b; 397 cached_buffer = b;
396 cached_modiff = BUF_MODIFF (b); 398 cached_modiff = BUF_MODIFF (b);