]> git.eshelyaron.com Git - emacs.git/commitdiff
* intervals.c (offset_intervals): Tell GCC not to worry about length overflow
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 20 Apr 2011 08:30:52 +0000 (01:30 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 20 Apr 2011 08:30:52 +0000 (01:30 -0700)
when negating a negative length.

src/ChangeLog
src/intervals.c

index 9a8177bf43f96a26054024787d86c692e00448d6..d01d8fbd727d8ac57a7c4bfaa02cc5c385a8a124 100644 (file)
@@ -6,6 +6,8 @@
        (CHECK_TOTAL_LENGTH): Remove cast to EMACS_INT; no longer needed.
        * intervals.c (interval_deletion_adjustment): Now returns EMACS_INT.
        All uses changed.
+       (offset_intervals): Tell GCC not to worry about length overflow
+       when negating a negative length.
 
        * alloc.c (overrun_check_malloc, overrun_check_realloc): Now static.
        (overrun_check_free): Likewise.
index 8f3840976d0b7b4da5df31b76a5f8e625b7f759a..e72bc146d1685901b78dc703e49f41d29406fb3a 100644 (file)
@@ -39,6 +39,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <setjmp.h>
+#include <intprops.h>
 #include "lisp.h"
 #include "intervals.h"
 #include "buffer.h"
@@ -1435,7 +1436,10 @@ offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length)
   if (length > 0)
     adjust_intervals_for_insertion (BUF_INTERVALS (buffer), start, length);
   else
-    adjust_intervals_for_deletion (buffer, start, -length);
+    {
+      IF_LINT (if (length < - TYPE_MAXIMUM (EMACS_INT)) abort ();)
+      adjust_intervals_for_deletion (buffer, start, -length);
+    }
 }
 \f
 /* Merge interval I with its lexicographic successor. The resulting