diff options
| author | Stefan Monnier | 2022-10-09 19:45:26 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2022-10-09 19:45:26 -0400 |
| commit | 7cbeeabc7e6271948e7bb93020c2e4e50c65f384 (patch) | |
| tree | 777b281d62878ab7cc5a12b7e3fbc8952bf95dbc /src/alloc.c | |
| parent | 4f3f7aebc957732f4fbe5c799da5367f46607680 (diff) | |
| download | emacs-7cbeeabc7e6271948e7bb93020c2e4e50c65f384.tar.gz emacs-7cbeeabc7e6271948e7bb93020c2e4e50c65f384.zip | |
Tighten up handling of `otick`
Move args between `build_overlay` and `add_buffer_overlay`,
to try and keep buffer positions together with their buffer.
Be more strict in the `otick` values passed to `interval_tree_insert`.
Move a few things around to try and reduce dependencies through `.h` files.
Fix a thinko bug in `check_tree`.
* src/alloc.c (build_overlay): Remove `begin` and `end` args.
* src/buffer.c (add_buffer_overlay): Move from `buffer.h`.
Add `begin` and `end` args.
(copy_overlays): Adjust accordingly.
(Fmake_overlay): Use BUF_BEG and BUF_Z; adjust call to `build_overlay`
and `add_buffer_overlay`.
(Fmove_overlay): Use BUF_BEG and BUF_Z; Use the new `begin` and `end`
args of `add_buffer_overlay` so we don't need to use
`interval_node_set_region` when moving to a new buffer.
(remove_buffer_overlay, set_overlay_region): Move from `buffer.h`.
* src/buffer.h (set_overlay_region, add_buffer_overlay)
(remove_buffer_overlay): Move to `buffer.c`.
(build_overlay): Move from `lisp.h`.
(maybe_alloc_buffer_overlays): Delete function (inline into its only
caller).
* src/itree.c (interval_tree_insert): Move declaration `from buffer.h`.
(check_tree): Fix initial offset in call to `recurse_check_tree`.
Remove redundant check of the `limit` value.
(interval_node_init): Remove `begin` and `end` args.
(interval_tree_insert): Mark it as static.
Assert that the new node's `otick` should already be uptodate and its
new parent as well.
(itree_insert_node): New function.
(interval_tree_insert_gap): Assert the otick of the removed+added nodes
were uptodate and mark them as uptodate again after adjusting
their positions.
(interval_tree_inherit_offset): Check that the parent is at least as
uptodate as the child.
* src/lisp.h (build_overlay): Move to `buffer.h`.
* src/itree.h (interval_node_init): Adjust accordingly.
(interval_tree_insert): Remove declaration.
(itree_insert_node): New declaration.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/alloc.c b/src/alloc.c index 50968b7e121..00f2991f250 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3702,19 +3702,17 @@ build_symbol_with_pos (Lisp_Object symbol, Lisp_Object position) | |||
| 3702 | return val; | 3702 | return val; |
| 3703 | } | 3703 | } |
| 3704 | 3704 | ||
| 3705 | /* Return a new overlay with specified START, END and PLIST. */ | 3705 | /* Return a new (deleted) overlay with PLIST. */ |
| 3706 | 3706 | ||
| 3707 | Lisp_Object | 3707 | Lisp_Object |
| 3708 | build_overlay (ptrdiff_t begin, ptrdiff_t end, | 3708 | build_overlay (bool front_advance, bool rear_advance, |
| 3709 | bool front_advance, bool rear_advance, | ||
| 3710 | Lisp_Object plist) | 3709 | Lisp_Object plist) |
| 3711 | { | 3710 | { |
| 3712 | struct Lisp_Overlay *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Overlay, plist, | 3711 | struct Lisp_Overlay *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Overlay, plist, |
| 3713 | PVEC_OVERLAY); | 3712 | PVEC_OVERLAY); |
| 3714 | Lisp_Object overlay = make_lisp_ptr (p, Lisp_Vectorlike); | 3713 | Lisp_Object overlay = make_lisp_ptr (p, Lisp_Vectorlike); |
| 3715 | struct interval_node *node = xmalloc (sizeof (*node)); | 3714 | struct interval_node *node = xmalloc (sizeof (*node)); |
| 3716 | interval_node_init (node, begin, end, front_advance, | 3715 | interval_node_init (node, front_advance, rear_advance, overlay); |
| 3717 | rear_advance, overlay); | ||
| 3718 | p->interval = node; | 3716 | p->interval = node; |
| 3719 | p->buffer = NULL; | 3717 | p->buffer = NULL; |
| 3720 | set_overlay_plist (overlay, plist); | 3718 | set_overlay_plist (overlay, plist); |