changeset 41589:67d2bb283076

(set_text_properties_1): Allow args in either order. Do nothing if range is empty.
author Richard M. Stallman <rms@gnu.org>
date Mon, 26 Nov 2001 20:10:04 +0000
parents 91a655afe8fa
children 39c6a725758c
files src/textprop.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/textprop.c	Mon Nov 26 19:58:19 2001 +0000
+++ b/src/textprop.c	Mon Nov 26 20:10:04 2001 +0000
@@ -1304,7 +1304,7 @@
    the text.  This does not obey any hooks.
    You can provide the interval that START is located in as I,
    or pass NULL for I and this function will find it.
-   This function assumes that START < END.  */
+   START and END can be in any order.  */
 
 void
 set_text_properties_1 (start, end, properties, buffer, i)
@@ -1317,7 +1317,14 @@
 
   s = XINT (start);
   len = XINT (end) - s;
-  eassert (len > 0);
+  if (len == 0)
+    return;
+  if (len < 0)
+    {
+      s = s + len;
+      len = - len;
+    }
+
   if (i == 0)
     i = find_interval (BUF_INTERVALS (XBUFFER (buffer)), s);