aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2019-01-31 10:29:50 -0800
committerPaul Eggert2019-01-31 10:31:43 -0800
commit05d2fc7170fb66a87601b1c76ddae2c1b7b4b934 (patch)
tree217ddd3a45ea611069d85ac13e22e525bb965996 /src
parenta68eee50eb515b28b448894299334afced26ef78 (diff)
downloademacs-05d2fc7170fb66a87601b1c76ddae2c1b7b4b934.tar.gz
emacs-05d2fc7170fb66a87601b1c76ddae2c1b7b4b934.zip
Widen modiff counts to avoid wraparound
Widen modification counts to at least 64 bits, to make wraparound practically impossible. * doc/lispref/buffers.texi (Buffer Modification): Don’t say the modification-count can wrap around. * src/buffer.c (Frestore_buffer_modified_p, Fbuffer_swap_text) (modify_overlay): * src/insdel.c (insert_1_both, insert_from_string_1) (insert_from_gap, insert_from_buffer_1) (adjust_after_replace, replace_range, replace_range_2) (del_range_2, modify_text): * src/textprop.c (modify_text_properties): Use modiff_incr instead of incrementing directly. (Fbuffer_modified_tick, Fbuffer_chars_modified_tick): Don’t assume modification counts fit into fixnums. * src/buffer.h (struct buffer_text, struct buffer): * src/cmds.c (internal_self_insert): * src/fileio.c (Finsert_file_contents): * src/indent.c (last_known_column_modified): * src/keyboard.c (command_loop_1): * src/marker.c (cached_modiff): * src/syntax.c (find_start_modiff, parse_sexp_propertize) (find_defun_start): * src/window.h (struct window): Use modiff_count for modification counts. * src/editfns.c (Fsubst_char_in_region): Copy instead of incrementing modification counts, since integer overflow checking is not needed here. * src/lisp.h (modiff_count): New type. (modiff_incr, modiff_to_integer): New inline functions. * src/pdumper.c (dump_buffer): Update hash.
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c25
-rw-r--r--src/buffer.h18
-rw-r--r--src/cmds.c2
-rw-r--r--src/editfns.c9
-rw-r--r--src/fileio.c4
-rw-r--r--src/indent.c2
-rw-r--r--src/insdel.c18
-rw-r--r--src/keyboard.c2
-rw-r--r--src/lisp.h22
-rw-r--r--src/marker.c2
-rw-r--r--src/pdumper.c2
-rw-r--r--src/syntax.c6
-rw-r--r--src/textprop.c2
-rw-r--r--src/window.h4
14 files changed, 72 insertions, 46 deletions
diff --git a/src/buffer.c b/src/buffer.c
index a12c80ec0b0..e5cc5f367f0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1413,7 +1413,7 @@ state of the current buffer. Use with care. */)
1413 /* If SAVE_MODIFF == auto_save_modified == MODIFF, 1413 /* If SAVE_MODIFF == auto_save_modified == MODIFF,
1414 we can either decrease SAVE_MODIFF and auto_save_modified 1414 we can either decrease SAVE_MODIFF and auto_save_modified
1415 or increase MODIFF. */ 1415 or increase MODIFF. */
1416 : MODIFF++); 1416 : modiff_incr (&MODIFF));
1417 1417
1418 return flag; 1418 return flag;
1419} 1419}
@@ -1422,11 +1422,11 @@ DEFUN ("buffer-modified-tick", Fbuffer_modified_tick, Sbuffer_modified_tick,
1422 0, 1, 0, 1422 0, 1, 0,
1423 doc: /* Return BUFFER's tick counter, incremented for each change in text. 1423 doc: /* Return BUFFER's tick counter, incremented for each change in text.
1424Each buffer has a tick counter which is incremented each time the 1424Each buffer has a tick counter which is incremented each time the
1425text in that buffer is changed. It wraps around occasionally. 1425text in that buffer is changed. No argument or nil as argument means
1426No argument or nil as argument means use current buffer as BUFFER. */) 1426use current buffer as BUFFER. */)
1427 (register Lisp_Object buffer) 1427 (Lisp_Object buffer)
1428{ 1428{
1429 return make_fixnum (BUF_MODIFF (decode_buffer (buffer))); 1429 return modiff_to_integer (BUF_MODIFF (decode_buffer (buffer)));
1430} 1430}
1431 1431
1432DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick, 1432DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick,
@@ -1439,9 +1439,9 @@ values returned by two individual calls of `buffer-chars-modified-tick',
1439you can tell whether a character change occurred in that buffer in 1439you can tell whether a character change occurred in that buffer in
1440between these calls. No argument or nil as argument means use current 1440between these calls. No argument or nil as argument means use current
1441buffer as BUFFER. */) 1441buffer as BUFFER. */)
1442 (register Lisp_Object buffer) 1442 (Lisp_Object buffer)
1443{ 1443{
1444 return make_fixnum (BUF_CHARS_MODIFF (decode_buffer (buffer))); 1444 return modiff_to_integer (BUF_CHARS_MODIFF (decode_buffer (buffer)));
1445} 1445}
1446 1446
1447DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2, 1447DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2,
@@ -2375,9 +2375,12 @@ results, see Info node `(elisp)Swapping Text'. */)
2375 bset_point_before_scroll (current_buffer, Qnil); 2375 bset_point_before_scroll (current_buffer, Qnil);
2376 bset_point_before_scroll (other_buffer, Qnil); 2376 bset_point_before_scroll (other_buffer, Qnil);
2377 2377
2378 current_buffer->text->modiff++; other_buffer->text->modiff++; 2378 modiff_incr (&current_buffer->text->modiff);
2379 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; 2379 modiff_incr (&other_buffer->text->modiff);
2380 current_buffer->text->overlay_modiff++; other_buffer->text->overlay_modiff++; 2380 modiff_incr (&current_buffer->text->chars_modiff);
2381 modiff_incr (&other_buffer->text->chars_modiff);
2382 modiff_incr (&current_buffer->text->overlay_modiff);
2383 modiff_incr (&other_buffer->text->overlay_modiff);
2381 current_buffer->text->beg_unchanged = current_buffer->text->gpt; 2384 current_buffer->text->beg_unchanged = current_buffer->text->gpt;
2382 current_buffer->text->end_unchanged = current_buffer->text->gpt; 2385 current_buffer->text->end_unchanged = current_buffer->text->gpt;
2383 other_buffer->text->beg_unchanged = other_buffer->text->gpt; 2386 other_buffer->text->beg_unchanged = other_buffer->text->gpt;
@@ -3913,7 +3916,7 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
3913 3916
3914 bset_redisplay (buf); 3917 bset_redisplay (buf);
3915 3918
3916 ++BUF_OVERLAY_MODIFF (buf); 3919 modiff_incr (&BUF_OVERLAY_MODIFF (buf));
3917} 3920}
3918 3921
3919/* Remove OVERLAY from LIST. */ 3922/* Remove OVERLAY from LIST. */
diff --git a/src/buffer.h b/src/buffer.h
index 82cc2ebfbf9..d3528ac50e9 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -422,20 +422,20 @@ struct buffer_text
422 ptrdiff_t gpt_byte; /* Byte pos of gap in buffer. */ 422 ptrdiff_t gpt_byte; /* Byte pos of gap in buffer. */
423 ptrdiff_t z_byte; /* Byte pos of end of buffer. */ 423 ptrdiff_t z_byte; /* Byte pos of end of buffer. */
424 ptrdiff_t gap_size; /* Size of buffer's gap. */ 424 ptrdiff_t gap_size; /* Size of buffer's gap. */
425 EMACS_INT modiff; /* This counts buffer-modification events 425 modiff_count modiff; /* This counts buffer-modification events
426 for this buffer. It is incremented for 426 for this buffer. It is incremented for
427 each such event, and never otherwise 427 each such event, and never otherwise
428 changed. */ 428 changed. */
429 EMACS_INT chars_modiff; /* This is modified with character change 429 modiff_count chars_modiff; /* This is modified with character change
430 events for this buffer. It is set to 430 events for this buffer. It is set to
431 modiff for each such event, and never 431 modiff for each such event, and never
432 otherwise changed. */ 432 otherwise changed. */
433 EMACS_INT save_modiff; /* Previous value of modiff, as of last 433 modiff_count save_modiff; /* Previous value of modiff, as of last
434 time buffer visited or saved a file. */ 434 time buffer visited or saved a file. */
435 435
436 EMACS_INT overlay_modiff; /* Counts modifications to overlays. */ 436 modiff_count overlay_modiff; /* Counts modifications to overlays. */
437 437
438 EMACS_INT compact; /* Set to modiff each time when compact_buffer 438 modiff_count compact; /* Set to modiff each time when compact_buffer
439 is called for this buffer. */ 439 is called for this buffer. */
440 440
441 /* Minimum value of GPT - BEG since last redisplay that finished. */ 441 /* Minimum value of GPT - BEG since last redisplay that finished. */
@@ -446,12 +446,12 @@ struct buffer_text
446 446
447 /* MODIFF as of last redisplay that finished; if it matches MODIFF, 447 /* MODIFF as of last redisplay that finished; if it matches MODIFF,
448 beg_unchanged and end_unchanged contain no useful information. */ 448 beg_unchanged and end_unchanged contain no useful information. */
449 EMACS_INT unchanged_modified; 449 modiff_count unchanged_modified;
450 450
451 /* BUF_OVERLAY_MODIFF of current buffer, as of last redisplay that 451 /* BUF_OVERLAY_MODIFF of current buffer, as of last redisplay that
452 finished; if it matches BUF_OVERLAY_MODIFF, beg_unchanged and 452 finished; if it matches BUF_OVERLAY_MODIFF, beg_unchanged and
453 end_unchanged contain no useful information. */ 453 end_unchanged contain no useful information. */
454 EMACS_INT overlay_unchanged_modified; 454 modiff_count overlay_unchanged_modified;
455 455
456 /* Properties of this buffer's text. */ 456 /* Properties of this buffer's text. */
457 INTERVAL intervals; 457 INTERVAL intervals;
@@ -812,11 +812,11 @@ struct buffer
812 off_t modtime_size; 812 off_t modtime_size;
813 813
814 /* The value of text->modiff at the last auto-save. */ 814 /* The value of text->modiff at the last auto-save. */
815 EMACS_INT auto_save_modified; 815 modiff_count auto_save_modified;
816 816
817 /* The value of text->modiff at the last display error. 817 /* The value of text->modiff at the last display error.
818 Redisplay of this buffer is inhibited until it changes again. */ 818 Redisplay of this buffer is inhibited until it changes again. */
819 EMACS_INT display_error_modiff; 819 modiff_count display_error_modiff;
820 820
821 /* The time at which we detected a failure to auto-save, 821 /* The time at which we detected a failure to auto-save,
822 Or 0 if we didn't have a failure. */ 822 Or 0 if we didn't have a failure. */
diff --git a/src/cmds.c b/src/cmds.c
index 239e3be5c07..9f3c8610e62 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -423,7 +423,7 @@ internal_self_insert (int c, EMACS_INT n)
423 : UNIBYTE_TO_CHAR (XFIXNAT (Fprevious_char ()))) 423 : UNIBYTE_TO_CHAR (XFIXNAT (Fprevious_char ())))
424 == Sword)) 424 == Sword))
425 { 425 {
426 EMACS_INT modiff = MODIFF; 426 modiff_count modiff = MODIFF;
427 Lisp_Object sym; 427 Lisp_Object sym;
428 428
429 sym = call0 (Qexpand_abbrev); 429 sym = call0 (Qexpand_abbrev);
diff --git a/src/editfns.c b/src/editfns.c
index 3edfd1dc201..360cdbe02ee 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2291,10 +2291,11 @@ Both characters must have the same length of multi-byte form. */)
2291 2291
2292 if (! NILP (noundo)) 2292 if (! NILP (noundo))
2293 { 2293 {
2294 if (MODIFF - 1 == SAVE_MODIFF) 2294 modiff_count m = MODIFF;
2295 SAVE_MODIFF++; 2295 if (SAVE_MODIFF == m - 1)
2296 if (MODIFF - 1 == BUF_AUTOSAVE_MODIFF (current_buffer)) 2296 SAVE_MODIFF = m;
2297 BUF_AUTOSAVE_MODIFF (current_buffer)++; 2297 if (BUF_AUTOSAVE_MODIFF (current_buffer) == m - 1)
2298 BUF_AUTOSAVE_MODIFF (current_buffer) = m;
2298 } 2299 }
2299 2300
2300 /* The before-change-function may have moved the gap 2301 /* The before-change-function may have moved the gap
diff --git a/src/fileio.c b/src/fileio.c
index aececcda305..55c9f26b753 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4618,7 +4618,7 @@ by calling `format-decode', which see. */)
4618 ptrdiff_t opoint = PT; 4618 ptrdiff_t opoint = PT;
4619 ptrdiff_t opoint_byte = PT_BYTE; 4619 ptrdiff_t opoint_byte = PT_BYTE;
4620 ptrdiff_t oinserted = ZV - BEGV; 4620 ptrdiff_t oinserted = ZV - BEGV;
4621 EMACS_INT ochars_modiff = CHARS_MODIFF; 4621 modiff_count ochars_modiff = CHARS_MODIFF;
4622 4622
4623 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); 4623 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
4624 insval = call3 (Qformat_decode, 4624 insval = call3 (Qformat_decode,
@@ -4658,7 +4658,7 @@ by calling `format-decode', which see. */)
4658 ptrdiff_t opoint = PT; 4658 ptrdiff_t opoint = PT;
4659 ptrdiff_t opoint_byte = PT_BYTE; 4659 ptrdiff_t opoint_byte = PT_BYTE;
4660 ptrdiff_t oinserted = ZV - BEGV; 4660 ptrdiff_t oinserted = ZV - BEGV;
4661 EMACS_INT ochars_modiff = CHARS_MODIFF; 4661 modiff_count ochars_modiff = CHARS_MODIFF;
4662 4662
4663 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); 4663 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
4664 insval = call1 (XCAR (p), make_fixnum (oinserted)); 4664 insval = call1 (XCAR (p), make_fixnum (oinserted));
diff --git a/src/indent.c b/src/indent.c
index 0970532f30d..bc1aa8ca2c6 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -49,7 +49,7 @@ ptrdiff_t last_known_column_point;
49 49
50/* Value of MODIFF when current_column was called. */ 50/* Value of MODIFF when current_column was called. */
51 51
52static EMACS_INT last_known_column_modified; 52static modiff_count last_known_column_modified;
53 53
54static ptrdiff_t current_column_1 (void); 54static ptrdiff_t current_column_1 (void);
55static ptrdiff_t position_indentation (ptrdiff_t); 55static ptrdiff_t position_indentation (ptrdiff_t);
diff --git a/src/insdel.c b/src/insdel.c
index a6f006a521d..fd725ac8785 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -903,7 +903,7 @@ insert_1_both (const char *string,
903 the insertion. This, together with recording the insertion, 903 the insertion. This, together with recording the insertion,
904 will add up to the right stuff in the undo list. */ 904 will add up to the right stuff in the undo list. */
905 record_insert (PT, nchars); 905 record_insert (PT, nchars);
906 MODIFF++; 906 modiff_incr (&MODIFF);
907 CHARS_MODIFF = MODIFF; 907 CHARS_MODIFF = MODIFF;
908 908
909 memcpy (GPT_ADDR, string, nbytes); 909 memcpy (GPT_ADDR, string, nbytes);
@@ -1031,7 +1031,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
1031#endif 1031#endif
1032 1032
1033 record_insert (PT, nchars); 1033 record_insert (PT, nchars);
1034 MODIFF++; 1034 modiff_incr (&MODIFF);
1035 CHARS_MODIFF = MODIFF; 1035 CHARS_MODIFF = MODIFF;
1036 1036
1037 GAP_SIZE -= outgoing_nbytes; 1037 GAP_SIZE -= outgoing_nbytes;
@@ -1088,7 +1088,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail)
1088 of this dance. */ 1088 of this dance. */
1089 invalidate_buffer_caches (current_buffer, GPT, GPT); 1089 invalidate_buffer_caches (current_buffer, GPT, GPT);
1090 record_insert (GPT, nchars); 1090 record_insert (GPT, nchars);
1091 MODIFF++; 1091 modiff_incr (&MODIFF);
1092 1092
1093 GAP_SIZE -= nbytes; 1093 GAP_SIZE -= nbytes;
1094 if (! text_at_gap_tail) 1094 if (! text_at_gap_tail)
@@ -1228,7 +1228,7 @@ insert_from_buffer_1 (struct buffer *buf,
1228#endif 1228#endif
1229 1229
1230 record_insert (PT, nchars); 1230 record_insert (PT, nchars);
1231 MODIFF++; 1231 modiff_incr (&MODIFF);
1232 CHARS_MODIFF = MODIFF; 1232 CHARS_MODIFF = MODIFF;
1233 1233
1234 GAP_SIZE -= outgoing_nbytes; 1234 GAP_SIZE -= outgoing_nbytes;
@@ -1329,7 +1329,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
1329 1329
1330 if (len == 0) 1330 if (len == 0)
1331 evaporate_overlays (from); 1331 evaporate_overlays (from);
1332 MODIFF++; 1332 modiff_incr (&MODIFF);
1333 CHARS_MODIFF = MODIFF; 1333 CHARS_MODIFF = MODIFF;
1334} 1334}
1335 1335
@@ -1524,7 +1524,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
1524 1524
1525 check_markers (); 1525 check_markers ();
1526 1526
1527 MODIFF++; 1527 modiff_incr (&MODIFF);
1528 CHARS_MODIFF = MODIFF; 1528 CHARS_MODIFF = MODIFF;
1529 1529
1530 if (adjust_match_data) 1530 if (adjust_match_data)
@@ -1655,7 +1655,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
1655 1655
1656 check_markers (); 1656 check_markers ();
1657 1657
1658 MODIFF++; 1658 modiff_incr (&MODIFF);
1659 CHARS_MODIFF = MODIFF; 1659 CHARS_MODIFF = MODIFF;
1660} 1660}
1661 1661
@@ -1830,7 +1830,7 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
1830 at the end of the text before the gap. */ 1830 at the end of the text before the gap. */
1831 adjust_markers_for_delete (from, from_byte, to, to_byte); 1831 adjust_markers_for_delete (from, from_byte, to, to_byte);
1832 1832
1833 MODIFF++; 1833 modiff_incr (&MODIFF);
1834 CHARS_MODIFF = MODIFF; 1834 CHARS_MODIFF = MODIFF;
1835 1835
1836 /* Relocate point as if it were a marker. */ 1836 /* Relocate point as if it were a marker. */
@@ -1884,7 +1884,7 @@ modify_text (ptrdiff_t start, ptrdiff_t end)
1884 BUF_COMPUTE_UNCHANGED (current_buffer, start - 1, end); 1884 BUF_COMPUTE_UNCHANGED (current_buffer, start - 1, end);
1885 if (MODIFF <= SAVE_MODIFF) 1885 if (MODIFF <= SAVE_MODIFF)
1886 record_first_change (); 1886 record_first_change ();
1887 MODIFF++; 1887 modiff_incr (&MODIFF);
1888 CHARS_MODIFF = MODIFF; 1888 CHARS_MODIFF = MODIFF;
1889 1889
1890 bset_point_before_scroll (current_buffer, Qnil); 1890 bset_point_before_scroll (current_buffer, Qnil);
diff --git a/src/keyboard.c b/src/keyboard.c
index b3b55e73b63..cd1747ea88c 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1238,7 +1238,7 @@ static void adjust_point_for_property (ptrdiff_t, bool);
1238Lisp_Object 1238Lisp_Object
1239command_loop_1 (void) 1239command_loop_1 (void)
1240{ 1240{
1241 EMACS_INT prev_modiff = 0; 1241 modiff_count prev_modiff = 0;
1242 struct buffer *prev_buffer = NULL; 1242 struct buffer *prev_buffer = NULL;
1243 bool already_adjusted = 0; 1243 bool already_adjusted = 0;
1244 1244
diff --git a/src/lisp.h b/src/lisp.h
index 5159f050a49..5a0de4b12c7 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3490,6 +3490,28 @@ integer_to_uintmax (Lisp_Object num, uintmax_t *n)
3490 } 3490 }
3491} 3491}
3492 3492
3493/* A modification count. These are wide enough, and incremented
3494 rarely enough, so that they should never overflow a 60-bit counter
3495 in practice, and the code below assumes this so a compiler can
3496 generate better code if EMACS_INT is 64 bits. */
3497typedef intmax_t modiff_count;
3498
3499INLINE modiff_count
3500modiff_incr (modiff_count *a)
3501{
3502 modiff_count a0 = *a;
3503 bool modiff_overflow = INT_ADD_WRAPV (a0, 1, a);
3504 eassert (!modiff_overflow && *a >> 30 >> 30 == 0);
3505 return a0;
3506}
3507
3508INLINE Lisp_Object
3509modiff_to_integer (modiff_count a)
3510{
3511 eassume (0 <= a && a >> 30 >> 30 == 0);
3512 return make_int (a);
3513}
3514
3493/* Defined in data.c. */ 3515/* Defined in data.c. */
3494extern _Noreturn void wrong_choice (Lisp_Object, Lisp_Object); 3516extern _Noreturn void wrong_choice (Lisp_Object, Lisp_Object);
3495extern void notify_variable_watchers (Lisp_Object, Lisp_Object, 3517extern void notify_variable_watchers (Lisp_Object, Lisp_Object,
diff --git a/src/marker.c b/src/marker.c
index 36d6b10c746..b58051a8c2b 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -30,7 +30,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
30static ptrdiff_t cached_charpos; 30static ptrdiff_t cached_charpos;
31static ptrdiff_t cached_bytepos; 31static ptrdiff_t cached_bytepos;
32static struct buffer *cached_buffer; 32static struct buffer *cached_buffer;
33static EMACS_INT cached_modiff; 33static modiff_count cached_modiff;
34 34
35/* Juanma Barranquero <lekktu@gmail.com> reported ~3x increased 35/* Juanma Barranquero <lekktu@gmail.com> reported ~3x increased
36 bootstrap time when byte_char_debug_check is enabled; so this 36 bootstrap time when byte_char_debug_check is enabled; so this
diff --git a/src/pdumper.c b/src/pdumper.c
index 7a8a90d4cf3..d4fbc4b0494 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2797,7 +2797,7 @@ dump_hash_table (struct dump_context *ctx,
2797static dump_off 2797static dump_off
2798dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer) 2798dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
2799{ 2799{
2800#if CHECK_STRUCTS && !defined (HASH_buffer_E8695CAE09) 2800#if CHECK_STRUCTS && !defined HASH_buffer_AE2C8CE357
2801# error "buffer changed. See CHECK_STRUCTS comment." 2801# error "buffer changed. See CHECK_STRUCTS comment."
2802#endif 2802#endif
2803 struct buffer munged_buffer = *in_buffer; 2803 struct buffer munged_buffer = *in_buffer;
diff --git a/src/syntax.c b/src/syntax.c
index 4616ae296f8..dd2f56f2cfa 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -175,7 +175,7 @@ static ptrdiff_t find_start_value;
175static ptrdiff_t find_start_value_byte; 175static ptrdiff_t find_start_value_byte;
176static struct buffer *find_start_buffer; 176static struct buffer *find_start_buffer;
177static ptrdiff_t find_start_begv; 177static ptrdiff_t find_start_begv;
178static EMACS_INT find_start_modiff; 178static modiff_count find_start_modiff;
179 179
180 180
181static Lisp_Object skip_chars (bool, Lisp_Object, Lisp_Object, bool); 181static Lisp_Object skip_chars (bool, Lisp_Object, Lisp_Object, bool);
@@ -489,7 +489,7 @@ parse_sexp_propertize (ptrdiff_t charpos)
489 if (syntax_propertize__done <= charpos 489 if (syntax_propertize__done <= charpos
490 && syntax_propertize__done < zv) 490 && syntax_propertize__done < zv)
491 { 491 {
492 EMACS_INT modiffs = CHARS_MODIFF; 492 modiff_count modiffs = CHARS_MODIFF;
493 safe_call1 (Qinternal__syntax_propertize, 493 safe_call1 (Qinternal__syntax_propertize,
494 make_fixnum (min (zv, 1 + charpos))); 494 make_fixnum (min (zv, 1 + charpos)));
495 if (modiffs != CHARS_MODIFF) 495 if (modiffs != CHARS_MODIFF)
@@ -608,7 +608,7 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte)
608 608
609 if (!NILP (Vcomment_use_syntax_ppss)) 609 if (!NILP (Vcomment_use_syntax_ppss))
610 { 610 {
611 EMACS_INT modiffs = CHARS_MODIFF; 611 modiff_count modiffs = CHARS_MODIFF;
612 Lisp_Object ppss = call1 (Qsyntax_ppss, make_fixnum (pos)); 612 Lisp_Object ppss = call1 (Qsyntax_ppss, make_fixnum (pos));
613 if (modiffs != CHARS_MODIFF) 613 if (modiffs != CHARS_MODIFF)
614 error ("syntax-ppss modified the buffer!"); 614 error ("syntax-ppss modified the buffer!");
diff --git a/src/textprop.c b/src/textprop.c
index 7e29ed6e8b8..bb063d3eaaa 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -89,7 +89,7 @@ modify_text_properties (Lisp_Object buffer, Lisp_Object start, Lisp_Object end)
89 BUF_COMPUTE_UNCHANGED (buf, b - 1, e); 89 BUF_COMPUTE_UNCHANGED (buf, b - 1, e);
90 if (MODIFF <= SAVE_MODIFF) 90 if (MODIFF <= SAVE_MODIFF)
91 record_first_change (); 91 record_first_change ();
92 MODIFF++; 92 modiff_incr (&MODIFF);
93 93
94 bset_point_before_scroll (current_buffer, Qnil); 94 bset_point_before_scroll (current_buffer, Qnil);
95 95
diff --git a/src/window.h b/src/window.h
index 9c4aea85ea6..514bf1fb6ec 100644
--- a/src/window.h
+++ b/src/window.h
@@ -281,11 +281,11 @@ struct window
281 281
282 /* Displayed buffer's text modification events counter as of last time 282 /* Displayed buffer's text modification events counter as of last time
283 display completed. */ 283 display completed. */
284 EMACS_INT last_modified; 284 modiff_count last_modified;
285 285
286 /* Displayed buffer's overlays modification events counter as of last 286 /* Displayed buffer's overlays modification events counter as of last
287 complete update. */ 287 complete update. */
288 EMACS_INT last_overlay_modified; 288 modiff_count last_overlay_modified;
289 289
290 /* Value of point at that time. Since this is a position in a buffer, 290 /* Value of point at that time. Since this is a position in a buffer,
291 it should be positive. */ 291 it should be positive. */