aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2018-12-12 09:54:42 -0800
committerPaul Eggert2018-12-12 09:55:38 -0800
commit23e9e8abaab6f0c90412fc5fae08e5995a26d84c (patch)
tree6b6a98d95b149f8272f6962909e07f5b97f20029 /src
parent6e76e11c4200a4d4185e0b7d6cea5164d459737b (diff)
downloademacs-23e9e8abaab6f0c90412fc5fae08e5995a26d84c.tar.gz
emacs-23e9e8abaab6f0c90412fc5fae08e5995a26d84c.zip
set_text_properties_1 can assume START <= END
* src/textprop.c (set_text_properties_1): Do not swap START and END. All callers do that already, and the test for swapping here is redundant.
Diffstat (limited to 'src')
-rw-r--r--src/textprop.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/textprop.c b/src/textprop.c
index 8e8baf43d9f..add14eb4a78 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1421,34 +1421,25 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties,
1421/* Replace properties of text from START to END with new list of 1421/* Replace properties of text from START to END with new list of
1422 properties PROPERTIES. OBJECT is the buffer or string containing 1422 properties PROPERTIES. OBJECT is the buffer or string containing
1423 the text. This does not obey any hooks. 1423 the text. This does not obey any hooks.
1424 You should provide the interval that START is located in as I. 1424 I is the interval that START is located in. */
1425 START and END can be in any order. */
1426 1425
1427void 1426void
1428set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object, INTERVAL i) 1427set_text_properties_1 (Lisp_Object start, Lisp_Object end,
1428 Lisp_Object properties, Lisp_Object object, INTERVAL i)
1429{ 1429{
1430 register INTERVAL prev_changed = NULL; 1430 INTERVAL prev_changed = NULL;
1431 register ptrdiff_t s, len; 1431 ptrdiff_t s = XFIXNUM (start);
1432 INTERVAL unchanged; 1432 ptrdiff_t len = XFIXNUM (end) - s;
1433 1433
1434 if (XFIXNUM (start) < XFIXNUM (end)) 1434 if (len == 0)
1435 {
1436 s = XFIXNUM (start);
1437 len = XFIXNUM (end) - s;
1438 }
1439 else if (XFIXNUM (end) < XFIXNUM (start))
1440 {
1441 s = XFIXNUM (end);
1442 len = XFIXNUM (start) - s;
1443 }
1444 else
1445 return; 1435 return;
1436 eassert (0 < len);
1446 1437
1447 eassert (i); 1438 eassert (i);
1448 1439
1449 if (i->position != s) 1440 if (i->position != s)
1450 { 1441 {
1451 unchanged = i; 1442 INTERVAL unchanged = i;
1452 i = split_interval_right (unchanged, s - unchanged->position); 1443 i = split_interval_right (unchanged, s - unchanged->position);
1453 1444
1454 if (LENGTH (i) > len) 1445 if (LENGTH (i) > len)