and to avoid GCC warning about integer overflow.
2011-04-20 Paul Eggert <eggert@cs.ucla.edu>
+ * textprop.c (set_text_properties_1): Rewrite for clarity,
+ and to avoid GCC warning about integer overflow.
+
* intervals.h (struct interval): Use EMACS_INT for members
where EMACS_UINT might cause problems. See
<http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00514.html>.
register EMACS_INT s, len;
INTERVAL unchanged;
- s = XINT (start);
- len = XINT (end) - s;
- if (len == 0)
- return;
- if (len < 0)
+ if (XINT (start) < XINT (end))
{
- s = s + len;
- len = - len;
+ s = XINT (start);
+ len = XINT (end) - s;
}
+ else if (XINT (end) < XINT (start))
+ {
+ s = XINT (end);
+ len = XINT (start) - s;
+ }
+ else
+ return;
if (i == 0)
i = find_interval (BUF_INTERVALS (XBUFFER (buffer)), s);