emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109153: Fix bug that created negativ


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109153: Fix bug that created negative-length intervals.
Date: Wed, 18 Jul 2012 14:33:37 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109153
author: Andreas Schwab <address@hidden>
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Wed 2012-07-18 14:33:37 -0700
message:
  Fix bug that created negative-length intervals.
  
  * intervals.c (merge_interval_right, merge_interval_left):
  Do not zero out this interval if it is absorbed by its children,
  as this interval's total length doesn't change in that case.  See
  <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00403.html>.
modified:
  src/ChangeLog
  src/intervals.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-18 17:29:34 +0000
+++ b/src/ChangeLog     2012-07-18 21:33:37 +0000
@@ -1,3 +1,11 @@
+2012-07-18  Andreas Schwab  <address@hidden>
+
+       Fix bug that created negative-length intervals.
+       * intervals.c (merge_interval_right, merge_interval_left):
+       Do not zero out this interval if it is absorbed by its children,
+       as this interval's total length doesn't change in that case.  See
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00403.html>.
+
 2012-07-18  Paul Eggert  <address@hidden>
 
        * alloc.c (Fmake_bool_vector): Fix off-by-8 bug

=== modified file 'src/intervals.c'
--- a/src/intervals.c   2012-07-17 09:12:24 +0000
+++ b/src/intervals.c   2012-07-18 21:33:37 +0000
@@ -1391,10 +1391,6 @@
   register ptrdiff_t absorb = LENGTH (i);
   register INTERVAL successor;
 
-  /* Zero out this interval.  */
-  i->total_length -= absorb;
-  CHECK_TOTAL_LENGTH (i);
-
   /* Find the succeeding interval.  */
   if (! NULL_RIGHT_CHILD (i))      /* It's below us.  Add absorb
                                      as we descend.  */
@@ -1413,6 +1409,10 @@
       return successor;
     }
 
+  /* Zero out this interval.  */
+  i->total_length -= absorb;
+  CHECK_TOTAL_LENGTH (i);
+
   successor = i;
   while (! NULL_PARENT (successor))       /* It's above us.  Subtract as
                                              we ascend.  */
@@ -1447,10 +1447,6 @@
   register ptrdiff_t absorb = LENGTH (i);
   register INTERVAL predecessor;
 
-  /* Zero out this interval.  */
-  i->total_length -= absorb;
-  CHECK_TOTAL_LENGTH (i);
-
   /* Find the preceding interval.  */
   if (! NULL_LEFT_CHILD (i))   /* It's below us. Go down,
                                   adding ABSORB as we go.  */
@@ -1469,9 +1465,13 @@
       return predecessor;
     }
 
+  /* Zero out this interval.  */
+  i->total_length -= absorb;
+  CHECK_TOTAL_LENGTH (i);
+
   predecessor = i;
   while (! NULL_PARENT (predecessor))  /* It's above us.  Go up,
-                                  subtracting ABSORB.  */
+                                          subtracting ABSORB.  */
     {
       if (AM_RIGHT_CHILD (predecessor))
        {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]