aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-08-07 15:28:41 +0400
committerDmitry Antipov2012-08-07 15:28:41 +0400
commit6a3d20cc46da1e59f230923056b6b351acb097b9 (patch)
tree6e770cefc007d5782defbec033fd5f856010af5e /src
parentc395097f5193c1af5ae44b0adf3023dd0d48e081 (diff)
downloademacs-6a3d20cc46da1e59f230923056b6b351acb097b9.tar.gz
emacs-6a3d20cc46da1e59f230923056b6b351acb097b9.zip
Basic functions to set Lisp_Object and pointer slots of intervals.
* intervals.h (interval_set_parent, interval_set_object): (interval_set_left, interval_set_right, interval_set_plist): (interval_copy_parent): New function. (SET_INTERVAL_OBJECT, SET_INTERVAL_PARENT, INTERVAL_PTR_SIZE): Remove. (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE): Adjust indentation. (INTERVAL_SIZE): Remove. Adjust users. * alloc.c, intervals.c, lread.c, textprop.c: Use new functions.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/alloc.c2
-rw-r--r--src/intervals.c99
-rw-r--r--src/intervals.h112
-rw-r--r--src/lread.c2
-rw-r--r--src/textprop.c6
6 files changed, 141 insertions, 92 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index fe7ffd5d14f..c363b258f46 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,17 @@
12012-08-07 Dmitry Antipov <dmantipov@yandex.ru> 12012-08-07 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 Basic functions to set Lisp_Object and pointer slots of intervals.
4 * intervals.h (interval_set_parent, interval_set_object):
5 (interval_set_left, interval_set_right, interval_set_plist):
6 (interval_copy_parent): New function.
7 (SET_INTERVAL_OBJECT, SET_INTERVAL_PARENT, INTERVAL_PTR_SIZE): Remove.
8 (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE): Adjust
9 indentation.
10 (INTERVAL_SIZE): Remove. Adjust users.
11 * alloc.c, intervals.c, lread.c, textprop.c: Use new functions.
12
132012-08-07 Dmitry Antipov <dmantipov@yandex.ru>
14
3 Drop PGET and revert read access to Lisp_Objects slots of Lisp_Process. 15 Drop PGET and revert read access to Lisp_Objects slots of Lisp_Process.
4 * process.h (PGET): Remove. 16 * process.h (PGET): Remove.
5 (struct Lisp_Process): Do not use INTERNAL_FIELD. 17 (struct Lisp_Process): Do not use INTERNAL_FIELD.
diff --git a/src/alloc.c b/src/alloc.c
index 615d2f37afa..a9ce48172ab 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6416,7 +6416,7 @@ gc_sweep (void)
6416 { 6416 {
6417 if (!iblk->intervals[i].gcmarkbit) 6417 if (!iblk->intervals[i].gcmarkbit)
6418 { 6418 {
6419 SET_INTERVAL_PARENT (&iblk->intervals[i], interval_free_list); 6419 interval_set_parent (&iblk->intervals[i], interval_free_list);
6420 interval_free_list = &iblk->intervals[i]; 6420 interval_free_list = &iblk->intervals[i];
6421 this_free++; 6421 this_free++;
6422 } 6422 }
diff --git a/src/intervals.c b/src/intervals.c
index cd1254b5e46..cde4dd89d0b 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -88,7 +88,7 @@ create_root_interval (Lisp_Object parent)
88 new->position = 0; 88 new->position = 0;
89 } 89 }
90 90
91 SET_INTERVAL_OBJECT (new, parent); 91 interval_set_object (new, parent);
92 92
93 return new; 93 return new;
94} 94}
@@ -102,7 +102,7 @@ copy_properties (register INTERVAL source, register INTERVAL target)
102 return; 102 return;
103 103
104 COPY_INTERVAL_CACHE (source, target); 104 COPY_INTERVAL_CACHE (source, target);
105 target->plist = Fcopy_sequence (source->plist); 105 interval_set_plist (target, Fcopy_sequence (source->plist));
106} 106}
107 107
108/* Merge the properties of interval SOURCE into the properties 108/* Merge the properties of interval SOURCE into the properties
@@ -138,7 +138,7 @@ merge_properties (register INTERVAL source, register INTERVAL target)
138 if (NILP (val)) 138 if (NILP (val))
139 { 139 {
140 val = XCAR (o); 140 val = XCAR (o);
141 target->plist = Fcons (sym, Fcons (val, target->plist)); 141 interval_set_plist (target, Fcons (sym, Fcons (val, target->plist)));
142 } 142 }
143 o = XCDR (o); 143 o = XCDR (o);
144 } 144 }
@@ -320,21 +320,21 @@ rotate_right (INTERVAL interval)
320 if (! ROOT_INTERVAL_P (interval)) 320 if (! ROOT_INTERVAL_P (interval))
321 { 321 {
322 if (AM_LEFT_CHILD (interval)) 322 if (AM_LEFT_CHILD (interval))
323 INTERVAL_PARENT (interval)->left = B; 323 interval_set_left (INTERVAL_PARENT (interval), B);
324 else 324 else
325 INTERVAL_PARENT (interval)->right = B; 325 interval_set_right (INTERVAL_PARENT (interval), B);
326 } 326 }
327 COPY_INTERVAL_PARENT (B, interval); 327 interval_copy_parent (B, interval);
328 328
329 /* Make B the parent of A */ 329 /* Make B the parent of A */
330 i = B->right; 330 i = B->right;
331 B->right = interval; 331 interval_set_right (B, interval);
332 SET_INTERVAL_PARENT (interval, B); 332 interval_set_parent (interval, B);
333 333
334 /* Make A point to c */ 334 /* Make A point to c */
335 interval->left = i; 335 interval_set_left (interval, i);
336 if (! NULL_INTERVAL_P (i)) 336 if (! NULL_INTERVAL_P (i))
337 SET_INTERVAL_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. */
340 interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval); 340 interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval);
@@ -367,21 +367,21 @@ rotate_left (INTERVAL interval)
367 if (! ROOT_INTERVAL_P (interval)) 367 if (! ROOT_INTERVAL_P (interval))
368 { 368 {
369 if (AM_LEFT_CHILD (interval)) 369 if (AM_LEFT_CHILD (interval))
370 INTERVAL_PARENT (interval)->left = B; 370 interval_set_left (INTERVAL_PARENT (interval), B);
371 else 371 else
372 INTERVAL_PARENT (interval)->right = B; 372 interval_set_right (INTERVAL_PARENT (interval), B);
373 } 373 }
374 COPY_INTERVAL_PARENT (B, interval); 374 interval_copy_parent (B, interval);
375 375
376 /* Make B the parent of A */ 376 /* Make B the parent of A */
377 i = B->left; 377 i = B->left;
378 B->left = interval; 378 interval_set_left (B, interval);
379 SET_INTERVAL_PARENT (interval, B); 379 interval_set_parent (interval, B);
380 380
381 /* Make A point to c */ 381 /* Make A point to c */
382 interval->right = i; 382 interval_set_right (interval, i);
383 if (! NULL_INTERVAL_P (i)) 383 if (! NULL_INTERVAL_P (i))
384 SET_INTERVAL_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. */
387 interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval); 387 interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval);
@@ -507,20 +507,20 @@ split_interval_right (INTERVAL interval, ptrdiff_t offset)
507 ptrdiff_t new_length = LENGTH (interval) - offset; 507 ptrdiff_t new_length = LENGTH (interval) - offset;
508 508
509 new->position = position + offset; 509 new->position = position + offset;
510 SET_INTERVAL_PARENT (new, interval); 510 interval_set_parent (new, interval);
511 511
512 if (NULL_RIGHT_CHILD (interval)) 512 if (NULL_RIGHT_CHILD (interval))
513 { 513 {
514 interval->right = new; 514 interval_set_right (interval, new);
515 new->total_length = new_length; 515 new->total_length = new_length;
516 CHECK_TOTAL_LENGTH (new); 516 CHECK_TOTAL_LENGTH (new);
517 } 517 }
518 else 518 else
519 { 519 {
520 /* Insert the new node between INTERVAL and its right child. */ 520 /* Insert the new node between INTERVAL and its right child. */
521 new->right = interval->right; 521 interval_set_right (new, interval->right);
522 SET_INTERVAL_PARENT (interval->right, new); 522 interval_set_parent (interval->right, new);
523 interval->right = new; 523 interval_set_right (interval, new);
524 new->total_length = new_length + new->right->total_length; 524 new->total_length = new_length + new->right->total_length;
525 CHECK_TOTAL_LENGTH (new); 525 CHECK_TOTAL_LENGTH (new);
526 balance_an_interval (new); 526 balance_an_interval (new);
@@ -552,20 +552,20 @@ split_interval_left (INTERVAL interval, ptrdiff_t offset)
552 552
553 new->position = interval->position; 553 new->position = interval->position;
554 interval->position = interval->position + offset; 554 interval->position = interval->position + offset;
555 SET_INTERVAL_PARENT (new, interval); 555 interval_set_parent (new, interval);
556 556
557 if (NULL_LEFT_CHILD (interval)) 557 if (NULL_LEFT_CHILD (interval))
558 { 558 {
559 interval->left = new; 559 interval_set_left (interval, new);
560 new->total_length = new_length; 560 new->total_length = new_length;
561 CHECK_TOTAL_LENGTH (new); 561 CHECK_TOTAL_LENGTH (new);
562 } 562 }
563 else 563 else
564 { 564 {
565 /* Insert the new node between INTERVAL and its left child. */ 565 /* Insert the new node between INTERVAL and its left child. */
566 new->left = interval->left; 566 interval_set_left (new, interval->left);
567 SET_INTERVAL_PARENT (new->left, new); 567 interval_set_parent (new->left, new);
568 interval->left = new; 568 interval_set_left (interval, new);
569 new->total_length = new_length + new->left->total_length; 569 new->total_length = new_length + new->left->total_length;
570 CHECK_TOTAL_LENGTH (new); 570 CHECK_TOTAL_LENGTH (new);
571 balance_an_interval (new); 571 balance_an_interval (new);
@@ -940,21 +940,20 @@ adjust_intervals_for_insertion (INTERVAL tree,
940 RESET_INTERVAL (&newi); 940 RESET_INTERVAL (&newi);
941 pleft = NULL_INTERVAL_P (prev) ? Qnil : prev->plist; 941 pleft = NULL_INTERVAL_P (prev) ? Qnil : prev->plist;
942 pright = NULL_INTERVAL_P (i) ? Qnil : i->plist; 942 pright = NULL_INTERVAL_P (i) ? Qnil : i->plist;
943 newi.plist = merge_properties_sticky (pleft, pright); 943 interval_set_plist (&newi, merge_properties_sticky (pleft, pright));
944 944
945 if (! prev) /* i.e. position == BEG */ 945 if (! prev) /* i.e. position == BEG */
946 { 946 {
947 if (! intervals_equal (i, &newi)) 947 if (! intervals_equal (i, &newi))
948 { 948 {
949 i = split_interval_left (i, length); 949 i = split_interval_left (i, length);
950 i->plist = newi.plist; 950 interval_set_plist (i, newi.plist);
951 } 951 }
952 } 952 }
953 else if (! intervals_equal (prev, &newi)) 953 else if (! intervals_equal (prev, &newi))
954 { 954 {
955 prev = split_interval_right (prev, 955 prev = split_interval_right (prev, position - prev->position);
956 position - prev->position); 956 interval_set_plist (prev, newi.plist);
957 prev->plist = newi.plist;
958 if (! NULL_INTERVAL_P (i) 957 if (! NULL_INTERVAL_P (i)
959 && intervals_equal (prev, i)) 958 && intervals_equal (prev, i))
960 merge_interval_right (prev); 959 merge_interval_right (prev);
@@ -1180,8 +1179,8 @@ delete_node (register INTERVAL i)
1180 this->total_length += migrate_amt; 1179 this->total_length += migrate_amt;
1181 } 1180 }
1182 CHECK_TOTAL_LENGTH (this); 1181 CHECK_TOTAL_LENGTH (this);
1183 this->left = migrate; 1182 interval_set_left (this, migrate);
1184 SET_INTERVAL_PARENT (migrate, this); 1183 interval_set_parent (migrate, this);
1185 1184
1186 return i->right; 1185 return i->right;
1187} 1186}
@@ -1206,7 +1205,7 @@ delete_interval (register INTERVAL i)
1206 GET_INTERVAL_OBJECT (owner, i); 1205 GET_INTERVAL_OBJECT (owner, i);
1207 parent = delete_node (i); 1206 parent = delete_node (i);
1208 if (! NULL_INTERVAL_P (parent)) 1207 if (! NULL_INTERVAL_P (parent))
1209 SET_INTERVAL_OBJECT (parent, owner); 1208 interval_set_object (parent, owner);
1210 1209
1211 if (BUFFERP (owner)) 1210 if (BUFFERP (owner))
1212 BUF_INTERVALS (XBUFFER (owner)) = parent; 1211 BUF_INTERVALS (XBUFFER (owner)) = parent;
@@ -1221,15 +1220,15 @@ delete_interval (register INTERVAL i)
1221 parent = INTERVAL_PARENT (i); 1220 parent = INTERVAL_PARENT (i);
1222 if (AM_LEFT_CHILD (i)) 1221 if (AM_LEFT_CHILD (i))
1223 { 1222 {
1224 parent->left = delete_node (i); 1223 interval_set_left (parent, delete_node (i));
1225 if (! NULL_INTERVAL_P (parent->left)) 1224 if (! NULL_INTERVAL_P (parent->left))
1226 SET_INTERVAL_PARENT (parent->left, parent); 1225 interval_set_parent (parent->left, parent);
1227 } 1226 }
1228 else 1227 else
1229 { 1228 {
1230 parent->right = delete_node (i); 1229 interval_set_right (parent, delete_node (i));
1231 if (! NULL_INTERVAL_P (parent->right)) 1230 if (! NULL_INTERVAL_P (parent->right))
1232 SET_INTERVAL_PARENT (parent->right, parent); 1231 interval_set_parent (parent->right, parent);
1233 } 1232 }
1234} 1233}
1235 1234
@@ -1500,13 +1499,13 @@ reproduce_tree (INTERVAL source, INTERVAL parent)
1500{ 1499{
1501 register INTERVAL t = make_interval (); 1500 register INTERVAL t = make_interval ();
1502 1501
1503 memcpy (t, source, INTERVAL_SIZE); 1502 memcpy (t, source, sizeof *t);
1504 copy_properties (source, t); 1503 copy_properties (source, t);
1505 SET_INTERVAL_PARENT (t, parent); 1504 interval_set_parent (t, parent);
1506 if (! NULL_LEFT_CHILD (source)) 1505 if (! NULL_LEFT_CHILD (source))
1507 t->left = reproduce_tree (source->left, t); 1506 interval_set_left (t, reproduce_tree (source->left, t));
1508 if (! NULL_RIGHT_CHILD (source)) 1507 if (! NULL_RIGHT_CHILD (source))
1509 t->right = reproduce_tree (source->right, t); 1508 interval_set_right (t, reproduce_tree (source->right, t));
1510 1509
1511 return t; 1510 return t;
1512} 1511}
@@ -1516,13 +1515,13 @@ reproduce_tree_obj (INTERVAL source, Lisp_Object parent)
1516{ 1515{
1517 register INTERVAL t = make_interval (); 1516 register INTERVAL t = make_interval ();
1518 1517
1519 memcpy (t, source, INTERVAL_SIZE); 1518 memcpy (t, source, sizeof *t);
1520 copy_properties (source, t); 1519 copy_properties (source, t);
1521 SET_INTERVAL_OBJECT (t, parent); 1520 interval_set_object (t, parent);
1522 if (! NULL_LEFT_CHILD (source)) 1521 if (! NULL_LEFT_CHILD (source))
1523 t->left = reproduce_tree (source->left, t); 1522 interval_set_left (t, reproduce_tree (source->left, t));
1524 if (! NULL_RIGHT_CHILD (source)) 1523 if (! NULL_RIGHT_CHILD (source))
1525 t->right = reproduce_tree (source->right, t); 1524 interval_set_right (t, reproduce_tree (source->right, t));
1526 1525
1527 return t; 1526 return t;
1528} 1527}
@@ -2264,7 +2263,7 @@ copy_intervals_to_string (Lisp_Object string, struct buffer *buffer,
2264 if (NULL_INTERVAL_P (interval_copy)) 2263 if (NULL_INTERVAL_P (interval_copy))
2265 return; 2264 return;
2266 2265
2267 SET_INTERVAL_OBJECT (interval_copy, string); 2266 interval_set_object (interval_copy, string);
2268 STRING_SET_INTERVALS (string, interval_copy); 2267 STRING_SET_INTERVALS (string, interval_copy);
2269} 2268}
2270 2269
@@ -2404,13 +2403,13 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
2404 { 2403 {
2405 if ((i)->left) 2404 if ((i)->left)
2406 { 2405 {
2407 (i)->plist = (i)->left->plist; 2406 interval_set_plist (i, i->left->plist);
2408 (i)->left->total_length = 0; 2407 (i)->left->total_length = 0;
2409 delete_interval ((i)->left); 2408 delete_interval ((i)->left);
2410 } 2409 }
2411 else 2410 else
2412 { 2411 {
2413 (i)->plist = (i)->right->plist; 2412 interval_set_plist (i, i->right->plist);
2414 (i)->right->total_length = 0; 2413 (i)->right->total_length = 0;
2415 delete_interval ((i)->right); 2414 delete_interval ((i)->right);
2416 } 2415 }
diff --git a/src/intervals.h b/src/intervals.h
index d78289d897e..2bf16d64862 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -18,6 +18,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19#include "dispextern.h" 19#include "dispextern.h"
20 20
21INLINE_HEADER_BEGIN
22
21#define NULL_INTERVAL ((INTERVAL)0) 23#define NULL_INTERVAL ((INTERVAL)0)
22#define INTERVAL_DEFAULT NULL_INTERVAL 24#define INTERVAL_DEFAULT NULL_INTERVAL
23 25
@@ -61,12 +63,6 @@ struct interval
61 63
62/* These are macros for dealing with the interval tree. */ 64/* These are macros for dealing with the interval tree. */
63 65
64/* Size of the structure used to represent an interval. */
65#define INTERVAL_SIZE (sizeof (struct interval))
66
67/* Size of a pointer to an interval structure. */
68#define INTERVAL_PTR_SIZE (sizeof (struct interval *))
69
70#define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL) 66#define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL)
71 67
72/* True if this interval has no right child. */ 68/* True if this interval has no right child. */
@@ -131,23 +127,63 @@ struct interval
131#define INTERVAL_HAS_PARENT(i) ((i)->up_obj == 0 && (i)->up.interval != 0) 127#define INTERVAL_HAS_PARENT(i) ((i)->up_obj == 0 && (i)->up.interval != 0)
132#define INTERVAL_HAS_OBJECT(i) ((i)->up_obj) 128#define INTERVAL_HAS_OBJECT(i) ((i)->up_obj)
133 129
134/* Set/get parent of an interval. 130/* Use these macros to get parent of an interval.
135 131
136 The choice of macros is dependent on the type needed. Don't add 132 The choice of macros is dependent on the type needed. Don't add
137 casts to get around this, it will break some development work in 133 casts to get around this, it will break some development work in
138 progress. */ 134 progress. */
139#define SET_INTERVAL_PARENT(i,p) \ 135
140 ((i)->up_obj = 0, (i)->up.interval = (p)) 136#define INTERVAL_PARENT(i) \
141#define SET_INTERVAL_OBJECT(i,o) \ 137 (eassert ((i) != 0 && (i)->up_obj == 0), (i)->up.interval)
142 (eassert (BUFFERP (o) || STRINGP (o)), (i)->up_obj = 1, (i)->up.obj = (o)) 138
143#define INTERVAL_PARENT(i) \ 139#define GET_INTERVAL_OBJECT(d,s) (eassert ((s)->up_obj == 1), (d) = (s)->up.obj)
144 (eassert ((i) != 0 && (i)->up_obj == 0),(i)->up.interval) 140
145#define GET_INTERVAL_OBJECT(d,s) (eassert((s)->up_obj == 1), (d) = (s)->up.obj) 141/* Use these functions to set Lisp_Object
146 142 or pointer slots of struct interval. */
147/* Make the parent of D be whatever the parent of S is, regardless of 143
148 type. This is used when balancing an interval tree. */ 144LISP_INLINE void
149#define COPY_INTERVAL_PARENT(d,s) \ 145interval_set_parent (INTERVAL i, INTERVAL parent)
150 ((d)->up = (s)->up, (d)->up_obj = (s)->up_obj) 146{
147 i->up_obj = 0;
148 i->up.interval = parent;
149}
150
151LISP_INLINE void
152interval_set_object (INTERVAL i, Lisp_Object obj)
153{
154 eassert (BUFFERP (obj) || STRINGP (obj));
155 i->up_obj = 1;
156 i->up.obj = obj;
157}
158
159LISP_INLINE void
160interval_set_left (INTERVAL i, INTERVAL left)
161{
162 i->left = left;
163}
164
165LISP_INLINE void
166interval_set_right (INTERVAL i, INTERVAL right)
167{
168 i->right = right;
169}
170
171LISP_INLINE Lisp_Object
172interval_set_plist (INTERVAL i, Lisp_Object plist)
173{
174 i->plist = plist;
175 return plist;
176}
177
178/* Make the parent of D be whatever the parent of S is, regardless
179 of the type. This is used when balancing an interval tree. */
180
181LISP_INLINE void
182interval_copy_parent (INTERVAL d, INTERVAL s)
183{
184 d->up = s->up;
185 d->up_obj = s->up_obj;
186}
151 187
152/* Get the parent interval, if any, otherwise a null pointer. Useful 188/* Get the parent interval, if any, otherwise a null pointer. Useful
153 for walking up to the root in a "for" loop; use this to get the 189 for walking up to the root in a "for" loop; use this to get the
@@ -165,31 +201,31 @@ struct interval
165 while (0) 201 while (0)
166 202
167/* Reset this interval to its vanilla, or no-property state. */ 203/* Reset this interval to its vanilla, or no-property state. */
168#define RESET_INTERVAL(i) \ 204#define RESET_INTERVAL(i) \
169{ \ 205{ \
170 (i)->total_length = (i)->position = 0; \ 206 (i)->total_length = (i)->position = 0; \
171 (i)->left = (i)->right = NULL_INTERVAL; \ 207 (i)->left = (i)->right = NULL_INTERVAL; \
172 SET_INTERVAL_PARENT (i, NULL_INTERVAL); \ 208 interval_set_parent (i, NULL_INTERVAL); \
173 (i)->write_protect = 0; \ 209 (i)->write_protect = 0; \
174 (i)->visible = 0; \ 210 (i)->visible = 0; \
175 (i)->front_sticky = (i)->rear_sticky = 0; \ 211 (i)->front_sticky = (i)->rear_sticky = 0; \
176 (i)->plist = Qnil; \ 212 interval_set_plist (i, Qnil); \
177} 213}
178 214
179/* Copy the cached property values of interval FROM to interval TO. */ 215/* Copy the cached property values of interval FROM to interval TO. */
180#define COPY_INTERVAL_CACHE(from,to) \ 216#define COPY_INTERVAL_CACHE(from,to) \
181{ \ 217{ \
182 (to)->write_protect = (from)->write_protect; \ 218 (to)->write_protect = (from)->write_protect; \
183 (to)->visible = (from)->visible; \ 219 (to)->visible = (from)->visible; \
184 (to)->front_sticky = (from)->front_sticky; \ 220 (to)->front_sticky = (from)->front_sticky; \
185 (to)->rear_sticky = (from)->rear_sticky; \ 221 (to)->rear_sticky = (from)->rear_sticky; \
186} 222}
187 223
188/* Copy only the set bits of FROM's cache. */ 224/* Copy only the set bits of FROM's cache. */
189#define MERGE_INTERVAL_CACHE(from,to) \ 225#define MERGE_INTERVAL_CACHE(from,to) \
190{ \ 226{ \
191 if ((from)->write_protect) (to)->write_protect = 1; \ 227 if ((from)->write_protect) (to)->write_protect = 1; \
192 if ((from)->visible) (to)->visible = 1; \ 228 if ((from)->visible) (to)->visible = 1; \
193 if ((from)->front_sticky) (to)->front_sticky = 1; \ 229 if ((from)->front_sticky) (to)->front_sticky = 1; \
194 if ((from)->rear_sticky) (to)->rear_sticky = 1; \ 230 if ((from)->rear_sticky) (to)->rear_sticky = 1; \
195} 231}
@@ -326,3 +362,5 @@ extern Lisp_Object get_pos_property (Lisp_Object pos, Lisp_Object prop,
326extern void syms_of_textprop (void); 362extern void syms_of_textprop (void);
327 363
328#include "composite.h" 364#include "composite.h"
365
366INLINE_HEADER_END
diff --git a/src/lread.c b/src/lread.c
index 49fa93bc0dd..4763f82e457 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3211,7 +3211,7 @@ substitute_in_interval (INTERVAL interval, Lisp_Object arg)
3211 Lisp_Object object = Fcar (arg); 3211 Lisp_Object object = Fcar (arg);
3212 Lisp_Object placeholder = Fcdr (arg); 3212 Lisp_Object placeholder = Fcdr (arg);
3213 3213
3214 SUBSTITUTE (interval->plist, interval->plist = true_value); 3214 SUBSTITUTE (interval->plist, interval_set_plist (interval, true_value));
3215} 3215}
3216 3216
3217 3217
diff --git a/src/textprop.c b/src/textprop.c
index 8aa52bebe5b..5b390fbfe08 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -338,7 +338,7 @@ set_properties (Lisp_Object properties, INTERVAL interval, Lisp_Object object)
338 } 338 }
339 339
340 /* Store new properties. */ 340 /* Store new properties. */
341 interval->plist = Fcopy_sequence (properties); 341 interval_set_plist (interval, Fcopy_sequence (properties));
342} 342}
343 343
344/* Add the properties of PLIST to the interval I, or set 344/* Add the properties of PLIST to the interval I, or set
@@ -411,7 +411,7 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object)
411 record_property_change (i->position, LENGTH (i), 411 record_property_change (i->position, LENGTH (i),
412 sym1, Qnil, object); 412 sym1, Qnil, object);
413 } 413 }
414 i->plist = Fcons (sym1, Fcons (val1, i->plist)); 414 interval_set_plist (i, Fcons (sym1, Fcons (val1, i->plist)));
415 changed++; 415 changed++;
416 } 416 }
417 } 417 }
@@ -484,7 +484,7 @@ remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object
484 } 484 }
485 485
486 if (changed) 486 if (changed)
487 i->plist = current_plist; 487 interval_set_plist (i, current_plist);
488 return changed; 488 return changed;
489} 489}
490 490