diff options
| author | Alan Mackenzie | 2019-03-01 17:35:12 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2019-03-01 17:37:56 +0000 |
| commit | 31182c1d17f6f7bc946d5e4576e025c9b975e0b5 (patch) | |
| tree | 49f54fc69a83fbc5f7a7c01a82fe1e1417a94a59 /src/syntax.c | |
| parent | 287f2a676405009a6927fe7c33e36299a86b2827 (diff) | |
| download | emacs-31182c1d17f6f7bc946d5e4576e025c9b975e0b5.tar.gz emacs-31182c1d17f6f7bc946d5e4576e025c9b975e0b5.zip | |
Maintain interval ->position fields correctly in update_interval
Also fix some anomalies in the handling of byte positions in regexp-emacs.c
This fixes bug #34525.
* src/intervals.c (SET_PARENT_POSITION): New macro.
(update_interval): When moving to an interval's parent, set that parent's
->position field, to maintain the consistency of the tree.
* src/intervals.h (struct interval): Amend the comment describing when
->position is valid.
* src/pdumper.c: Update the hash associated with struct interval.
* src/regex-emacs.c: (re_match_2_internal): Only invoke POINTER_TO_OFFSET on a
known character boundary. Only perform arithmetic on character positions, not
on byte positions. Correct the argument to an invocation of
UPDATE_SYNTAX_TABLE_FORWARD by adding 1 to it (in case wordend:).
* src/syntax.c: (update_syntax_table): Remove the now redundant code that set
the ->position field of all parents of the interval found by update_interval.
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/src/syntax.c b/src/syntax.c index dd2f56f2cfa..fe1e2d236b9 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -340,20 +340,6 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init, | |||
| 340 | invalidate = false; | 340 | invalidate = false; |
| 341 | if (!i) | 341 | if (!i) |
| 342 | return; | 342 | return; |
| 343 | /* interval_of updates only ->position of the return value, so | ||
| 344 | update the parents manually to speed up update_interval. */ | ||
| 345 | while (!NULL_PARENT (i)) | ||
| 346 | { | ||
| 347 | if (AM_RIGHT_CHILD (i)) | ||
| 348 | INTERVAL_PARENT (i)->position = i->position | ||
| 349 | - LEFT_TOTAL_LENGTH (i) + TOTAL_LENGTH (i) /* right end */ | ||
| 350 | - TOTAL_LENGTH (INTERVAL_PARENT (i)) | ||
| 351 | + LEFT_TOTAL_LENGTH (INTERVAL_PARENT (i)); | ||
| 352 | else | ||
| 353 | INTERVAL_PARENT (i)->position = i->position - LEFT_TOTAL_LENGTH (i) | ||
| 354 | + TOTAL_LENGTH (i); | ||
| 355 | i = INTERVAL_PARENT (i); | ||
| 356 | } | ||
| 357 | i = gl_state.forward_i; | 343 | i = gl_state.forward_i; |
| 358 | gl_state.b_property = i->position - gl_state.offset; | 344 | gl_state.b_property = i->position - gl_state.offset; |
| 359 | gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; | 345 | gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; |