1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 11:00:45 -08:00

Simplified and improved heuristic for long lines detection.

* src/lisp.h (modiff_incr): Add a parameter to 'modiff_incr' to record
the extent of the modification.

* 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): Add an argument to each
call to 'modiff_incr'.

* src/textprop.c (modify_text_properties): Add an argument to the call
to 'modiff_incr'.

* src/buffer.c (Frestore_buffer_modified_p, Fbuffer_swap_text,
modify_overlay): Add an argument to each call to 'modiff_incr'.

* src/xdisp.c (redisplay_window): Use the improved version of 'MODIFF'
for the heuristic.
This commit is contained in:
Gregory Heytings 2022-07-19 21:21:40 +00:00
parent c6bee17075
commit 7c0fc85364
5 changed files with 23 additions and 22 deletions

View file

@ -3911,10 +3911,11 @@ integer_to_uintmax (Lisp_Object num, uintmax_t *n)
typedef intmax_t modiff_count;
INLINE modiff_count
modiff_incr (modiff_count *a)
modiff_incr (modiff_count *a, ptrdiff_t len)
{
modiff_count a0 = *a;
bool modiff_overflow = INT_ADD_WRAPV (a0, 1, a);
modiff_count a0 = *a; int incr = len ? 1 : 0;
while (len >>= 1) incr++;
bool modiff_overflow = INT_ADD_WRAPV (a0, incr, a);
eassert (!modiff_overflow && *a >> 30 >> 30 == 0);
return a0;
}