diff options
| author | Paul Eggert | 2013-02-25 19:09:08 -0800 |
|---|---|---|
| committer | Paul Eggert | 2013-02-25 19:09:08 -0800 |
| commit | ecc0fdd49ea4351c229f7db243d26360604e758c (patch) | |
| tree | 04c9f8c066278146722112ec56bdff51a22991ae /src/textprop.c | |
| parent | 9f70f91e94a4c855d7ff8a98cf948f24e0f3eb31 (diff) | |
| download | emacs-ecc0fdd49ea4351c229f7db243d26360604e758c.tar.gz emacs-ecc0fdd49ea4351c229f7db243d26360604e758c.zip | |
Minor textprop integer cleanup.
* intervals.h, textprop.c (add_text_properties_from_list):
Return void, not int, since nobody uses the return value.
* textprop.c (validate_plist, add_properties, remove_properties)
(Fadd_text_properties):
Don't assume list length fits in int.
(interval_has_all_properties, interval_has_some_properties)
(interval_has_some_properties_list, add_properties, remove_properties)
(Fadd_text_properties, Fremove_text_properties)
(Fremove_list_of_text_properties, text_property_stickiness):
Use bool for booleans.
(Fadd_text_properties, Fremove_text_properties):
(Fremove_list_of_text_properties):
Reindent do-while as per GNU style.
Diffstat (limited to 'src/textprop.c')
| -rw-r--r-- | src/textprop.c | 159 |
1 files changed, 79 insertions, 80 deletions
diff --git a/src/textprop.c b/src/textprop.c index 49fe427913c..9499b53301f 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -198,14 +198,14 @@ validate_plist (Lisp_Object list) | |||
| 198 | 198 | ||
| 199 | if (CONSP (list)) | 199 | if (CONSP (list)) |
| 200 | { | 200 | { |
| 201 | register int i; | 201 | bool odd_length = 0; |
| 202 | register Lisp_Object tail; | 202 | Lisp_Object tail; |
| 203 | for (i = 0, tail = list; CONSP (tail); i++) | 203 | for (tail = list; CONSP (tail); tail = XCDR (tail)) |
| 204 | { | 204 | { |
| 205 | tail = XCDR (tail); | 205 | odd_length ^= 1; |
| 206 | QUIT; | 206 | QUIT; |
| 207 | } | 207 | } |
| 208 | if (i & 1) | 208 | if (odd_length) |
| 209 | error ("Odd length text property list"); | 209 | error ("Odd length text property list"); |
| 210 | return list; | 210 | return list; |
| 211 | } | 211 | } |
| @@ -213,20 +213,19 @@ validate_plist (Lisp_Object list) | |||
| 213 | return Fcons (list, Fcons (Qnil, Qnil)); | 213 | return Fcons (list, Fcons (Qnil, Qnil)); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | /* Return nonzero if interval I has all the properties, | 216 | /* Return true if interval I has all the properties, |
| 217 | with the same values, of list PLIST. */ | 217 | with the same values, of list PLIST. */ |
| 218 | 218 | ||
| 219 | static int | 219 | static bool |
| 220 | interval_has_all_properties (Lisp_Object plist, INTERVAL i) | 220 | interval_has_all_properties (Lisp_Object plist, INTERVAL i) |
| 221 | { | 221 | { |
| 222 | register Lisp_Object tail1, tail2, sym1; | 222 | Lisp_Object tail1, tail2; |
| 223 | register int found; | ||
| 224 | 223 | ||
| 225 | /* Go through each element of PLIST. */ | 224 | /* Go through each element of PLIST. */ |
| 226 | for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) | 225 | for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) |
| 227 | { | 226 | { |
| 228 | sym1 = XCAR (tail1); | 227 | Lisp_Object sym1 = XCAR (tail1); |
| 229 | found = 0; | 228 | bool found = 0; |
| 230 | 229 | ||
| 231 | /* Go through I's plist, looking for sym1 */ | 230 | /* Go through I's plist, looking for sym1 */ |
| 232 | for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2))) | 231 | for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2))) |
| @@ -249,13 +248,13 @@ interval_has_all_properties (Lisp_Object plist, INTERVAL i) | |||
| 249 | return 1; | 248 | return 1; |
| 250 | } | 249 | } |
| 251 | 250 | ||
| 252 | /* Return nonzero if the plist of interval I has any of the | 251 | /* Return true if the plist of interval I has any of the |
| 253 | properties of PLIST, regardless of their values. */ | 252 | properties of PLIST, regardless of their values. */ |
| 254 | 253 | ||
| 255 | static int | 254 | static bool |
| 256 | interval_has_some_properties (Lisp_Object plist, INTERVAL i) | 255 | interval_has_some_properties (Lisp_Object plist, INTERVAL i) |
| 257 | { | 256 | { |
| 258 | register Lisp_Object tail1, tail2, sym; | 257 | Lisp_Object tail1, tail2, sym; |
| 259 | 258 | ||
| 260 | /* Go through each element of PLIST. */ | 259 | /* Go through each element of PLIST. */ |
| 261 | for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) | 260 | for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) |
| @@ -274,10 +273,10 @@ interval_has_some_properties (Lisp_Object plist, INTERVAL i) | |||
| 274 | /* Return nonzero if the plist of interval I has any of the | 273 | /* Return nonzero if the plist of interval I has any of the |
| 275 | property names in LIST, regardless of their values. */ | 274 | property names in LIST, regardless of their values. */ |
| 276 | 275 | ||
| 277 | static int | 276 | static bool |
| 278 | interval_has_some_properties_list (Lisp_Object list, INTERVAL i) | 277 | interval_has_some_properties_list (Lisp_Object list, INTERVAL i) |
| 279 | { | 278 | { |
| 280 | register Lisp_Object tail1, tail2, sym; | 279 | Lisp_Object tail1, tail2, sym; |
| 281 | 280 | ||
| 282 | /* Go through each element of LIST. */ | 281 | /* Go through each element of LIST. */ |
| 283 | for (tail1 = list; CONSP (tail1); tail1 = XCDR (tail1)) | 282 | for (tail1 = list; CONSP (tail1); tail1 = XCDR (tail1)) |
| @@ -358,15 +357,14 @@ set_properties (Lisp_Object properties, INTERVAL interval, Lisp_Object object) | |||
| 358 | 357 | ||
| 359 | OBJECT should be the string or buffer the interval is in. | 358 | OBJECT should be the string or buffer the interval is in. |
| 360 | 359 | ||
| 361 | Return nonzero if this changes I (i.e., if any members of PLIST | 360 | Return true if this changes I (i.e., if any members of PLIST |
| 362 | are actually added to I's plist) */ | 361 | are actually added to I's plist) */ |
| 363 | 362 | ||
| 364 | static int | 363 | static bool |
| 365 | add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object) | 364 | add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object) |
| 366 | { | 365 | { |
| 367 | Lisp_Object tail1, tail2, sym1, val1; | 366 | Lisp_Object tail1, tail2, sym1, val1; |
| 368 | register int changed = 0; | 367 | bool changed = 0; |
| 369 | register int found; | ||
| 370 | struct gcpro gcpro1, gcpro2, gcpro3; | 368 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 371 | 369 | ||
| 372 | tail1 = plist; | 370 | tail1 = plist; |
| @@ -380,9 +378,9 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object) | |||
| 380 | /* Go through each element of PLIST. */ | 378 | /* Go through each element of PLIST. */ |
| 381 | for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) | 379 | for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) |
| 382 | { | 380 | { |
| 381 | bool found = 0; | ||
| 383 | sym1 = XCAR (tail1); | 382 | sym1 = XCAR (tail1); |
| 384 | val1 = Fcar (XCDR (tail1)); | 383 | val1 = Fcar (XCDR (tail1)); |
| 385 | found = 0; | ||
| 386 | 384 | ||
| 387 | /* Go through I's plist, looking for sym1 */ | 385 | /* Go through I's plist, looking for sym1 */ |
| 388 | for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2))) | 386 | for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2))) |
| @@ -410,7 +408,7 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object) | |||
| 410 | 408 | ||
| 411 | /* I's property has a different value -- change it */ | 409 | /* I's property has a different value -- change it */ |
| 412 | Fsetcar (this_cdr, val1); | 410 | Fsetcar (this_cdr, val1); |
| 413 | changed++; | 411 | changed = 1; |
| 414 | break; | 412 | break; |
| 415 | } | 413 | } |
| 416 | 414 | ||
| @@ -423,7 +421,7 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object) | |||
| 423 | sym1, Qnil, object); | 421 | sym1, Qnil, object); |
| 424 | } | 422 | } |
| 425 | set_interval_plist (i, Fcons (sym1, Fcons (val1, i->plist))); | 423 | set_interval_plist (i, Fcons (sym1, Fcons (val1, i->plist))); |
| 426 | changed++; | 424 | changed = 1; |
| 427 | } | 425 | } |
| 428 | } | 426 | } |
| 429 | 427 | ||
| @@ -437,14 +435,14 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object) | |||
| 437 | (If PLIST is non-nil, use that, otherwise use LIST.) | 435 | (If PLIST is non-nil, use that, otherwise use LIST.) |
| 438 | OBJECT is the string or buffer containing I. */ | 436 | OBJECT is the string or buffer containing I. */ |
| 439 | 437 | ||
| 440 | static int | 438 | static bool |
| 441 | remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object object) | 439 | remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object object) |
| 442 | { | 440 | { |
| 443 | register Lisp_Object tail1, tail2, sym, current_plist; | 441 | Lisp_Object tail1, tail2, sym, current_plist; |
| 444 | register int changed = 0; | 442 | bool changed = 0; |
| 445 | 443 | ||
| 446 | /* Nonzero means tail1 is a plist, otherwise it is a list. */ | 444 | /* True means tail1 is a plist, otherwise it is a list. */ |
| 447 | int use_plist; | 445 | bool use_plist; |
| 448 | 446 | ||
| 449 | current_plist = i->plist; | 447 | current_plist = i->plist; |
| 450 | 448 | ||
| @@ -467,7 +465,7 @@ remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object | |||
| 467 | object); | 465 | object); |
| 468 | 466 | ||
| 469 | current_plist = XCDR (XCDR (current_plist)); | 467 | current_plist = XCDR (XCDR (current_plist)); |
| 470 | changed++; | 468 | changed = 1; |
| 471 | } | 469 | } |
| 472 | 470 | ||
| 473 | /* Go through I's plist, looking for SYM. */ | 471 | /* Go through I's plist, looking for SYM. */ |
| @@ -483,7 +481,7 @@ remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object | |||
| 483 | sym, XCAR (XCDR (this)), object); | 481 | sym, XCAR (XCDR (this)), object); |
| 484 | 482 | ||
| 485 | Fsetcdr (XCDR (tail2), XCDR (XCDR (this))); | 483 | Fsetcdr (XCDR (tail2), XCDR (XCDR (this))); |
| 486 | changed++; | 484 | changed = 1; |
| 487 | } | 485 | } |
| 488 | tail2 = this; | 486 | tail2 = this; |
| 489 | } | 487 | } |
| @@ -1129,11 +1127,10 @@ If OBJECT is a string, START and END are 0-based indices into it. | |||
| 1129 | Return t if any property value actually changed, nil otherwise. */) | 1127 | Return t if any property value actually changed, nil otherwise. */) |
| 1130 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) | 1128 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) |
| 1131 | { | 1129 | { |
| 1132 | register INTERVAL i, unchanged; | 1130 | INTERVAL i, unchanged; |
| 1133 | register ptrdiff_t s, len; | 1131 | ptrdiff_t s, len; |
| 1134 | register int modified = 0; | 1132 | bool modified = 0; |
| 1135 | struct gcpro gcpro1; | 1133 | struct gcpro gcpro1; |
| 1136 | ptrdiff_t got; | ||
| 1137 | 1134 | ||
| 1138 | properties = validate_plist (properties); | 1135 | properties = validate_plist (properties); |
| 1139 | if (NILP (properties)) | 1136 | if (NILP (properties)) |
| @@ -1156,14 +1153,17 @@ Return t if any property value actually changed, nil otherwise. */) | |||
| 1156 | /* If this interval already has the properties, we can skip it. */ | 1153 | /* If this interval already has the properties, we can skip it. */ |
| 1157 | if (interval_has_all_properties (properties, i)) | 1154 | if (interval_has_all_properties (properties, i)) |
| 1158 | { | 1155 | { |
| 1159 | got = LENGTH (i) - (s - i->position); | 1156 | ptrdiff_t got = LENGTH (i) - (s - i->position); |
| 1160 | do { | 1157 | |
| 1161 | if (got >= len) | 1158 | do |
| 1162 | RETURN_UNGCPRO (Qnil); | 1159 | { |
| 1163 | len -= got; | 1160 | if (got >= len) |
| 1164 | i = next_interval (i); | 1161 | RETURN_UNGCPRO (Qnil); |
| 1165 | got = LENGTH (i); | 1162 | len -= got; |
| 1166 | } while (interval_has_all_properties (properties, i)); | 1163 | i = next_interval (i); |
| 1164 | got = LENGTH (i); | ||
| 1165 | } | ||
| 1166 | while (interval_has_all_properties (properties, i)); | ||
| 1167 | } | 1167 | } |
| 1168 | else if (i->position != s) | 1168 | else if (i->position != s) |
| 1169 | { | 1169 | { |
| @@ -1220,7 +1220,7 @@ Return t if any property value actually changed, nil otherwise. */) | |||
| 1220 | } | 1220 | } |
| 1221 | 1221 | ||
| 1222 | len -= LENGTH (i); | 1222 | len -= LENGTH (i); |
| 1223 | modified += add_properties (properties, i, object); | 1223 | modified |= add_properties (properties, i, object); |
| 1224 | i = next_interval (i); | 1224 | i = next_interval (i); |
| 1225 | } | 1225 | } |
| 1226 | } | 1226 | } |
| @@ -1424,10 +1424,9 @@ Return t if any property was actually removed, nil otherwise. | |||
| 1424 | Use `set-text-properties' if you want to remove all text properties. */) | 1424 | Use `set-text-properties' if you want to remove all text properties. */) |
| 1425 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) | 1425 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) |
| 1426 | { | 1426 | { |
| 1427 | register INTERVAL i, unchanged; | 1427 | INTERVAL i, unchanged; |
| 1428 | register ptrdiff_t s, len; | 1428 | ptrdiff_t s, len; |
| 1429 | register int modified = 0; | 1429 | bool modified = 0; |
| 1430 | ptrdiff_t got; | ||
| 1431 | 1430 | ||
| 1432 | if (NILP (object)) | 1431 | if (NILP (object)) |
| 1433 | XSETBUFFER (object, current_buffer); | 1432 | XSETBUFFER (object, current_buffer); |
| @@ -1442,14 +1441,17 @@ Use `set-text-properties' if you want to remove all text properties. */) | |||
| 1442 | /* If there are no properties on this entire interval, return. */ | 1441 | /* If there are no properties on this entire interval, return. */ |
| 1443 | if (! interval_has_some_properties (properties, i)) | 1442 | if (! interval_has_some_properties (properties, i)) |
| 1444 | { | 1443 | { |
| 1445 | got = (LENGTH (i) - (s - i->position)); | 1444 | ptrdiff_t got = LENGTH (i) - (s - i->position); |
| 1446 | do { | 1445 | |
| 1447 | if (got >= len) | 1446 | do |
| 1448 | return Qnil; | 1447 | { |
| 1449 | len -= got; | 1448 | if (got >= len) |
| 1450 | i = next_interval (i); | 1449 | return Qnil; |
| 1451 | got = LENGTH (i); | 1450 | len -= got; |
| 1452 | } while (! interval_has_some_properties (properties, i)); | 1451 | i = next_interval (i); |
| 1452 | got = LENGTH (i); | ||
| 1453 | } | ||
| 1454 | while (! interval_has_some_properties (properties, i)); | ||
| 1453 | } | 1455 | } |
| 1454 | /* Split away the beginning of this interval; what we don't | 1456 | /* Split away the beginning of this interval; what we don't |
| 1455 | want to modify. */ | 1457 | want to modify. */ |
| @@ -1500,7 +1502,7 @@ Use `set-text-properties' if you want to remove all text properties. */) | |||
| 1500 | } | 1502 | } |
| 1501 | 1503 | ||
| 1502 | len -= LENGTH (i); | 1504 | len -= LENGTH (i); |
| 1503 | modified += remove_properties (properties, Qnil, i, object); | 1505 | modified |= remove_properties (properties, Qnil, i, object); |
| 1504 | i = next_interval (i); | 1506 | i = next_interval (i); |
| 1505 | } | 1507 | } |
| 1506 | } | 1508 | } |
| @@ -1515,11 +1517,10 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. | |||
| 1515 | Return t if any property was actually removed, nil otherwise. */) | 1517 | Return t if any property was actually removed, nil otherwise. */) |
| 1516 | (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object) | 1518 | (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object) |
| 1517 | { | 1519 | { |
| 1518 | register INTERVAL i, unchanged; | 1520 | INTERVAL i, unchanged; |
| 1519 | register ptrdiff_t s, len; | 1521 | ptrdiff_t s, len; |
| 1520 | register int modified = 0; | 1522 | bool modified = 0; |
| 1521 | Lisp_Object properties; | 1523 | Lisp_Object properties; |
| 1522 | ptrdiff_t got; | ||
| 1523 | properties = list_of_properties; | 1524 | properties = list_of_properties; |
| 1524 | 1525 | ||
| 1525 | if (NILP (object)) | 1526 | if (NILP (object)) |
| @@ -1535,14 +1536,17 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1535 | /* If there are no properties on the interval, return. */ | 1536 | /* If there are no properties on the interval, return. */ |
| 1536 | if (! interval_has_some_properties_list (properties, i)) | 1537 | if (! interval_has_some_properties_list (properties, i)) |
| 1537 | { | 1538 | { |
| 1538 | got = (LENGTH (i) - (s - i->position)); | 1539 | ptrdiff_t got = LENGTH (i) - (s - i->position); |
| 1539 | do { | 1540 | |
| 1540 | if (got >= len) | 1541 | do |
| 1541 | return Qnil; | 1542 | { |
| 1542 | len -= got; | 1543 | if (got >= len) |
| 1543 | i = next_interval (i); | 1544 | return Qnil; |
| 1544 | got = LENGTH (i); | 1545 | len -= got; |
| 1545 | } while (! interval_has_some_properties_list (properties, i)); | 1546 | i = next_interval (i); |
| 1547 | got = LENGTH (i); | ||
| 1548 | } | ||
| 1549 | while (! interval_has_some_properties_list (properties, i)); | ||
| 1546 | } | 1550 | } |
| 1547 | /* Split away the beginning of this interval; what we don't | 1551 | /* Split away the beginning of this interval; what we don't |
| 1548 | want to modify. */ | 1552 | want to modify. */ |
| @@ -1697,7 +1701,7 @@ int | |||
| 1697 | text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer) | 1701 | text_property_stickiness (Lisp_Object prop, Lisp_Object pos, Lisp_Object buffer) |
| 1698 | { | 1702 | { |
| 1699 | Lisp_Object prev_pos, front_sticky; | 1703 | Lisp_Object prev_pos, front_sticky; |
| 1700 | int is_rear_sticky = 1, is_front_sticky = 0; /* defaults */ | 1704 | bool is_rear_sticky = 1, is_front_sticky = 0; /* defaults */ |
| 1701 | Lisp_Object defalt = Fassq (prop, Vtext_property_default_nonsticky); | 1705 | Lisp_Object defalt = Fassq (prop, Vtext_property_default_nonsticky); |
| 1702 | 1706 | ||
| 1703 | if (NILP (buffer)) | 1707 | if (NILP (buffer)) |
| @@ -1772,7 +1776,7 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ | |||
| 1772 | Lisp_Object stuff; | 1776 | Lisp_Object stuff; |
| 1773 | Lisp_Object plist; | 1777 | Lisp_Object plist; |
| 1774 | ptrdiff_t s, e, e2, p, len; | 1778 | ptrdiff_t s, e, e2, p, len; |
| 1775 | int modified = 0; | 1779 | bool modified = 0; |
| 1776 | struct gcpro gcpro1, gcpro2; | 1780 | struct gcpro gcpro1, gcpro2; |
| 1777 | 1781 | ||
| 1778 | i = validate_interval_range (src, &start, &end, soft); | 1782 | i = validate_interval_range (src, &start, &end, soft); |
| @@ -1843,7 +1847,7 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ | |||
| 1843 | res = Fadd_text_properties (Fcar (res), Fcar (Fcdr (res)), | 1847 | res = Fadd_text_properties (Fcar (res), Fcar (Fcdr (res)), |
| 1844 | Fcar (Fcdr (Fcdr (res))), dest); | 1848 | Fcar (Fcdr (Fcdr (res))), dest); |
| 1845 | if (! NILP (res)) | 1849 | if (! NILP (res)) |
| 1846 | modified++; | 1850 | modified = 1; |
| 1847 | stuff = Fcdr (stuff); | 1851 | stuff = Fcdr (stuff); |
| 1848 | } | 1852 | } |
| 1849 | 1853 | ||
| @@ -1914,33 +1918,28 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp | |||
| 1914 | /* Add text properties to OBJECT from LIST. LIST is a list of triples | 1918 | /* Add text properties to OBJECT from LIST. LIST is a list of triples |
| 1915 | (START END PLIST), where START and END are positions and PLIST is a | 1919 | (START END PLIST), where START and END are positions and PLIST is a |
| 1916 | property list containing the text properties to add. Adjust START | 1920 | property list containing the text properties to add. Adjust START |
| 1917 | and END positions by DELTA before adding properties. Value is | 1921 | and END positions by DELTA before adding properties. */ |
| 1918 | non-zero if OBJECT was modified. */ | ||
| 1919 | 1922 | ||
| 1920 | int | 1923 | void |
| 1921 | add_text_properties_from_list (Lisp_Object object, Lisp_Object list, Lisp_Object delta) | 1924 | add_text_properties_from_list (Lisp_Object object, Lisp_Object list, Lisp_Object delta) |
| 1922 | { | 1925 | { |
| 1923 | struct gcpro gcpro1, gcpro2; | 1926 | struct gcpro gcpro1, gcpro2; |
| 1924 | int modified_p = 0; | ||
| 1925 | 1927 | ||
| 1926 | GCPRO2 (list, object); | 1928 | GCPRO2 (list, object); |
| 1927 | 1929 | ||
| 1928 | for (; CONSP (list); list = XCDR (list)) | 1930 | for (; CONSP (list); list = XCDR (list)) |
| 1929 | { | 1931 | { |
| 1930 | Lisp_Object item, start, end, plist, tem; | 1932 | Lisp_Object item, start, end, plist; |
| 1931 | 1933 | ||
| 1932 | item = XCAR (list); | 1934 | item = XCAR (list); |
| 1933 | start = make_number (XINT (XCAR (item)) + XINT (delta)); | 1935 | start = make_number (XINT (XCAR (item)) + XINT (delta)); |
| 1934 | end = make_number (XINT (XCAR (XCDR (item))) + XINT (delta)); | 1936 | end = make_number (XINT (XCAR (XCDR (item))) + XINT (delta)); |
| 1935 | plist = XCAR (XCDR (XCDR (item))); | 1937 | plist = XCAR (XCDR (XCDR (item))); |
| 1936 | 1938 | ||
| 1937 | tem = Fadd_text_properties (start, end, plist, object); | 1939 | Fadd_text_properties (start, end, plist, object); |
| 1938 | if (!NILP (tem)) | ||
| 1939 | modified_p = 1; | ||
| 1940 | } | 1940 | } |
| 1941 | 1941 | ||
| 1942 | UNGCPRO; | 1942 | UNGCPRO; |
| 1943 | return modified_p; | ||
| 1944 | } | 1943 | } |
| 1945 | 1944 | ||
| 1946 | 1945 | ||