diff options
| author | Dmitry Antipov | 2012-08-08 10:11:29 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-08-08 10:11:29 +0400 |
| commit | 77c7bcb1157b405bde1227b20ef5f7ce9a90e689 (patch) | |
| tree | 3daa729dc8fd54db0dff9ace5de1274e992a7d6b /src | |
| parent | 9c08a8d4b549df18f815412d2a5494d28253179f (diff) | |
| download | emacs-77c7bcb1157b405bde1227b20ef5f7ce9a90e689.tar.gz emacs-77c7bcb1157b405bde1227b20ef5f7ce9a90e689.zip | |
Cleanup intervals.
* intervals.h (NULL_INTERVAL, DEFAULT_INTERVAL): Remove.
(NULL_INTERVAL_P): Likewise. Adjust users.
(FRONT_STICKY_P, END_NONSTICKY_P, FRONT_NONSTICKY_P): Adjust
comment. Move under #if 0.
* alloc.c, buffer.c, editfns.c, fns.c, insdel.c, intervals.c:
* print.c, syntax.c, textprop.c, xdisp.c: Adjust users.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/alloc.c | 27 | ||||
| -rw-r--r-- | src/buffer.c | 12 | ||||
| -rw-r--r-- | src/editfns.c | 10 | ||||
| -rw-r--r-- | src/fileio.c | 2 | ||||
| -rw-r--r-- | src/fns.c | 6 | ||||
| -rw-r--r-- | src/insdel.c | 14 | ||||
| -rw-r--r-- | src/intervals.c | 105 | ||||
| -rw-r--r-- | src/intervals.h | 83 | ||||
| -rw-r--r-- | src/print.c | 4 | ||||
| -rw-r--r-- | src/syntax.c | 12 | ||||
| -rw-r--r-- | src/textprop.c | 96 | ||||
| -rw-r--r-- | src/xdisp.c | 6 |
13 files changed, 191 insertions, 196 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7c49694dd44..7919b6f8f8a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,15 @@ | |||
| 1 | 2012-08-08 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2012-08-08 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 2 | ||
| 3 | Cleanup intervals. | ||
| 4 | * intervals.h (NULL_INTERVAL, DEFAULT_INTERVAL): Remove. | ||
| 5 | (NULL_INTERVAL_P): Likewise. Adjust users. | ||
| 6 | (FRONT_STICKY_P, END_NONSTICKY_P, FRONT_NONSTICKY_P): Adjust | ||
| 7 | comment. Move under #if 0. | ||
| 8 | * alloc.c, buffer.c, editfns.c, fns.c, insdel.c, intervals.c: | ||
| 9 | * print.c, syntax.c, textprop.c, xdisp.c: Adjust users. | ||
| 10 | |||
| 11 | 2012-08-08 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 12 | |||
| 3 | Check total length of intervals with eassert. | 13 | Check total length of intervals with eassert. |
| 4 | * intervals.h (CHECK_TOTAL_LENGTH): Remove. | 14 | * intervals.h (CHECK_TOTAL_LENGTH): Remove. |
| 5 | * intervals.c: Change all users to eassert. | 15 | * intervals.c: Change all users to eassert. |
diff --git a/src/alloc.c b/src/alloc.c index b6fe6fa2eb3..d342a722ca6 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1559,19 +1559,20 @@ mark_interval_tree (register INTERVAL tree) | |||
| 1559 | 1559 | ||
| 1560 | /* Mark the interval tree rooted in I. */ | 1560 | /* Mark the interval tree rooted in I. */ |
| 1561 | 1561 | ||
| 1562 | #define MARK_INTERVAL_TREE(i) \ | 1562 | #define MARK_INTERVAL_TREE(i) \ |
| 1563 | do { \ | 1563 | do { \ |
| 1564 | if (!NULL_INTERVAL_P (i) && !i->gcmarkbit) \ | 1564 | if (i && !i->gcmarkbit) \ |
| 1565 | mark_interval_tree (i); \ | 1565 | mark_interval_tree (i); \ |
| 1566 | } while (0) | 1566 | } while (0) |
| 1567 | 1567 | ||
| 1568 | /* Unmark and rebalance interval tree rooted in I. */ | ||
| 1568 | 1569 | ||
| 1569 | #define UNMARK_BALANCE_INTERVALS(i) \ | 1570 | #define UNMARK_BALANCE_INTERVALS(i) \ |
| 1570 | do { \ | 1571 | do { \ |
| 1571 | if (! NULL_INTERVAL_P (i)) \ | 1572 | if (i) \ |
| 1572 | (i) = balance_intervals (i); \ | 1573 | (i) = balance_intervals (i); \ |
| 1573 | } while (0) | 1574 | } while (0) |
| 1574 | 1575 | ||
| 1575 | /*********************************************************************** | 1576 | /*********************************************************************** |
| 1576 | String Allocation | 1577 | String Allocation |
| 1577 | ***********************************************************************/ | 1578 | ***********************************************************************/ |
| @@ -2100,7 +2101,7 @@ sweep_strings (void) | |||
| 2100 | /* String is live; unmark it and its intervals. */ | 2101 | /* String is live; unmark it and its intervals. */ |
| 2101 | UNMARK_STRING (s); | 2102 | UNMARK_STRING (s); |
| 2102 | 2103 | ||
| 2103 | if (!NULL_INTERVAL_P (s->intervals)) | 2104 | if (s->intervals) |
| 2104 | UNMARK_BALANCE_INTERVALS (s->intervals); | 2105 | UNMARK_BALANCE_INTERVALS (s->intervals); |
| 2105 | 2106 | ||
| 2106 | ++total_strings; | 2107 | ++total_strings; |
| @@ -2502,7 +2503,7 @@ make_uninit_multibyte_string (EMACS_INT nchars, EMACS_INT nbytes) | |||
| 2502 | return empty_multibyte_string; | 2503 | return empty_multibyte_string; |
| 2503 | 2504 | ||
| 2504 | s = allocate_string (); | 2505 | s = allocate_string (); |
| 2505 | s->intervals = NULL_INTERVAL; | 2506 | s->intervals = NULL; |
| 2506 | allocate_string_data (s, nchars, nbytes); | 2507 | allocate_string_data (s, nchars, nbytes); |
| 2507 | XSETSTRING (string, s); | 2508 | XSETSTRING (string, s); |
| 2508 | string_chars_consed += nbytes; | 2509 | string_chars_consed += nbytes; |
| @@ -5221,7 +5222,7 @@ make_pure_string (const char *data, | |||
| 5221 | } | 5222 | } |
| 5222 | s->size = nchars; | 5223 | s->size = nchars; |
| 5223 | s->size_byte = multibyte ? nbytes : -1; | 5224 | s->size_byte = multibyte ? nbytes : -1; |
| 5224 | s->intervals = NULL_INTERVAL; | 5225 | s->intervals = NULL; |
| 5225 | XSETSTRING (string, s); | 5226 | XSETSTRING (string, s); |
| 5226 | return string; | 5227 | return string; |
| 5227 | } | 5228 | } |
| @@ -5237,7 +5238,7 @@ make_pure_c_string (const char *data, ptrdiff_t nchars) | |||
| 5237 | s->size = nchars; | 5238 | s->size = nchars; |
| 5238 | s->size_byte = -1; | 5239 | s->size_byte = -1; |
| 5239 | s->data = (unsigned char *) data; | 5240 | s->data = (unsigned char *) data; |
| 5240 | s->intervals = NULL_INTERVAL; | 5241 | s->intervals = NULL; |
| 5241 | XSETSTRING (string, s); | 5242 | XSETSTRING (string, s); |
| 5242 | return string; | 5243 | return string; |
| 5243 | } | 5244 | } |
diff --git a/src/buffer.c b/src/buffer.c index 7d0e1b641a2..ad28b69b972 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -360,7 +360,7 @@ even if it is dead. The return value is never nil. */) | |||
| 360 | BUF_CHARS_MODIFF (b) = 1; | 360 | BUF_CHARS_MODIFF (b) = 1; |
| 361 | BUF_OVERLAY_MODIFF (b) = 1; | 361 | BUF_OVERLAY_MODIFF (b) = 1; |
| 362 | BUF_SAVE_MODIFF (b) = 1; | 362 | BUF_SAVE_MODIFF (b) = 1; |
| 363 | BUF_INTERVALS (b) = 0; | 363 | BUF_INTERVALS (b) = NULL; |
| 364 | BUF_UNCHANGED_MODIFIED (b) = 1; | 364 | BUF_UNCHANGED_MODIFIED (b) = 1; |
| 365 | BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1; | 365 | BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1; |
| 366 | BUF_END_UNCHANGED (b) = 0; | 366 | BUF_END_UNCHANGED (b) = 0; |
| @@ -384,7 +384,7 @@ even if it is dead. The return value is never nil. */) | |||
| 384 | BVAR (b, zv_marker) = Qnil; | 384 | BVAR (b, zv_marker) = Qnil; |
| 385 | 385 | ||
| 386 | name = Fcopy_sequence (buffer_or_name); | 386 | name = Fcopy_sequence (buffer_or_name); |
| 387 | STRING_SET_INTERVALS (name, NULL_INTERVAL); | 387 | STRING_SET_INTERVALS (name, NULL); |
| 388 | BVAR (b, name) = name; | 388 | BVAR (b, name) = name; |
| 389 | 389 | ||
| 390 | BVAR (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt; | 390 | BVAR (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt; |
| @@ -589,7 +589,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 589 | all_buffers = b; | 589 | all_buffers = b; |
| 590 | 590 | ||
| 591 | name = Fcopy_sequence (name); | 591 | name = Fcopy_sequence (name); |
| 592 | STRING_SET_INTERVALS (name, NULL_INTERVAL); | 592 | STRING_SET_INTERVALS (name, NULL); |
| 593 | BVAR (b, name) = name; | 593 | BVAR (b, name) = name; |
| 594 | 594 | ||
| 595 | reset_buffer (b); | 595 | reset_buffer (b); |
| @@ -1688,7 +1688,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1688 | m = next; | 1688 | m = next; |
| 1689 | } | 1689 | } |
| 1690 | BUF_MARKERS (b) = NULL; | 1690 | BUF_MARKERS (b) = NULL; |
| 1691 | BUF_INTERVALS (b) = NULL_INTERVAL; | 1691 | BUF_INTERVALS (b) = NULL; |
| 1692 | 1692 | ||
| 1693 | /* Perhaps we should explicitly free the interval tree here... */ | 1693 | /* Perhaps we should explicitly free the interval tree here... */ |
| 1694 | } | 1694 | } |
| @@ -4904,8 +4904,8 @@ init_buffer_once (void) | |||
| 4904 | /* No one will share the text with these buffers, but let's play it safe. */ | 4904 | /* No one will share the text with these buffers, but let's play it safe. */ |
| 4905 | buffer_defaults.indirections = 0; | 4905 | buffer_defaults.indirections = 0; |
| 4906 | buffer_local_symbols.indirections = 0; | 4906 | buffer_local_symbols.indirections = 0; |
| 4907 | BUF_INTERVALS (&buffer_defaults) = 0; | 4907 | BUF_INTERVALS (&buffer_defaults) = NULL; |
| 4908 | BUF_INTERVALS (&buffer_local_symbols) = 0; | 4908 | BUF_INTERVALS (&buffer_local_symbols) = NULL; |
| 4909 | XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); | 4909 | XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); |
| 4910 | XSETBUFFER (Vbuffer_defaults, &buffer_defaults); | 4910 | XSETBUFFER (Vbuffer_defaults, &buffer_defaults); |
| 4911 | XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); | 4911 | XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); |
diff --git a/src/editfns.c b/src/editfns.c index ae568a40a68..9d74563ca9d 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -4637,7 +4637,7 @@ Transposing beyond buffer boundaries is an error. */) | |||
| 4637 | /* Don't use Fset_text_properties: that can cause GC, which can | 4637 | /* Don't use Fset_text_properties: that can cause GC, which can |
| 4638 | clobber objects stored in the tmp_intervals. */ | 4638 | clobber objects stored in the tmp_intervals. */ |
| 4639 | tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0); | 4639 | tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0); |
| 4640 | if (!NULL_INTERVAL_P (tmp_interval3)) | 4640 | if (tmp_interval3) |
| 4641 | set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3); | 4641 | set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3); |
| 4642 | 4642 | ||
| 4643 | /* First region smaller than second. */ | 4643 | /* First region smaller than second. */ |
| @@ -4696,11 +4696,11 @@ Transposing beyond buffer boundaries is an error. */) | |||
| 4696 | tmp_interval2 = copy_intervals (cur_intv, start2, len2); | 4696 | tmp_interval2 = copy_intervals (cur_intv, start2, len2); |
| 4697 | 4697 | ||
| 4698 | tmp_interval3 = validate_interval_range (buf, &startr1, &endr1, 0); | 4698 | tmp_interval3 = validate_interval_range (buf, &startr1, &endr1, 0); |
| 4699 | if (!NULL_INTERVAL_P (tmp_interval3)) | 4699 | if (tmp_interval3) |
| 4700 | set_text_properties_1 (startr1, endr1, Qnil, buf, tmp_interval3); | 4700 | set_text_properties_1 (startr1, endr1, Qnil, buf, tmp_interval3); |
| 4701 | 4701 | ||
| 4702 | tmp_interval3 = validate_interval_range (buf, &startr2, &endr2, 0); | 4702 | tmp_interval3 = validate_interval_range (buf, &startr2, &endr2, 0); |
| 4703 | if (!NULL_INTERVAL_P (tmp_interval3)) | 4703 | if (tmp_interval3) |
| 4704 | set_text_properties_1 (startr2, endr2, Qnil, buf, tmp_interval3); | 4704 | set_text_properties_1 (startr2, endr2, Qnil, buf, tmp_interval3); |
| 4705 | 4705 | ||
| 4706 | temp = SAFE_ALLOCA (len1_byte); | 4706 | temp = SAFE_ALLOCA (len1_byte); |
| @@ -4729,7 +4729,7 @@ Transposing beyond buffer boundaries is an error. */) | |||
| 4729 | tmp_interval2 = copy_intervals (cur_intv, start2, len2); | 4729 | tmp_interval2 = copy_intervals (cur_intv, start2, len2); |
| 4730 | 4730 | ||
| 4731 | tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0); | 4731 | tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0); |
| 4732 | if (!NULL_INTERVAL_P (tmp_interval3)) | 4732 | if (tmp_interval3) |
| 4733 | set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3); | 4733 | set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3); |
| 4734 | 4734 | ||
| 4735 | /* holds region 2 */ | 4735 | /* holds region 2 */ |
| @@ -4762,7 +4762,7 @@ Transposing beyond buffer boundaries is an error. */) | |||
| 4762 | tmp_interval2 = copy_intervals (cur_intv, start2, len2); | 4762 | tmp_interval2 = copy_intervals (cur_intv, start2, len2); |
| 4763 | 4763 | ||
| 4764 | tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0); | 4764 | tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0); |
| 4765 | if (!NULL_INTERVAL_P (tmp_interval3)) | 4765 | if (tmp_interval3) |
| 4766 | set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3); | 4766 | set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3); |
| 4767 | 4767 | ||
| 4768 | /* holds region 1 */ | 4768 | /* holds region 1 */ |
diff --git a/src/fileio.c b/src/fileio.c index 36d61f15617..7639c2f0b33 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3145,7 +3145,7 @@ decide_coding_unwind (Lisp_Object unwind_data) | |||
| 3145 | set_buffer_internal (XBUFFER (buffer)); | 3145 | set_buffer_internal (XBUFFER (buffer)); |
| 3146 | adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE); | 3146 | adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE); |
| 3147 | adjust_overlays_for_delete (BEG, Z - BEG); | 3147 | adjust_overlays_for_delete (BEG, Z - BEG); |
| 3148 | BUF_INTERVALS (current_buffer) = 0; | 3148 | BUF_INTERVALS (current_buffer) = NULL; |
| 3149 | TEMP_SET_PT_BOTH (BEG, BEG_BYTE); | 3149 | TEMP_SET_PT_BOTH (BEG, BEG_BYTE); |
| 3150 | 3150 | ||
| 3151 | /* Now we are safe to change the buffer's multibyteness directly. */ | 3151 | /* Now we are safe to change the buffer's multibyteness directly. */ |
| @@ -628,7 +628,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 628 | ptrdiff_t thislen_byte = SBYTES (this); | 628 | ptrdiff_t thislen_byte = SBYTES (this); |
| 629 | 629 | ||
| 630 | memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this)); | 630 | memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this)); |
| 631 | if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) | 631 | if (STRING_INTERVALS (this)) |
| 632 | { | 632 | { |
| 633 | textprops[num_textprops].argnum = argnum; | 633 | textprops[num_textprops].argnum = argnum; |
| 634 | textprops[num_textprops].from = 0; | 634 | textprops[num_textprops].from = 0; |
| @@ -640,7 +640,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 640 | /* Copy a single-byte string to a multibyte string. */ | 640 | /* Copy a single-byte string to a multibyte string. */ |
| 641 | else if (STRINGP (this) && STRINGP (val)) | 641 | else if (STRINGP (this) && STRINGP (val)) |
| 642 | { | 642 | { |
| 643 | if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) | 643 | if (STRING_INTERVALS (this)) |
| 644 | { | 644 | { |
| 645 | textprops[num_textprops].argnum = argnum; | 645 | textprops[num_textprops].argnum = argnum; |
| 646 | textprops[num_textprops].from = 0; | 646 | textprops[num_textprops].from = 0; |
| @@ -1060,7 +1060,7 @@ If you're not sure, whether to use `string-as-multibyte' or | |||
| 1060 | str_as_multibyte (SDATA (new_string), nbytes, | 1060 | str_as_multibyte (SDATA (new_string), nbytes, |
| 1061 | SBYTES (string), NULL); | 1061 | SBYTES (string), NULL); |
| 1062 | string = new_string; | 1062 | string = new_string; |
| 1063 | STRING_SET_INTERVALS (string, NULL_INTERVAL); | 1063 | STRING_SET_INTERVALS (string, NULL); |
| 1064 | } | 1064 | } |
| 1065 | return string; | 1065 | return string; |
| 1066 | } | 1066 | } |
diff --git a/src/insdel.c b/src/insdel.c index 9646507bc4b..6cd46ac634b 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -844,10 +844,10 @@ insert_1_both (const char *string, | |||
| 844 | PT + nchars, PT_BYTE + nbytes, | 844 | PT + nchars, PT_BYTE + nbytes, |
| 845 | before_markers); | 845 | before_markers); |
| 846 | 846 | ||
| 847 | if (BUF_INTERVALS (current_buffer) != 0) | 847 | if (BUF_INTERVALS (current_buffer)) |
| 848 | offset_intervals (current_buffer, PT, nchars); | 848 | offset_intervals (current_buffer, PT, nchars); |
| 849 | 849 | ||
| 850 | if (!inherit && BUF_INTERVALS (current_buffer) != 0) | 850 | if (!inherit && BUF_INTERVALS (current_buffer)) |
| 851 | set_text_properties (make_number (PT), make_number (PT + nchars), | 851 | set_text_properties (make_number (PT), make_number (PT + nchars), |
| 852 | Qnil, Qnil, Qnil); | 852 | Qnil, Qnil, Qnil); |
| 853 | 853 | ||
| @@ -1017,10 +1017,10 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes) | |||
| 1017 | adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes, | 1017 | adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes, |
| 1018 | GPT, GPT_BYTE, 0); | 1018 | GPT, GPT_BYTE, 0); |
| 1019 | 1019 | ||
| 1020 | if (BUF_INTERVALS (current_buffer) != 0) | 1020 | if (BUF_INTERVALS (current_buffer)) |
| 1021 | { | 1021 | { |
| 1022 | offset_intervals (current_buffer, GPT - nchars, nchars); | 1022 | offset_intervals (current_buffer, GPT - nchars, nchars); |
| 1023 | graft_intervals_into_buffer (NULL_INTERVAL, GPT - nchars, nchars, | 1023 | graft_intervals_into_buffer (NULL, GPT - nchars, nchars, |
| 1024 | current_buffer, 0); | 1024 | current_buffer, 0); |
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| @@ -1157,7 +1157,7 @@ insert_from_buffer_1 (struct buffer *buf, | |||
| 1157 | PT_BYTE + outgoing_nbytes, | 1157 | PT_BYTE + outgoing_nbytes, |
| 1158 | 0); | 1158 | 0); |
| 1159 | 1159 | ||
| 1160 | if (BUF_INTERVALS (current_buffer) != 0) | 1160 | if (BUF_INTERVALS (current_buffer)) |
| 1161 | offset_intervals (current_buffer, PT, nchars); | 1161 | offset_intervals (current_buffer, PT, nchars); |
| 1162 | 1162 | ||
| 1163 | /* Get the intervals for the part of the string we are inserting. */ | 1163 | /* Get the intervals for the part of the string we are inserting. */ |
| @@ -1225,7 +1225,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, | |||
| 1225 | adjust_overlays_for_insert (from, len - nchars_del); | 1225 | adjust_overlays_for_insert (from, len - nchars_del); |
| 1226 | else if (len < nchars_del) | 1226 | else if (len < nchars_del) |
| 1227 | adjust_overlays_for_delete (from, nchars_del - len); | 1227 | adjust_overlays_for_delete (from, nchars_del - len); |
| 1228 | if (BUF_INTERVALS (current_buffer) != 0) | 1228 | if (BUF_INTERVALS (current_buffer)) |
| 1229 | { | 1229 | { |
| 1230 | offset_intervals (current_buffer, from, len - nchars_del); | 1230 | offset_intervals (current_buffer, from, len - nchars_del); |
| 1231 | } | 1231 | } |
| @@ -1823,7 +1823,7 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end, | |||
| 1823 | if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) | 1823 | if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) |
| 1824 | ++windows_or_buffers_changed; | 1824 | ++windows_or_buffers_changed; |
| 1825 | 1825 | ||
| 1826 | if (BUF_INTERVALS (current_buffer) != 0) | 1826 | if (BUF_INTERVALS (current_buffer)) |
| 1827 | { | 1827 | { |
| 1828 | if (preserve_ptr) | 1828 | if (preserve_ptr) |
| 1829 | { | 1829 | { |
diff --git a/src/intervals.c b/src/intervals.c index 40f77f3957a..504557dadb7 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -207,10 +207,10 @@ void | |||
| 207 | traverse_intervals_noorder (INTERVAL tree, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) | 207 | traverse_intervals_noorder (INTERVAL tree, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) |
| 208 | { | 208 | { |
| 209 | /* Minimize stack usage. */ | 209 | /* Minimize stack usage. */ |
| 210 | while (!NULL_INTERVAL_P (tree)) | 210 | while (tree) |
| 211 | { | 211 | { |
| 212 | (*function) (tree, arg); | 212 | (*function) (tree, arg); |
| 213 | if (NULL_INTERVAL_P (tree->right)) | 213 | if (!tree->right) |
| 214 | tree = tree->left; | 214 | tree = tree->left; |
| 215 | else | 215 | else |
| 216 | { | 216 | { |
| @@ -227,7 +227,7 @@ void | |||
| 227 | traverse_intervals (INTERVAL tree, ptrdiff_t position, | 227 | traverse_intervals (INTERVAL tree, ptrdiff_t position, |
| 228 | void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) | 228 | void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) |
| 229 | { | 229 | { |
| 230 | while (!NULL_INTERVAL_P (tree)) | 230 | while (tree) |
| 231 | { | 231 | { |
| 232 | traverse_intervals (tree->left, position, function, arg); | 232 | traverse_intervals (tree->left, position, function, arg); |
| 233 | position += LEFT_TOTAL_LENGTH (tree); | 233 | position += LEFT_TOTAL_LENGTH (tree); |
| @@ -262,7 +262,7 @@ search_for_interval (INTERVAL i, INTERVAL tree) | |||
| 262 | { | 262 | { |
| 263 | icount = 0; | 263 | icount = 0; |
| 264 | search_interval = i; | 264 | search_interval = i; |
| 265 | found_interval = NULL_INTERVAL; | 265 | found_interval = NULL; |
| 266 | traverse_intervals_noorder (tree, &check_for_interval, Qnil); | 266 | traverse_intervals_noorder (tree, &check_for_interval, Qnil); |
| 267 | return found_interval; | 267 | return found_interval; |
| 268 | } | 268 | } |
| @@ -333,7 +333,7 @@ rotate_right (INTERVAL interval) | |||
| 333 | 333 | ||
| 334 | /* Make A point to c */ | 334 | /* Make A point to c */ |
| 335 | interval_set_left (interval, i); | 335 | interval_set_left (interval, i); |
| 336 | if (! NULL_INTERVAL_P (i)) | 336 | if (i) |
| 337 | interval_set_parent (i, interval); | 337 | interval_set_parent (i, interval); |
| 338 | 338 | ||
| 339 | /* A's total length is decreased by the length of B and its left child. */ | 339 | /* A's total length is decreased by the length of B and its left child. */ |
| @@ -380,7 +380,7 @@ rotate_left (INTERVAL interval) | |||
| 380 | 380 | ||
| 381 | /* Make A point to c */ | 381 | /* Make A point to c */ |
| 382 | interval_set_right (interval, i); | 382 | interval_set_right (interval, i); |
| 383 | if (! NULL_INTERVAL_P (i)) | 383 | if (i) |
| 384 | interval_set_parent (i, interval); | 384 | interval_set_parent (i, interval); |
| 385 | 385 | ||
| 386 | /* A's total length is decreased by the length of B and its right child. */ | 386 | /* A's total length is decreased by the length of B and its right child. */ |
| @@ -480,12 +480,9 @@ balance_intervals_internal (register INTERVAL tree) | |||
| 480 | INTERVAL | 480 | INTERVAL |
| 481 | balance_intervals (INTERVAL tree) | 481 | balance_intervals (INTERVAL tree) |
| 482 | { | 482 | { |
| 483 | if (tree == NULL_INTERVAL) | 483 | return tree ? balance_intervals_internal (tree) : NULL; |
| 484 | return NULL_INTERVAL; | ||
| 485 | |||
| 486 | return balance_intervals_internal (tree); | ||
| 487 | } | 484 | } |
| 488 | 485 | ||
| 489 | /* Split INTERVAL into two pieces, starting the second piece at | 486 | /* Split INTERVAL into two pieces, starting the second piece at |
| 490 | character position OFFSET (counting from 0), relative to INTERVAL. | 487 | character position OFFSET (counting from 0), relative to INTERVAL. |
| 491 | INTERVAL becomes the left-hand piece, and the right-hand piece | 488 | INTERVAL becomes the left-hand piece, and the right-hand piece |
| @@ -589,7 +586,7 @@ interval_start_pos (INTERVAL source) | |||
| 589 | { | 586 | { |
| 590 | Lisp_Object parent; | 587 | Lisp_Object parent; |
| 591 | 588 | ||
| 592 | if (NULL_INTERVAL_P (source)) | 589 | if (!source) |
| 593 | return 0; | 590 | return 0; |
| 594 | 591 | ||
| 595 | if (! INTERVAL_HAS_OBJECT (source)) | 592 | if (! INTERVAL_HAS_OBJECT (source)) |
| @@ -617,8 +614,8 @@ find_interval (register INTERVAL tree, register ptrdiff_t position) | |||
| 617 | to POSITION. */ | 614 | to POSITION. */ |
| 618 | register ptrdiff_t relative_position; | 615 | register ptrdiff_t relative_position; |
| 619 | 616 | ||
| 620 | if (NULL_INTERVAL_P (tree)) | 617 | if (!tree) |
| 621 | return NULL_INTERVAL; | 618 | return NULL; |
| 622 | 619 | ||
| 623 | relative_position = position; | 620 | relative_position = position; |
| 624 | if (INTERVAL_HAS_OBJECT (tree)) | 621 | if (INTERVAL_HAS_OBJECT (tree)) |
| @@ -669,8 +666,8 @@ next_interval (register INTERVAL interval) | |||
| 669 | register INTERVAL i = interval; | 666 | register INTERVAL i = interval; |
| 670 | register ptrdiff_t next_position; | 667 | register ptrdiff_t next_position; |
| 671 | 668 | ||
| 672 | if (NULL_INTERVAL_P (i)) | 669 | if (!i) |
| 673 | return NULL_INTERVAL; | 670 | return NULL; |
| 674 | next_position = interval->position + LENGTH (interval); | 671 | next_position = interval->position + LENGTH (interval); |
| 675 | 672 | ||
| 676 | if (! NULL_RIGHT_CHILD (i)) | 673 | if (! NULL_RIGHT_CHILD (i)) |
| @@ -695,7 +692,7 @@ next_interval (register INTERVAL interval) | |||
| 695 | i = INTERVAL_PARENT (i); | 692 | i = INTERVAL_PARENT (i); |
| 696 | } | 693 | } |
| 697 | 694 | ||
| 698 | return NULL_INTERVAL; | 695 | return NULL; |
| 699 | } | 696 | } |
| 700 | 697 | ||
| 701 | /* Find the preceding interval (lexicographically) to INTERVAL. | 698 | /* Find the preceding interval (lexicographically) to INTERVAL. |
| @@ -707,8 +704,8 @@ previous_interval (register INTERVAL interval) | |||
| 707 | { | 704 | { |
| 708 | register INTERVAL i; | 705 | register INTERVAL i; |
| 709 | 706 | ||
| 710 | if (NULL_INTERVAL_P (interval)) | 707 | if (!interval) |
| 711 | return NULL_INTERVAL; | 708 | return NULL; |
| 712 | 709 | ||
| 713 | if (! NULL_LEFT_CHILD (interval)) | 710 | if (! NULL_LEFT_CHILD (interval)) |
| 714 | { | 711 | { |
| @@ -733,7 +730,7 @@ previous_interval (register INTERVAL interval) | |||
| 733 | i = INTERVAL_PARENT (i); | 730 | i = INTERVAL_PARENT (i); |
| 734 | } | 731 | } |
| 735 | 732 | ||
| 736 | return NULL_INTERVAL; | 733 | return NULL; |
| 737 | } | 734 | } |
| 738 | 735 | ||
| 739 | /* Find the interval containing POS given some non-NULL INTERVAL | 736 | /* Find the interval containing POS given some non-NULL INTERVAL |
| @@ -744,8 +741,8 @@ previous_interval (register INTERVAL interval) | |||
| 744 | INTERVAL | 741 | INTERVAL |
| 745 | update_interval (register INTERVAL i, ptrdiff_t pos) | 742 | update_interval (register INTERVAL i, ptrdiff_t pos) |
| 746 | { | 743 | { |
| 747 | if (NULL_INTERVAL_P (i)) | 744 | if (!i) |
| 748 | return NULL_INTERVAL; | 745 | return NULL; |
| 749 | 746 | ||
| 750 | while (1) | 747 | while (1) |
| 751 | { | 748 | { |
| @@ -938,8 +935,8 @@ adjust_intervals_for_insertion (INTERVAL tree, | |||
| 938 | struct interval newi; | 935 | struct interval newi; |
| 939 | 936 | ||
| 940 | RESET_INTERVAL (&newi); | 937 | RESET_INTERVAL (&newi); |
| 941 | pleft = NULL_INTERVAL_P (prev) ? Qnil : prev->plist; | 938 | pleft = prev ? prev->plist : Qnil; |
| 942 | pright = NULL_INTERVAL_P (i) ? Qnil : i->plist; | 939 | pright = i ? i->plist : Qnil; |
| 943 | interval_set_plist (&newi, merge_properties_sticky (pleft, pright)); | 940 | interval_set_plist (&newi, merge_properties_sticky (pleft, pright)); |
| 944 | 941 | ||
| 945 | if (! prev) /* i.e. position == BEG */ | 942 | if (! prev) /* i.e. position == BEG */ |
| @@ -954,8 +951,7 @@ adjust_intervals_for_insertion (INTERVAL tree, | |||
| 954 | { | 951 | { |
| 955 | prev = split_interval_right (prev, position - prev->position); | 952 | prev = split_interval_right (prev, position - prev->position); |
| 956 | interval_set_plist (prev, newi.plist); | 953 | interval_set_plist (prev, newi.plist); |
| 957 | if (! NULL_INTERVAL_P (i) | 954 | if (i && intervals_equal (prev, i)) |
| 958 | && intervals_equal (prev, i)) | ||
| 959 | merge_interval_right (prev); | 955 | merge_interval_right (prev); |
| 960 | } | 956 | } |
| 961 | 957 | ||
| @@ -1164,16 +1160,16 @@ delete_node (register INTERVAL i) | |||
| 1164 | register INTERVAL migrate, this; | 1160 | register INTERVAL migrate, this; |
| 1165 | register ptrdiff_t migrate_amt; | 1161 | register ptrdiff_t migrate_amt; |
| 1166 | 1162 | ||
| 1167 | if (NULL_INTERVAL_P (i->left)) | 1163 | if (!i->left) |
| 1168 | return i->right; | 1164 | return i->right; |
| 1169 | if (NULL_INTERVAL_P (i->right)) | 1165 | if (!i->right) |
| 1170 | return i->left; | 1166 | return i->left; |
| 1171 | 1167 | ||
| 1172 | migrate = i->left; | 1168 | migrate = i->left; |
| 1173 | migrate_amt = i->left->total_length; | 1169 | migrate_amt = i->left->total_length; |
| 1174 | this = i->right; | 1170 | this = i->right; |
| 1175 | this->total_length += migrate_amt; | 1171 | this->total_length += migrate_amt; |
| 1176 | while (! NULL_INTERVAL_P (this->left)) | 1172 | while (this->left) |
| 1177 | { | 1173 | { |
| 1178 | this = this->left; | 1174 | this = this->left; |
| 1179 | this->total_length += migrate_amt; | 1175 | this->total_length += migrate_amt; |
| @@ -1204,7 +1200,7 @@ delete_interval (register INTERVAL i) | |||
| 1204 | Lisp_Object owner; | 1200 | Lisp_Object owner; |
| 1205 | GET_INTERVAL_OBJECT (owner, i); | 1201 | GET_INTERVAL_OBJECT (owner, i); |
| 1206 | parent = delete_node (i); | 1202 | parent = delete_node (i); |
| 1207 | if (! NULL_INTERVAL_P (parent)) | 1203 | if (parent) |
| 1208 | interval_set_object (parent, owner); | 1204 | interval_set_object (parent, owner); |
| 1209 | 1205 | ||
| 1210 | if (BUFFERP (owner)) | 1206 | if (BUFFERP (owner)) |
| @@ -1221,13 +1217,13 @@ delete_interval (register INTERVAL i) | |||
| 1221 | if (AM_LEFT_CHILD (i)) | 1217 | if (AM_LEFT_CHILD (i)) |
| 1222 | { | 1218 | { |
| 1223 | interval_set_left (parent, delete_node (i)); | 1219 | interval_set_left (parent, delete_node (i)); |
| 1224 | if (! NULL_INTERVAL_P (parent->left)) | 1220 | if (parent->left) |
| 1225 | interval_set_parent (parent->left, parent); | 1221 | interval_set_parent (parent->left, parent); |
| 1226 | } | 1222 | } |
| 1227 | else | 1223 | else |
| 1228 | { | 1224 | { |
| 1229 | interval_set_right (parent, delete_node (i)); | 1225 | interval_set_right (parent, delete_node (i)); |
| 1230 | if (! NULL_INTERVAL_P (parent->right)) | 1226 | if (parent->right) |
| 1231 | interval_set_parent (parent->right, parent); | 1227 | interval_set_parent (parent->right, parent); |
| 1232 | } | 1228 | } |
| 1233 | } | 1229 | } |
| @@ -1250,7 +1246,7 @@ interval_deletion_adjustment (register INTERVAL tree, register ptrdiff_t from, | |||
| 1250 | { | 1246 | { |
| 1251 | register ptrdiff_t relative_position = from; | 1247 | register ptrdiff_t relative_position = from; |
| 1252 | 1248 | ||
| 1253 | if (NULL_INTERVAL_P (tree)) | 1249 | if (!tree) |
| 1254 | return 0; | 1250 | return 0; |
| 1255 | 1251 | ||
| 1256 | /* Left branch. */ | 1252 | /* Left branch. */ |
| @@ -1317,7 +1313,7 @@ adjust_intervals_for_deletion (struct buffer *buffer, | |||
| 1317 | GET_INTERVAL_OBJECT (parent, tree); | 1313 | GET_INTERVAL_OBJECT (parent, tree); |
| 1318 | offset = (BUFFERP (parent) ? BUF_BEG (XBUFFER (parent)) : 0); | 1314 | offset = (BUFFERP (parent) ? BUF_BEG (XBUFFER (parent)) : 0); |
| 1319 | 1315 | ||
| 1320 | if (NULL_INTERVAL_P (tree)) | 1316 | if (!tree) |
| 1321 | return; | 1317 | return; |
| 1322 | 1318 | ||
| 1323 | eassert (start <= offset + TOTAL_LENGTH (tree) | 1319 | eassert (start <= offset + TOTAL_LENGTH (tree) |
| @@ -1325,7 +1321,7 @@ adjust_intervals_for_deletion (struct buffer *buffer, | |||
| 1325 | 1321 | ||
| 1326 | if (length == TOTAL_LENGTH (tree)) | 1322 | if (length == TOTAL_LENGTH (tree)) |
| 1327 | { | 1323 | { |
| 1328 | BUF_INTERVALS (buffer) = NULL_INTERVAL; | 1324 | BUF_INTERVALS (buffer) = NULL; |
| 1329 | return; | 1325 | return; |
| 1330 | } | 1326 | } |
| 1331 | 1327 | ||
| @@ -1345,7 +1341,7 @@ adjust_intervals_for_deletion (struct buffer *buffer, | |||
| 1345 | tree = BUF_INTERVALS (buffer); | 1341 | tree = BUF_INTERVALS (buffer); |
| 1346 | if (left_to_delete == tree->total_length) | 1342 | if (left_to_delete == tree->total_length) |
| 1347 | { | 1343 | { |
| 1348 | BUF_INTERVALS (buffer) = NULL_INTERVAL; | 1344 | BUF_INTERVALS (buffer) = NULL; |
| 1349 | return; | 1345 | return; |
| 1350 | } | 1346 | } |
| 1351 | } | 1347 | } |
| @@ -1363,7 +1359,7 @@ adjust_intervals_for_deletion (struct buffer *buffer, | |||
| 1363 | void | 1359 | void |
| 1364 | offset_intervals (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length) | 1360 | offset_intervals (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length) |
| 1365 | { | 1361 | { |
| 1366 | if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0) | 1362 | if (!BUF_INTERVALS (buffer) || length == 0) |
| 1367 | return; | 1363 | return; |
| 1368 | 1364 | ||
| 1369 | if (length > 0) | 1365 | if (length > 0) |
| @@ -1580,17 +1576,17 @@ graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position, | |||
| 1580 | becomes part of whatever interval it was inserted into. | 1576 | becomes part of whatever interval it was inserted into. |
| 1581 | To prevent inheritance, we must clear out the properties | 1577 | To prevent inheritance, we must clear out the properties |
| 1582 | of the newly inserted text. */ | 1578 | of the newly inserted text. */ |
| 1583 | if (NULL_INTERVAL_P (source)) | 1579 | if (!source) |
| 1584 | { | 1580 | { |
| 1585 | Lisp_Object buf; | 1581 | Lisp_Object buf; |
| 1586 | if (!inherit && !NULL_INTERVAL_P (tree) && length > 0) | 1582 | if (!inherit && tree && length > 0) |
| 1587 | { | 1583 | { |
| 1588 | XSETBUFFER (buf, buffer); | 1584 | XSETBUFFER (buf, buffer); |
| 1589 | set_text_properties_1 (make_number (position), | 1585 | set_text_properties_1 (make_number (position), |
| 1590 | make_number (position + length), | 1586 | make_number (position + length), |
| 1591 | Qnil, buf, 0); | 1587 | Qnil, buf, 0); |
| 1592 | } | 1588 | } |
| 1593 | if (! NULL_INTERVAL_P (BUF_INTERVALS (buffer))) | 1589 | if (BUF_INTERVALS (buffer)) |
| 1594 | /* Shouldn't be necessary. --Stef */ | 1590 | /* Shouldn't be necessary. --Stef */ |
| 1595 | BUF_INTERVALS (buffer) = balance_an_interval (BUF_INTERVALS (buffer)); | 1591 | BUF_INTERVALS (buffer) = balance_an_interval (BUF_INTERVALS (buffer)); |
| 1596 | return; | 1592 | return; |
| @@ -1608,7 +1604,7 @@ graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position, | |||
| 1608 | eassert (BUF_INTERVALS (buffer)->up_obj == 1); | 1604 | eassert (BUF_INTERVALS (buffer)->up_obj == 1); |
| 1609 | return; | 1605 | return; |
| 1610 | } | 1606 | } |
| 1611 | else if (NULL_INTERVAL_P (tree)) | 1607 | else if (!tree) |
| 1612 | { /* Create an interval tree in which to place a copy | 1608 | { /* Create an interval tree in which to place a copy |
| 1613 | of the intervals of the inserted string. */ | 1609 | of the intervals of the inserted string. */ |
| 1614 | Lisp_Object buf; | 1610 | Lisp_Object buf; |
| @@ -1620,7 +1616,7 @@ graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position, | |||
| 1620 | eassert (TOTAL_LENGTH (tree) > 0); | 1616 | eassert (TOTAL_LENGTH (tree) > 0); |
| 1621 | 1617 | ||
| 1622 | this = under = find_interval (tree, position); | 1618 | this = under = find_interval (tree, position); |
| 1623 | eassert (!NULL_INTERVAL_P (under)); | 1619 | eassert (under); |
| 1624 | over = find_interval (source, interval_start_pos (source)); | 1620 | over = find_interval (source, interval_start_pos (source)); |
| 1625 | 1621 | ||
| 1626 | /* Here for insertion in the middle of an interval. | 1622 | /* Here for insertion in the middle of an interval. |
| @@ -1662,7 +1658,7 @@ graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position, | |||
| 1662 | have already been copied into target intervals. | 1658 | have already been copied into target intervals. |
| 1663 | UNDER is the next interval in the target. */ | 1659 | UNDER is the next interval in the target. */ |
| 1664 | over_used = 0; | 1660 | over_used = 0; |
| 1665 | while (! NULL_INTERVAL_P (over)) | 1661 | while (over) |
| 1666 | { | 1662 | { |
| 1667 | /* If UNDER is longer than OVER, split it. */ | 1663 | /* If UNDER is longer than OVER, split it. */ |
| 1668 | if (LENGTH (over) - over_used < LENGTH (under)) | 1664 | if (LENGTH (over) - over_used < LENGTH (under)) |
| @@ -1695,7 +1691,7 @@ graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position, | |||
| 1695 | under = next_interval (this); | 1691 | under = next_interval (this); |
| 1696 | } | 1692 | } |
| 1697 | 1693 | ||
| 1698 | if (! NULL_INTERVAL_P (BUF_INTERVALS (buffer))) | 1694 | if (BUF_INTERVALS (buffer)) |
| 1699 | BUF_INTERVALS (buffer) = balance_an_interval (BUF_INTERVALS (buffer)); | 1695 | BUF_INTERVALS (buffer) = balance_an_interval (BUF_INTERVALS (buffer)); |
| 1700 | return; | 1696 | return; |
| 1701 | } | 1697 | } |
| @@ -1864,7 +1860,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos) | |||
| 1864 | 1860 | ||
| 1865 | /* If we have no text properties and overlays, | 1861 | /* If we have no text properties and overlays, |
| 1866 | then we can do it quickly. */ | 1862 | then we can do it quickly. */ |
| 1867 | if (NULL_INTERVAL_P (BUF_INTERVALS (current_buffer)) && ! have_overlays) | 1863 | if (!BUF_INTERVALS (current_buffer) && ! have_overlays) |
| 1868 | { | 1864 | { |
| 1869 | temp_set_point_both (current_buffer, charpos, bytepos); | 1865 | temp_set_point_both (current_buffer, charpos, bytepos); |
| 1870 | return; | 1866 | return; |
| @@ -1911,7 +1907,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos) | |||
| 1911 | with the same intangible property value, | 1907 | with the same intangible property value, |
| 1912 | move forward or backward until a change in that property. */ | 1908 | move forward or backward until a change in that property. */ |
| 1913 | if (NILP (Vinhibit_point_motion_hooks) | 1909 | if (NILP (Vinhibit_point_motion_hooks) |
| 1914 | && ((! NULL_INTERVAL_P (to) && ! NULL_INTERVAL_P (toprev)) | 1910 | && ((to && toprev) |
| 1915 | || have_overlays) | 1911 | || have_overlays) |
| 1916 | /* Intangibility never stops us from positioning at the beginning | 1912 | /* Intangibility never stops us from positioning at the beginning |
| 1917 | or end of the buffer, so don't bother checking in that case. */ | 1913 | or end of the buffer, so don't bother checking in that case. */ |
| @@ -2134,7 +2130,7 @@ get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val, | |||
| 2134 | else | 2130 | else |
| 2135 | abort (); | 2131 | abort (); |
| 2136 | 2132 | ||
| 2137 | if (NULL_INTERVAL_P (i) || (i->position + LENGTH (i) <= pos)) | 2133 | if (!i || (i->position + LENGTH (i) <= pos)) |
| 2138 | return 0; | 2134 | return 0; |
| 2139 | *val = textget (i->plist, prop); | 2135 | *val = textget (i->plist, prop); |
| 2140 | if (NILP (*val)) | 2136 | if (NILP (*val)) |
| @@ -2142,14 +2138,13 @@ get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val, | |||
| 2142 | 2138 | ||
| 2143 | next = i; /* remember it in advance */ | 2139 | next = i; /* remember it in advance */ |
| 2144 | prev = previous_interval (i); | 2140 | prev = previous_interval (i); |
| 2145 | while (! NULL_INTERVAL_P (prev) | 2141 | while (prev |
| 2146 | && EQ (*val, textget (prev->plist, prop))) | 2142 | && EQ (*val, textget (prev->plist, prop))) |
| 2147 | i = prev, prev = previous_interval (prev); | 2143 | i = prev, prev = previous_interval (prev); |
| 2148 | *start = i->position; | 2144 | *start = i->position; |
| 2149 | 2145 | ||
| 2150 | next = next_interval (i); | 2146 | next = next_interval (i); |
| 2151 | while (! NULL_INTERVAL_P (next) | 2147 | while (next && EQ (*val, textget (next->plist, prop))) |
| 2152 | && EQ (*val, textget (next->plist, prop))) | ||
| 2153 | i = next, next = next_interval (next); | 2148 | i = next, next = next_interval (next); |
| 2154 | *end = i->position + LENGTH (i); | 2149 | *end = i->position + LENGTH (i); |
| 2155 | 2150 | ||
| @@ -2220,16 +2215,16 @@ copy_intervals (INTERVAL tree, ptrdiff_t start, ptrdiff_t length) | |||
| 2220 | register INTERVAL i, new, t; | 2215 | register INTERVAL i, new, t; |
| 2221 | register ptrdiff_t got, prevlen; | 2216 | register ptrdiff_t got, prevlen; |
| 2222 | 2217 | ||
| 2223 | if (NULL_INTERVAL_P (tree) || length <= 0) | 2218 | if (!tree || length <= 0) |
| 2224 | return NULL_INTERVAL; | 2219 | return NULL; |
| 2225 | 2220 | ||
| 2226 | i = find_interval (tree, start); | 2221 | i = find_interval (tree, start); |
| 2227 | eassert (!NULL_INTERVAL_P (i) && LENGTH (i) > 0); | 2222 | eassert (i && LENGTH (i) > 0); |
| 2228 | 2223 | ||
| 2229 | /* If there is only one interval and it's the default, return nil. */ | 2224 | /* If there is only one interval and it's the default, return nil. */ |
| 2230 | if ((start - i->position + 1 + length) < LENGTH (i) | 2225 | if ((start - i->position + 1 + length) < LENGTH (i) |
| 2231 | && DEFAULT_INTERVAL_P (i)) | 2226 | && DEFAULT_INTERVAL_P (i)) |
| 2232 | return NULL_INTERVAL; | 2227 | return NULL; |
| 2233 | 2228 | ||
| 2234 | new = make_interval (); | 2229 | new = make_interval (); |
| 2235 | new->position = 0; | 2230 | new->position = 0; |
| @@ -2260,7 +2255,7 @@ copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, | |||
| 2260 | { | 2255 | { |
| 2261 | INTERVAL interval_copy = copy_intervals (BUF_INTERVALS (buffer), | 2256 | INTERVAL interval_copy = copy_intervals (BUF_INTERVALS (buffer), |
| 2262 | position, length); | 2257 | position, length); |
| 2263 | if (NULL_INTERVAL_P (interval_copy)) | 2258 | if (!interval_copy) |
| 2264 | return; | 2259 | return; |
| 2265 | 2260 | ||
| 2266 | interval_set_object (interval_copy, string); | 2261 | interval_set_object (interval_copy, string); |
diff --git a/src/intervals.h b/src/intervals.h index fa9fe8d6fdb..b50016eeb59 100644 --- a/src/intervals.h +++ b/src/intervals.h | |||
| @@ -20,9 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 20 | ||
| 21 | INLINE_HEADER_BEGIN | 21 | INLINE_HEADER_BEGIN |
| 22 | 22 | ||
| 23 | #define NULL_INTERVAL ((INTERVAL)0) | ||
| 24 | #define INTERVAL_DEFAULT NULL_INTERVAL | ||
| 25 | |||
| 26 | /* Basic data type for use of intervals. */ | 23 | /* Basic data type for use of intervals. */ |
| 27 | 24 | ||
| 28 | struct interval | 25 | struct interval |
| @@ -63,28 +60,25 @@ struct interval | |||
| 63 | 60 | ||
| 64 | /* These are macros for dealing with the interval tree. */ | 61 | /* These are macros for dealing with the interval tree. */ |
| 65 | 62 | ||
| 66 | #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL) | ||
| 67 | |||
| 68 | /* True if this interval has no right child. */ | 63 | /* True if this interval has no right child. */ |
| 69 | #define NULL_RIGHT_CHILD(i) ((i)->right == NULL_INTERVAL) | 64 | #define NULL_RIGHT_CHILD(i) ((i)->right == NULL) |
| 70 | 65 | ||
| 71 | /* True if this interval has no left child. */ | 66 | /* True if this interval has no left child. */ |
| 72 | #define NULL_LEFT_CHILD(i) ((i)->left == NULL_INTERVAL) | 67 | #define NULL_LEFT_CHILD(i) ((i)->left == NULL) |
| 73 | 68 | ||
| 74 | /* True if this interval has no parent. */ | 69 | /* True if this interval has no parent. */ |
| 75 | #define NULL_PARENT(i) ((i)->up_obj || (i)->up.interval == 0) | 70 | #define NULL_PARENT(i) ((i)->up_obj || (i)->up.interval == 0) |
| 76 | 71 | ||
| 77 | /* True if this interval is the left child of some other interval. */ | 72 | /* True if this interval is the left child of some other interval. */ |
| 78 | #define AM_LEFT_CHILD(i) (! NULL_PARENT (i) \ | 73 | #define AM_LEFT_CHILD(i) \ |
| 79 | && INTERVAL_PARENT (i)->left == (i)) | 74 | (! NULL_PARENT (i) && INTERVAL_PARENT (i)->left == (i)) |
| 80 | 75 | ||
| 81 | /* True if this interval is the right child of some other interval. */ | 76 | /* True if this interval is the right child of some other interval. */ |
| 82 | #define AM_RIGHT_CHILD(i) (! NULL_PARENT (i) \ | 77 | #define AM_RIGHT_CHILD(i) \ |
| 83 | && INTERVAL_PARENT (i)->right == (i)) | 78 | (! NULL_PARENT (i) && INTERVAL_PARENT (i)->right == (i)) |
| 84 | 79 | ||
| 85 | /* True if this interval has no children. */ | 80 | /* True if this interval has no children. */ |
| 86 | #define LEAF_INTERVAL_P(i) ((i)->left == NULL_INTERVAL \ | 81 | #define LEAF_INTERVAL_P(i) ((i)->left == NULL && (i)->right == NULL) |
| 87 | && (i)->right == NULL_INTERVAL) | ||
| 88 | 82 | ||
| 89 | /* True if this interval has no parent and is therefore the root. */ | 83 | /* True if this interval has no parent and is therefore the root. */ |
| 90 | #define ROOT_INTERVAL_P(i) (NULL_PARENT (i)) | 84 | #define ROOT_INTERVAL_P(i) (NULL_PARENT (i)) |
| @@ -93,17 +87,16 @@ struct interval | |||
| 93 | #define ONLY_INTERVAL_P(i) (ROOT_INTERVAL_P ((i)) && LEAF_INTERVAL_P ((i))) | 87 | #define ONLY_INTERVAL_P(i) (ROOT_INTERVAL_P ((i)) && LEAF_INTERVAL_P ((i))) |
| 94 | 88 | ||
| 95 | /* True if this interval has both left and right children. */ | 89 | /* True if this interval has both left and right children. */ |
| 96 | #define BOTH_KIDS_P(i) ((i)->left != NULL_INTERVAL \ | 90 | #define BOTH_KIDS_P(i) ((i)->left != NULL && (i)->right != NULL) |
| 97 | && (i)->right != NULL_INTERVAL) | ||
| 98 | 91 | ||
| 99 | /* The total size of all text represented by this interval and all its | 92 | /* The total size of all text represented by this interval and all its |
| 100 | children in the tree. This is zero if the interval is null. */ | 93 | children in the tree. This is zero if the interval is null. */ |
| 101 | #define TOTAL_LENGTH(i) ((i) == NULL_INTERVAL ? 0 : (i)->total_length) | 94 | #define TOTAL_LENGTH(i) ((i) == NULL ? 0 : (i)->total_length) |
| 102 | 95 | ||
| 103 | /* The size of text represented by this interval alone. */ | 96 | /* The size of text represented by this interval alone. */ |
| 104 | #define LENGTH(i) ((i) == NULL_INTERVAL ? 0 : (TOTAL_LENGTH ((i)) \ | 97 | #define LENGTH(i) ((i) == NULL ? 0 : (TOTAL_LENGTH ((i)) \ |
| 105 | - TOTAL_LENGTH ((i)->right) \ | 98 | - TOTAL_LENGTH ((i)->right) \ |
| 106 | - TOTAL_LENGTH ((i)->left))) | 99 | - TOTAL_LENGTH ((i)->left))) |
| 107 | 100 | ||
| 108 | /* The position of the character just past the end of I. Note that | 101 | /* The position of the character just past the end of I. Note that |
| 109 | the position cache i->position must be valid for this to work. */ | 102 | the position cache i->position must be valid for this to work. */ |
| @@ -115,15 +108,14 @@ struct interval | |||
| 115 | /* The total size of the right subtree of this interval. */ | 108 | /* The total size of the right subtree of this interval. */ |
| 116 | #define RIGHT_TOTAL_LENGTH(i) ((i)->right ? (i)->right->total_length : 0) | 109 | #define RIGHT_TOTAL_LENGTH(i) ((i)->right ? (i)->right->total_length : 0) |
| 117 | 110 | ||
| 118 | |||
| 119 | /* These macros are for dealing with the interval properties. */ | 111 | /* These macros are for dealing with the interval properties. */ |
| 120 | 112 | ||
| 121 | /* True if this is a default interval, which is the same as being null | 113 | /* True if this is a default interval, which is the same as being null |
| 122 | or having no properties. */ | 114 | or having no properties. */ |
| 123 | #define DEFAULT_INTERVAL_P(i) (NULL_INTERVAL_P (i) || EQ ((i)->plist, Qnil)) | 115 | #define DEFAULT_INTERVAL_P(i) (!i || EQ ((i)->plist, Qnil)) |
| 124 | 116 | ||
| 125 | /* Test what type of parent we have. Three possibilities: another | 117 | /* Test what type of parent we have. Three possibilities: another |
| 126 | interval, a buffer or string object, or NULL_INTERVAL. */ | 118 | interval, a buffer or string object, or NULL. */ |
| 127 | #define INTERVAL_HAS_PARENT(i) ((i)->up_obj == 0 && (i)->up.interval != 0) | 119 | #define INTERVAL_HAS_PARENT(i) ((i)->up_obj == 0 && (i)->up.interval != 0) |
| 128 | #define INTERVAL_HAS_OBJECT(i) ((i)->up_obj) | 120 | #define INTERVAL_HAS_OBJECT(i) ((i)->up_obj) |
| 129 | 121 | ||
| @@ -187,7 +179,7 @@ interval_copy_parent (INTERVAL d, INTERVAL s) | |||
| 187 | 179 | ||
| 188 | /* Get the parent interval, if any, otherwise a null pointer. Useful | 180 | /* Get the parent interval, if any, otherwise a null pointer. Useful |
| 189 | for walking up to the root in a "for" loop; use this to get the | 181 | for walking up to the root in a "for" loop; use this to get the |
| 190 | "next" value, and test the result to see if it's NULL_INTERVAL. */ | 182 | "next" value, and test the result to see if it's NULL. */ |
| 191 | #define INTERVAL_PARENT_OR_NULL(i) \ | 183 | #define INTERVAL_PARENT_OR_NULL(i) \ |
| 192 | (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) | 184 | (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) |
| 193 | 185 | ||
| @@ -195,8 +187,8 @@ interval_copy_parent (INTERVAL d, INTERVAL s) | |||
| 195 | #define RESET_INTERVAL(i) \ | 187 | #define RESET_INTERVAL(i) \ |
| 196 | { \ | 188 | { \ |
| 197 | (i)->total_length = (i)->position = 0; \ | 189 | (i)->total_length = (i)->position = 0; \ |
| 198 | (i)->left = (i)->right = NULL_INTERVAL; \ | 190 | (i)->left = (i)->right = NULL; \ |
| 199 | interval_set_parent (i, NULL_INTERVAL); \ | 191 | interval_set_parent (i, NULL); \ |
| 200 | (i)->write_protect = 0; \ | 192 | (i)->write_protect = 0; \ |
| 201 | (i)->visible = 0; \ | 193 | (i)->visible = 0; \ |
| 202 | (i)->front_sticky = (i)->rear_sticky = 0; \ | 194 | (i)->front_sticky = (i)->rear_sticky = 0; \ |
| @@ -232,39 +224,36 @@ interval_copy_parent (INTERVAL d, INTERVAL s) | |||
| 232 | 224 | ||
| 233 | /* Is this interval visible? Replace later with cache access. */ | 225 | /* Is this interval visible? Replace later with cache access. */ |
| 234 | #define INTERVAL_VISIBLE_P(i) \ | 226 | #define INTERVAL_VISIBLE_P(i) \ |
| 235 | (! NULL_INTERVAL_P (i) && NILP (textget ((i)->plist, Qinvisible))) | 227 | (i && NILP (textget ((i)->plist, Qinvisible))) |
| 236 | 228 | ||
| 237 | /* Is this interval writable? Replace later with cache access. */ | 229 | /* Is this interval writable? Replace later with cache access. */ |
| 238 | #define INTERVAL_WRITABLE_P(i) \ | 230 | #define INTERVAL_WRITABLE_P(i) \ |
| 239 | (! NULL_INTERVAL_P (i) \ | 231 | (i && (NILP (textget ((i)->plist, Qread_only)) \ |
| 240 | && (NILP (textget ((i)->plist, Qread_only)) \ | 232 | || ((CONSP (Vinhibit_read_only) \ |
| 241 | || ((CONSP (Vinhibit_read_only) \ | 233 | ? !NILP (Fmemq (textget ((i)->plist, Qread_only), \ |
| 242 | ? !NILP (Fmemq (textget ((i)->plist, Qread_only), \ | 234 | Vinhibit_read_only)) \ |
| 243 | Vinhibit_read_only)) \ | 235 | : !NILP (Vinhibit_read_only))))) \ |
| 244 | : !NILP (Vinhibit_read_only))))) \ | ||
| 245 | 236 | ||
| 246 | /* Macros to tell whether insertions before or after this interval | 237 | /* Macros to tell whether insertions before or after this interval |
| 247 | should stick to it. */ | 238 | should stick to it. Now we have Vtext_property_default_nonsticky, |
| 248 | /* Replace later with cache access */ | 239 | so these macros are unreliable now and never used. */ |
| 249 | /*#define FRONT_STICKY_P(i) ((i)->front_sticky != 0) | 240 | |
| 250 | #define END_STICKY_P(i) ((i)->rear_sticky != 0)*/ | 241 | #if 0 |
| 251 | /* As we now have Vtext_property_default_nonsticky, these macros are | 242 | #define FRONT_STICKY_P(i) \ |
| 252 | unreliable now. Currently, they are never used. */ | 243 | (i && ! NILP (textget ((i)->plist, Qfront_sticky))) |
| 253 | #define FRONT_STICKY_P(i) \ | 244 | #define END_NONSTICKY_P(i) \ |
| 254 | (! NULL_INTERVAL_P (i) && ! NILP (textget ((i)->plist, Qfront_sticky))) | 245 | (i && ! NILP (textget ((i)->plist, Qrear_nonsticky))) |
| 255 | #define END_NONSTICKY_P(i) \ | 246 | #define FRONT_NONSTICKY_P(i) \ |
| 256 | (! NULL_INTERVAL_P (i) && ! NILP (textget ((i)->plist, Qrear_nonsticky))) | 247 | (i && ! EQ (Qt, textget ((i)->plist, Qfront_sticky))) |
| 257 | #define FRONT_NONSTICKY_P(i) \ | 248 | #endif |
| 258 | (! NULL_INTERVAL_P (i) && ! EQ (Qt, textget ((i)->plist, Qfront_sticky))) | ||
| 259 | |||
| 260 | 249 | ||
| 261 | /* If PROP is the `invisible' property of a character, | 250 | /* If PROP is the `invisible' property of a character, |
| 262 | this is 1 if the character should be treated as invisible, | 251 | this is 1 if the character should be treated as invisible, |
| 263 | and 2 if it is invisible but with an ellipsis. */ | 252 | and 2 if it is invisible but with an ellipsis. */ |
| 264 | 253 | ||
| 265 | #define TEXT_PROP_MEANS_INVISIBLE(prop) \ | 254 | #define TEXT_PROP_MEANS_INVISIBLE(prop) \ |
| 266 | (EQ (BVAR (current_buffer, invisibility_spec), Qt) \ | 255 | (EQ (BVAR (current_buffer, invisibility_spec), Qt) \ |
| 267 | ? !NILP (prop) \ | 256 | ? !NILP (prop) \ |
| 268 | : invisible_p (prop, BVAR (current_buffer, invisibility_spec))) | 257 | : invisible_p (prop, BVAR (current_buffer, invisibility_spec))) |
| 269 | 258 | ||
| 270 | /* Declared in alloc.c. */ | 259 | /* Declared in alloc.c. */ |
diff --git a/src/print.c b/src/print.c index 4a8c3fda319..1e9f237ee82 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1408,7 +1408,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1408 | if (! EQ (Vprint_charset_text_property, Qt)) | 1408 | if (! EQ (Vprint_charset_text_property, Qt)) |
| 1409 | obj = print_prune_string_charset (obj); | 1409 | obj = print_prune_string_charset (obj); |
| 1410 | 1410 | ||
| 1411 | if (!NULL_INTERVAL_P (STRING_INTERVALS (obj))) | 1411 | if (STRING_INTERVALS (obj)) |
| 1412 | { | 1412 | { |
| 1413 | PRINTCHAR ('#'); | 1413 | PRINTCHAR ('#'); |
| 1414 | PRINTCHAR ('('); | 1414 | PRINTCHAR ('('); |
| @@ -1499,7 +1499,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1499 | } | 1499 | } |
| 1500 | PRINTCHAR ('\"'); | 1500 | PRINTCHAR ('\"'); |
| 1501 | 1501 | ||
| 1502 | if (!NULL_INTERVAL_P (STRING_INTERVALS (obj))) | 1502 | if (STRING_INTERVALS (obj)) |
| 1503 | { | 1503 | { |
| 1504 | traverse_intervals (STRING_INTERVALS (obj), | 1504 | traverse_intervals (STRING_INTERVALS (obj), |
| 1505 | 0, print_interval, printcharfun); | 1505 | 0, print_interval, printcharfun); |
diff --git a/src/syntax.c b/src/syntax.c index 1299d2e9931..c031c2b07af 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -171,7 +171,7 @@ struct gl_state_s gl_state; /* Global state of syntax parser. */ | |||
| 171 | direction than the intervals - or in an interval. We update the | 171 | direction than the intervals - or in an interval. We update the |
| 172 | current syntax-table basing on the property of this interval, and | 172 | current syntax-table basing on the property of this interval, and |
| 173 | update the interval to start further than CHARPOS - or be | 173 | update the interval to start further than CHARPOS - or be |
| 174 | NULL_INTERVAL. We also update lim_property to be the next value of | 174 | NULL. We also update lim_property to be the next value of |
| 175 | charpos to call this subroutine again - or be before/after the | 175 | charpos to call this subroutine again - or be before/after the |
| 176 | start/end of OBJECT. */ | 176 | start/end of OBJECT. */ |
| 177 | 177 | ||
| @@ -192,7 +192,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init, | |||
| 192 | i = interval_of (charpos, object); | 192 | i = interval_of (charpos, object); |
| 193 | gl_state.backward_i = gl_state.forward_i = i; | 193 | gl_state.backward_i = gl_state.forward_i = i; |
| 194 | invalidate = 0; | 194 | invalidate = 0; |
| 195 | if (NULL_INTERVAL_P (i)) | 195 | if (!i) |
| 196 | return; | 196 | return; |
| 197 | /* interval_of updates only ->position of the return value, so | 197 | /* interval_of updates only ->position of the return value, so |
| 198 | update the parents manually to speed up update_interval. */ | 198 | update the parents manually to speed up update_interval. */ |
| @@ -217,7 +217,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init, | |||
| 217 | 217 | ||
| 218 | /* We are guaranteed to be called with CHARPOS either in i, | 218 | /* We are guaranteed to be called with CHARPOS either in i, |
| 219 | or further off. */ | 219 | or further off. */ |
| 220 | if (NULL_INTERVAL_P (i)) | 220 | if (!i) |
| 221 | error ("Error in syntax_table logic for to-the-end intervals"); | 221 | error ("Error in syntax_table logic for to-the-end intervals"); |
| 222 | else if (charpos < i->position) /* Move left. */ | 222 | else if (charpos < i->position) /* Move left. */ |
| 223 | { | 223 | { |
| @@ -287,7 +287,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init, | |||
| 287 | } | 287 | } |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | while (!NULL_INTERVAL_P (i)) | 290 | while (i) |
| 291 | { | 291 | { |
| 292 | if (cnt && !EQ (tmp_table, textget (i->plist, Qsyntax_table))) | 292 | if (cnt && !EQ (tmp_table, textget (i->plist, Qsyntax_table))) |
| 293 | { | 293 | { |
| @@ -313,7 +313,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init, | |||
| 313 | /* e_property at EOB is not set to ZV but to ZV+1, so that | 313 | /* e_property at EOB is not set to ZV but to ZV+1, so that |
| 314 | we can do INC(from);UPDATE_SYNTAX_TABLE_FORWARD without | 314 | we can do INC(from);UPDATE_SYNTAX_TABLE_FORWARD without |
| 315 | having to check eob between the two. */ | 315 | having to check eob between the two. */ |
| 316 | + (NULL_INTERVAL_P (next_interval (i)) ? 1 : 0); | 316 | + (next_interval (i) ? 0 : 1); |
| 317 | gl_state.forward_i = i; | 317 | gl_state.forward_i = i; |
| 318 | } | 318 | } |
| 319 | else | 319 | else |
| @@ -326,7 +326,7 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init, | |||
| 326 | cnt++; | 326 | cnt++; |
| 327 | i = count > 0 ? next_interval (i) : previous_interval (i); | 327 | i = count > 0 ? next_interval (i) : previous_interval (i); |
| 328 | } | 328 | } |
| 329 | eassert (NULL_INTERVAL_P (i)); /* This property goes to the end. */ | 329 | eassert (i == NULL); /* This property goes to the end. */ |
| 330 | if (count > 0) | 330 | if (count > 0) |
| 331 | gl_state.e_property = gl_state.stop; | 331 | gl_state.e_property = gl_state.stop; |
| 332 | else | 332 | else |
diff --git a/src/textprop.c b/src/textprop.c index 5b390fbfe08..1ec1ab11d2e 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -105,7 +105,7 @@ text_read_only (Lisp_Object propval) | |||
| 105 | Fprevious_property_change which call this function with BEGIN == END. | 105 | Fprevious_property_change which call this function with BEGIN == END. |
| 106 | Handle this case specially. | 106 | Handle this case specially. |
| 107 | 107 | ||
| 108 | If FORCE is soft (0), it's OK to return NULL_INTERVAL. Otherwise, | 108 | If FORCE is soft (0), it's OK to return NULL. Otherwise, |
| 109 | create an interval tree for OBJECT if one doesn't exist, provided | 109 | create an interval tree for OBJECT if one doesn't exist, provided |
| 110 | the object actually contains text. In the current design, if there | 110 | the object actually contains text. In the current design, if there |
| 111 | is no text, there can be no text properties. */ | 111 | is no text, there can be no text properties. */ |
| @@ -126,7 +126,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en | |||
| 126 | /* If we are asked for a point, but from a subr which operates | 126 | /* If we are asked for a point, but from a subr which operates |
| 127 | on a range, then return nothing. */ | 127 | on a range, then return nothing. */ |
| 128 | if (EQ (*begin, *end) && begin != end) | 128 | if (EQ (*begin, *end) && begin != end) |
| 129 | return NULL_INTERVAL; | 129 | return NULL; |
| 130 | 130 | ||
| 131 | if (XINT (*begin) > XINT (*end)) | 131 | if (XINT (*begin) > XINT (*end)) |
| 132 | { | 132 | { |
| @@ -147,7 +147,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en | |||
| 147 | 147 | ||
| 148 | /* If there's no text, there are no properties. */ | 148 | /* If there's no text, there are no properties. */ |
| 149 | if (BUF_BEGV (b) == BUF_ZV (b)) | 149 | if (BUF_BEGV (b) == BUF_ZV (b)) |
| 150 | return NULL_INTERVAL; | 150 | return NULL; |
| 151 | 151 | ||
| 152 | searchpos = XINT (*begin); | 152 | searchpos = XINT (*begin); |
| 153 | } | 153 | } |
| @@ -164,12 +164,12 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en | |||
| 164 | i = STRING_INTERVALS (object); | 164 | i = STRING_INTERVALS (object); |
| 165 | 165 | ||
| 166 | if (len == 0) | 166 | if (len == 0) |
| 167 | return NULL_INTERVAL; | 167 | return NULL; |
| 168 | 168 | ||
| 169 | searchpos = XINT (*begin); | 169 | searchpos = XINT (*begin); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | if (NULL_INTERVAL_P (i)) | 172 | if (!i) |
| 173 | return (force ? create_root_interval (object) : i); | 173 | return (force ? create_root_interval (object) : i); |
| 174 | 174 | ||
| 175 | return find_interval (i, searchpos); | 175 | return find_interval (i, searchpos); |
| @@ -500,7 +500,7 @@ interval_of (ptrdiff_t position, Lisp_Object object) | |||
| 500 | if (NILP (object)) | 500 | if (NILP (object)) |
| 501 | XSETBUFFER (object, current_buffer); | 501 | XSETBUFFER (object, current_buffer); |
| 502 | else if (EQ (object, Qt)) | 502 | else if (EQ (object, Qt)) |
| 503 | return NULL_INTERVAL; | 503 | return NULL; |
| 504 | 504 | ||
| 505 | CHECK_STRING_OR_BUFFER (object); | 505 | CHECK_STRING_OR_BUFFER (object); |
| 506 | 506 | ||
| @@ -521,8 +521,8 @@ interval_of (ptrdiff_t position, Lisp_Object object) | |||
| 521 | 521 | ||
| 522 | if (!(beg <= position && position <= end)) | 522 | if (!(beg <= position && position <= end)) |
| 523 | args_out_of_range (make_number (position), make_number (position)); | 523 | args_out_of_range (make_number (position), make_number (position)); |
| 524 | if (beg == end || NULL_INTERVAL_P (i)) | 524 | if (beg == end || !i) |
| 525 | return NULL_INTERVAL; | 525 | return NULL; |
| 526 | 526 | ||
| 527 | return find_interval (i, position); | 527 | return find_interval (i, position); |
| 528 | } | 528 | } |
| @@ -542,7 +542,7 @@ If POSITION is at the end of OBJECT, the value is nil. */) | |||
| 542 | XSETBUFFER (object, current_buffer); | 542 | XSETBUFFER (object, current_buffer); |
| 543 | 543 | ||
| 544 | i = validate_interval_range (object, &position, &position, soft); | 544 | i = validate_interval_range (object, &position, &position, soft); |
| 545 | if (NULL_INTERVAL_P (i)) | 545 | if (!i) |
| 546 | return Qnil; | 546 | return Qnil; |
| 547 | /* If POSITION is at the end of the interval, | 547 | /* If POSITION is at the end of the interval, |
| 548 | it means it's the end of OBJECT. | 548 | it means it's the end of OBJECT. |
| @@ -922,12 +922,12 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 922 | bother checking further intervals. */ | 922 | bother checking further intervals. */ |
| 923 | if (EQ (limit, Qt)) | 923 | if (EQ (limit, Qt)) |
| 924 | { | 924 | { |
| 925 | if (NULL_INTERVAL_P (i)) | 925 | if (!i) |
| 926 | next = i; | 926 | next = i; |
| 927 | else | 927 | else |
| 928 | next = next_interval (i); | 928 | next = next_interval (i); |
| 929 | 929 | ||
| 930 | if (NULL_INTERVAL_P (next)) | 930 | if (!next) |
| 931 | XSETFASTINT (position, (STRINGP (object) | 931 | XSETFASTINT (position, (STRINGP (object) |
| 932 | ? SCHARS (object) | 932 | ? SCHARS (object) |
| 933 | : BUF_ZV (XBUFFER (object)))); | 933 | : BUF_ZV (XBUFFER (object)))); |
| @@ -936,16 +936,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 936 | return position; | 936 | return position; |
| 937 | } | 937 | } |
| 938 | 938 | ||
| 939 | if (NULL_INTERVAL_P (i)) | 939 | if (!i) |
| 940 | return limit; | 940 | return limit; |
| 941 | 941 | ||
| 942 | next = next_interval (i); | 942 | next = next_interval (i); |
| 943 | 943 | ||
| 944 | while (!NULL_INTERVAL_P (next) && intervals_equal (i, next) | 944 | while (next && intervals_equal (i, next) |
| 945 | && (NILP (limit) || next->position < XFASTINT (limit))) | 945 | && (NILP (limit) || next->position < XFASTINT (limit))) |
| 946 | next = next_interval (next); | 946 | next = next_interval (next); |
| 947 | 947 | ||
| 948 | if (NULL_INTERVAL_P (next) | 948 | if (!next |
| 949 | || (next->position | 949 | || (next->position |
| 950 | >= (INTEGERP (limit) | 950 | >= (INTEGERP (limit) |
| 951 | ? XFASTINT (limit) | 951 | ? XFASTINT (limit) |
| @@ -983,17 +983,17 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 983 | CHECK_NUMBER_COERCE_MARKER (limit); | 983 | CHECK_NUMBER_COERCE_MARKER (limit); |
| 984 | 984 | ||
| 985 | i = validate_interval_range (object, &position, &position, soft); | 985 | i = validate_interval_range (object, &position, &position, soft); |
| 986 | if (NULL_INTERVAL_P (i)) | 986 | if (!i) |
| 987 | return limit; | 987 | return limit; |
| 988 | 988 | ||
| 989 | here_val = textget (i->plist, prop); | 989 | here_val = textget (i->plist, prop); |
| 990 | next = next_interval (i); | 990 | next = next_interval (i); |
| 991 | while (! NULL_INTERVAL_P (next) | 991 | while (next |
| 992 | && EQ (here_val, textget (next->plist, prop)) | 992 | && EQ (here_val, textget (next->plist, prop)) |
| 993 | && (NILP (limit) || next->position < XFASTINT (limit))) | 993 | && (NILP (limit) || next->position < XFASTINT (limit))) |
| 994 | next = next_interval (next); | 994 | next = next_interval (next); |
| 995 | 995 | ||
| 996 | if (NULL_INTERVAL_P (next) | 996 | if (!next |
| 997 | || (next->position | 997 | || (next->position |
| 998 | >= (INTEGERP (limit) | 998 | >= (INTEGERP (limit) |
| 999 | ? XFASTINT (limit) | 999 | ? XFASTINT (limit) |
| @@ -1029,7 +1029,7 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) | |||
| 1029 | CHECK_NUMBER_COERCE_MARKER (limit); | 1029 | CHECK_NUMBER_COERCE_MARKER (limit); |
| 1030 | 1030 | ||
| 1031 | i = validate_interval_range (object, &position, &position, soft); | 1031 | i = validate_interval_range (object, &position, &position, soft); |
| 1032 | if (NULL_INTERVAL_P (i)) | 1032 | if (!i) |
| 1033 | return limit; | 1033 | return limit; |
| 1034 | 1034 | ||
| 1035 | /* Start with the interval containing the char before point. */ | 1035 | /* Start with the interval containing the char before point. */ |
| @@ -1037,12 +1037,12 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) | |||
| 1037 | i = previous_interval (i); | 1037 | i = previous_interval (i); |
| 1038 | 1038 | ||
| 1039 | previous = previous_interval (i); | 1039 | previous = previous_interval (i); |
| 1040 | while (!NULL_INTERVAL_P (previous) && intervals_equal (previous, i) | 1040 | while (previous && intervals_equal (previous, i) |
| 1041 | && (NILP (limit) | 1041 | && (NILP (limit) |
| 1042 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) | 1042 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) |
| 1043 | previous = previous_interval (previous); | 1043 | previous = previous_interval (previous); |
| 1044 | 1044 | ||
| 1045 | if (NULL_INTERVAL_P (previous) | 1045 | if (!previous |
| 1046 | || (previous->position + LENGTH (previous) | 1046 | || (previous->position + LENGTH (previous) |
| 1047 | <= (INTEGERP (limit) | 1047 | <= (INTEGERP (limit) |
| 1048 | ? XFASTINT (limit) | 1048 | ? XFASTINT (limit) |
| @@ -1080,21 +1080,21 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) | |||
| 1080 | i = validate_interval_range (object, &position, &position, soft); | 1080 | i = validate_interval_range (object, &position, &position, soft); |
| 1081 | 1081 | ||
| 1082 | /* Start with the interval containing the char before point. */ | 1082 | /* Start with the interval containing the char before point. */ |
| 1083 | if (!NULL_INTERVAL_P (i) && i->position == XFASTINT (position)) | 1083 | if (i && i->position == XFASTINT (position)) |
| 1084 | i = previous_interval (i); | 1084 | i = previous_interval (i); |
| 1085 | 1085 | ||
| 1086 | if (NULL_INTERVAL_P (i)) | 1086 | if (!i) |
| 1087 | return limit; | 1087 | return limit; |
| 1088 | 1088 | ||
| 1089 | here_val = textget (i->plist, prop); | 1089 | here_val = textget (i->plist, prop); |
| 1090 | previous = previous_interval (i); | 1090 | previous = previous_interval (i); |
| 1091 | while (!NULL_INTERVAL_P (previous) | 1091 | while (previous |
| 1092 | && EQ (here_val, textget (previous->plist, prop)) | 1092 | && EQ (here_val, textget (previous->plist, prop)) |
| 1093 | && (NILP (limit) | 1093 | && (NILP (limit) |
| 1094 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) | 1094 | || (previous->position + LENGTH (previous) > XFASTINT (limit)))) |
| 1095 | previous = previous_interval (previous); | 1095 | previous = previous_interval (previous); |
| 1096 | 1096 | ||
| 1097 | if (NULL_INTERVAL_P (previous) | 1097 | if (!previous |
| 1098 | || (previous->position + LENGTH (previous) | 1098 | || (previous->position + LENGTH (previous) |
| 1099 | <= (INTEGERP (limit) | 1099 | <= (INTEGERP (limit) |
| 1100 | ? XFASTINT (limit) | 1100 | ? XFASTINT (limit) |
| @@ -1130,7 +1130,7 @@ Return t if any property value actually changed, nil otherwise. */) | |||
| 1130 | XSETBUFFER (object, current_buffer); | 1130 | XSETBUFFER (object, current_buffer); |
| 1131 | 1131 | ||
| 1132 | i = validate_interval_range (object, &start, &end, hard); | 1132 | i = validate_interval_range (object, &start, &end, hard); |
| 1133 | if (NULL_INTERVAL_P (i)) | 1133 | if (!i) |
| 1134 | return Qnil; | 1134 | return Qnil; |
| 1135 | 1135 | ||
| 1136 | s = XINT (start); | 1136 | s = XINT (start); |
| @@ -1277,13 +1277,13 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, | |||
| 1277 | if (! STRING_INTERVALS (object)) | 1277 | if (! STRING_INTERVALS (object)) |
| 1278 | return Qnil; | 1278 | return Qnil; |
| 1279 | 1279 | ||
| 1280 | STRING_SET_INTERVALS (object, NULL_INTERVAL); | 1280 | STRING_SET_INTERVALS (object, NULL); |
| 1281 | return Qt; | 1281 | return Qt; |
| 1282 | } | 1282 | } |
| 1283 | 1283 | ||
| 1284 | i = validate_interval_range (object, &start, &end, soft); | 1284 | i = validate_interval_range (object, &start, &end, soft); |
| 1285 | 1285 | ||
| 1286 | if (NULL_INTERVAL_P (i)) | 1286 | if (!i) |
| 1287 | { | 1287 | { |
| 1288 | /* If buffer has no properties, and we want none, return now. */ | 1288 | /* If buffer has no properties, and we want none, return now. */ |
| 1289 | if (NILP (properties)) | 1289 | if (NILP (properties)) |
| @@ -1296,7 +1296,7 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, | |||
| 1296 | 1296 | ||
| 1297 | i = validate_interval_range (object, &start, &end, hard); | 1297 | i = validate_interval_range (object, &start, &end, hard); |
| 1298 | /* This can return if start == end. */ | 1298 | /* This can return if start == end. */ |
| 1299 | if (NULL_INTERVAL_P (i)) | 1299 | if (!i) |
| 1300 | return Qnil; | 1300 | return Qnil; |
| 1301 | } | 1301 | } |
| 1302 | 1302 | ||
| @@ -1321,7 +1321,7 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, | |||
| 1321 | void | 1321 | void |
| 1322 | set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i) | 1322 | set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i) |
| 1323 | { | 1323 | { |
| 1324 | register INTERVAL prev_changed = NULL_INTERVAL; | 1324 | register INTERVAL prev_changed = NULL; |
| 1325 | register ptrdiff_t s, len; | 1325 | register ptrdiff_t s, len; |
| 1326 | INTERVAL unchanged; | 1326 | INTERVAL unchanged; |
| 1327 | 1327 | ||
| @@ -1378,7 +1378,7 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie | |||
| 1378 | merge the intervals, so as to make the undo records | 1378 | merge the intervals, so as to make the undo records |
| 1379 | and cause redisplay to happen. */ | 1379 | and cause redisplay to happen. */ |
| 1380 | set_properties (properties, i, buffer); | 1380 | set_properties (properties, i, buffer); |
| 1381 | if (!NULL_INTERVAL_P (prev_changed)) | 1381 | if (prev_changed) |
| 1382 | merge_interval_left (i); | 1382 | merge_interval_left (i); |
| 1383 | return; | 1383 | return; |
| 1384 | } | 1384 | } |
| @@ -1389,7 +1389,7 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie | |||
| 1389 | merge the intervals, so as to make the undo records | 1389 | merge the intervals, so as to make the undo records |
| 1390 | and cause redisplay to happen. */ | 1390 | and cause redisplay to happen. */ |
| 1391 | set_properties (properties, i, buffer); | 1391 | set_properties (properties, i, buffer); |
| 1392 | if (NULL_INTERVAL_P (prev_changed)) | 1392 | if (!prev_changed) |
| 1393 | prev_changed = i; | 1393 | prev_changed = i; |
| 1394 | else | 1394 | else |
| 1395 | prev_changed = i = merge_interval_left (i); | 1395 | prev_changed = i = merge_interval_left (i); |
| @@ -1421,7 +1421,7 @@ Use `set-text-properties' if you want to remove all text properties. */) | |||
| 1421 | XSETBUFFER (object, current_buffer); | 1421 | XSETBUFFER (object, current_buffer); |
| 1422 | 1422 | ||
| 1423 | i = validate_interval_range (object, &start, &end, soft); | 1423 | i = validate_interval_range (object, &start, &end, soft); |
| 1424 | if (NULL_INTERVAL_P (i)) | 1424 | if (!i) |
| 1425 | return Qnil; | 1425 | return Qnil; |
| 1426 | 1426 | ||
| 1427 | s = XINT (start); | 1427 | s = XINT (start); |
| @@ -1508,7 +1508,7 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1508 | XSETBUFFER (object, current_buffer); | 1508 | XSETBUFFER (object, current_buffer); |
| 1509 | 1509 | ||
| 1510 | i = validate_interval_range (object, &start, &end, soft); | 1510 | i = validate_interval_range (object, &start, &end, soft); |
| 1511 | if (NULL_INTERVAL_P (i)) | 1511 | if (!i) |
| 1512 | return Qnil; | 1512 | return Qnil; |
| 1513 | 1513 | ||
| 1514 | s = XINT (start); | 1514 | s = XINT (start); |
| @@ -1613,11 +1613,11 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ | |||
| 1613 | if (NILP (object)) | 1613 | if (NILP (object)) |
| 1614 | XSETBUFFER (object, current_buffer); | 1614 | XSETBUFFER (object, current_buffer); |
| 1615 | i = validate_interval_range (object, &start, &end, soft); | 1615 | i = validate_interval_range (object, &start, &end, soft); |
| 1616 | if (NULL_INTERVAL_P (i)) | 1616 | if (!i) |
| 1617 | return (!NILP (value) || EQ (start, end) ? Qnil : start); | 1617 | return (!NILP (value) || EQ (start, end) ? Qnil : start); |
| 1618 | e = XINT (end); | 1618 | e = XINT (end); |
| 1619 | 1619 | ||
| 1620 | while (! NULL_INTERVAL_P (i)) | 1620 | while (i) |
| 1621 | { | 1621 | { |
| 1622 | if (i->position >= e) | 1622 | if (i->position >= e) |
| 1623 | break; | 1623 | break; |
| @@ -1649,12 +1649,12 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ | |||
| 1649 | if (NILP (object)) | 1649 | if (NILP (object)) |
| 1650 | XSETBUFFER (object, current_buffer); | 1650 | XSETBUFFER (object, current_buffer); |
| 1651 | i = validate_interval_range (object, &start, &end, soft); | 1651 | i = validate_interval_range (object, &start, &end, soft); |
| 1652 | if (NULL_INTERVAL_P (i)) | 1652 | if (!i) |
| 1653 | return (NILP (value) || EQ (start, end)) ? Qnil : start; | 1653 | return (NILP (value) || EQ (start, end)) ? Qnil : start; |
| 1654 | s = XINT (start); | 1654 | s = XINT (start); |
| 1655 | e = XINT (end); | 1655 | e = XINT (end); |
| 1656 | 1656 | ||
| 1657 | while (! NULL_INTERVAL_P (i)) | 1657 | while (i) |
| 1658 | { | 1658 | { |
| 1659 | if (i->position >= e) | 1659 | if (i->position >= e) |
| 1660 | break; | 1660 | break; |
| @@ -1759,7 +1759,7 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ | |||
| 1759 | struct gcpro gcpro1, gcpro2; | 1759 | struct gcpro gcpro1, gcpro2; |
| 1760 | 1760 | ||
| 1761 | i = validate_interval_range (src, &start, &end, soft); | 1761 | i = validate_interval_range (src, &start, &end, soft); |
| 1762 | if (NULL_INTERVAL_P (i)) | 1762 | if (!i) |
| 1763 | return Qnil; | 1763 | return Qnil; |
| 1764 | 1764 | ||
| 1765 | CHECK_NUMBER_COERCE_MARKER (pos); | 1765 | CHECK_NUMBER_COERCE_MARKER (pos); |
| @@ -1811,7 +1811,7 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ | |||
| 1811 | } | 1811 | } |
| 1812 | 1812 | ||
| 1813 | i = next_interval (i); | 1813 | i = next_interval (i); |
| 1814 | if (NULL_INTERVAL_P (i)) | 1814 | if (!i) |
| 1815 | break; | 1815 | break; |
| 1816 | 1816 | ||
| 1817 | p += len; | 1817 | p += len; |
| @@ -1852,7 +1852,7 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp | |||
| 1852 | result = Qnil; | 1852 | result = Qnil; |
| 1853 | 1853 | ||
| 1854 | i = validate_interval_range (object, &start, &end, soft); | 1854 | i = validate_interval_range (object, &start, &end, soft); |
| 1855 | if (!NULL_INTERVAL_P (i)) | 1855 | if (i) |
| 1856 | { | 1856 | { |
| 1857 | ptrdiff_t s = XINT (start); | 1857 | ptrdiff_t s = XINT (start); |
| 1858 | ptrdiff_t e = XINT (end); | 1858 | ptrdiff_t e = XINT (end); |
| @@ -1884,7 +1884,7 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp | |||
| 1884 | result); | 1884 | result); |
| 1885 | 1885 | ||
| 1886 | i = next_interval (i); | 1886 | i = next_interval (i); |
| 1887 | if (NULL_INTERVAL_P (i)) | 1887 | if (!i) |
| 1888 | break; | 1888 | break; |
| 1889 | s = i->position; | 1889 | s = i->position; |
| 1890 | } | 1890 | } |
| @@ -2007,7 +2007,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2007 | interval_insert_behind_hooks = Qnil; | 2007 | interval_insert_behind_hooks = Qnil; |
| 2008 | interval_insert_in_front_hooks = Qnil; | 2008 | interval_insert_in_front_hooks = Qnil; |
| 2009 | 2009 | ||
| 2010 | if (NULL_INTERVAL_P (intervals)) | 2010 | if (!intervals) |
| 2011 | return; | 2011 | return; |
| 2012 | 2012 | ||
| 2013 | if (start > end) | 2013 | if (start > end) |
| @@ -2048,7 +2048,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2048 | indirectly defined via the category property. */ | 2048 | indirectly defined via the category property. */ |
| 2049 | if (i != prev) | 2049 | if (i != prev) |
| 2050 | { | 2050 | { |
| 2051 | if (! NULL_INTERVAL_P (i)) | 2051 | if (i) |
| 2052 | { | 2052 | { |
| 2053 | after = textget (i->plist, Qread_only); | 2053 | after = textget (i->plist, Qread_only); |
| 2054 | 2054 | ||
| @@ -2068,7 +2068,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2068 | } | 2068 | } |
| 2069 | } | 2069 | } |
| 2070 | 2070 | ||
| 2071 | if (! NULL_INTERVAL_P (prev)) | 2071 | if (prev) |
| 2072 | { | 2072 | { |
| 2073 | before = textget (prev->plist, Qread_only); | 2073 | before = textget (prev->plist, Qread_only); |
| 2074 | 2074 | ||
| @@ -2088,7 +2088,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2088 | } | 2088 | } |
| 2089 | } | 2089 | } |
| 2090 | } | 2090 | } |
| 2091 | else if (! NULL_INTERVAL_P (i)) | 2091 | else if (i) |
| 2092 | { | 2092 | { |
| 2093 | after = textget (i->plist, Qread_only); | 2093 | after = textget (i->plist, Qread_only); |
| 2094 | 2094 | ||
| @@ -2115,10 +2115,10 @@ verify_interval_modification (struct buffer *buf, | |||
| 2115 | } | 2115 | } |
| 2116 | 2116 | ||
| 2117 | /* Run both insert hooks (just once if they're the same). */ | 2117 | /* Run both insert hooks (just once if they're the same). */ |
| 2118 | if (!NULL_INTERVAL_P (prev)) | 2118 | if (prev) |
| 2119 | interval_insert_behind_hooks | 2119 | interval_insert_behind_hooks |
| 2120 | = textget (prev->plist, Qinsert_behind_hooks); | 2120 | = textget (prev->plist, Qinsert_behind_hooks); |
| 2121 | if (!NULL_INTERVAL_P (i)) | 2121 | if (i) |
| 2122 | interval_insert_in_front_hooks | 2122 | interval_insert_in_front_hooks |
| 2123 | = textget (i->plist, Qinsert_in_front_hooks); | 2123 | = textget (i->plist, Qinsert_in_front_hooks); |
| 2124 | } | 2124 | } |
| @@ -2146,7 +2146,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2146 | i = next_interval (i); | 2146 | i = next_interval (i); |
| 2147 | } | 2147 | } |
| 2148 | /* Keep going thru the interval containing the char before END. */ | 2148 | /* Keep going thru the interval containing the char before END. */ |
| 2149 | while (! NULL_INTERVAL_P (i) && i->position < end); | 2149 | while (i && i->position < end); |
| 2150 | 2150 | ||
| 2151 | if (!inhibit_modification_hooks) | 2151 | if (!inhibit_modification_hooks) |
| 2152 | { | 2152 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index 73dc272e5e2..a2fc4f61669 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3321,7 +3321,7 @@ compute_stop_pos (struct it *it) | |||
| 3321 | interval if there isn't such an interval. */ | 3321 | interval if there isn't such an interval. */ |
| 3322 | position = make_number (charpos); | 3322 | position = make_number (charpos); |
| 3323 | iv = validate_interval_range (object, &position, &position, 0); | 3323 | iv = validate_interval_range (object, &position, &position, 0); |
| 3324 | if (!NULL_INTERVAL_P (iv)) | 3324 | if (iv) |
| 3325 | { | 3325 | { |
| 3326 | Lisp_Object values_here[LAST_PROP_IDX]; | 3326 | Lisp_Object values_here[LAST_PROP_IDX]; |
| 3327 | struct props *p; | 3327 | struct props *p; |
| @@ -3333,7 +3333,7 @@ compute_stop_pos (struct it *it) | |||
| 3333 | /* Look for an interval following iv that has different | 3333 | /* Look for an interval following iv that has different |
| 3334 | properties. */ | 3334 | properties. */ |
| 3335 | for (next_iv = next_interval (iv); | 3335 | for (next_iv = next_interval (iv); |
| 3336 | (!NULL_INTERVAL_P (next_iv) | 3336 | (next_iv |
| 3337 | && (NILP (limit) | 3337 | && (NILP (limit) |
| 3338 | || XFASTINT (limit) > next_iv->position)); | 3338 | || XFASTINT (limit) > next_iv->position)); |
| 3339 | next_iv = next_interval (next_iv)) | 3339 | next_iv = next_interval (next_iv)) |
| @@ -3351,7 +3351,7 @@ compute_stop_pos (struct it *it) | |||
| 3351 | break; | 3351 | break; |
| 3352 | } | 3352 | } |
| 3353 | 3353 | ||
| 3354 | if (!NULL_INTERVAL_P (next_iv)) | 3354 | if (next_iv) |
| 3355 | { | 3355 | { |
| 3356 | if (INTEGERP (limit) | 3356 | if (INTEGERP (limit) |
| 3357 | && next_iv->position >= XFASTINT (limit)) | 3357 | && next_iv->position >= XFASTINT (limit)) |