aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Schwab2012-07-18 14:33:37 -0700
committerPaul Eggert2012-07-18 14:33:37 -0700
commit60cfd2785740850bbc46c954e22e51b1d26fc446 (patch)
tree12bda60aef28f7eb63ee0f30b91c5d06ba0077b4 /src
parentd617c457bd9712ea07b138ab6f069dd8ab794b57 (diff)
downloademacs-60cfd2785740850bbc46c954e22e51b1d26fc446.tar.gz
emacs-60cfd2785740850bbc46c954e22e51b1d26fc446.zip
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>.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/intervals.c18
2 files changed, 17 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d202e1d3f38..5a7a981926b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12012-07-18 Andreas Schwab <schwab@linux-m68k.org>
2
3 Fix bug that created negative-length intervals.
4 * intervals.c (merge_interval_right, merge_interval_left):
5 Do not zero out this interval if it is absorbed by its children,
6 as this interval's total length doesn't change in that case. See
7 <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00403.html>.
8
12012-07-18 Paul Eggert <eggert@cs.ucla.edu> 92012-07-18 Paul Eggert <eggert@cs.ucla.edu>
2 10
3 * alloc.c (Fmake_bool_vector): Fix off-by-8 bug 11 * alloc.c (Fmake_bool_vector): Fix off-by-8 bug
diff --git a/src/intervals.c b/src/intervals.c
index 5b8d44e8ced..cd1254b5e46 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1391,10 +1391,6 @@ merge_interval_right (register INTERVAL i)
1391 register ptrdiff_t absorb = LENGTH (i); 1391 register ptrdiff_t absorb = LENGTH (i);
1392 register INTERVAL successor; 1392 register INTERVAL successor;
1393 1393
1394 /* Zero out this interval. */
1395 i->total_length -= absorb;
1396 CHECK_TOTAL_LENGTH (i);
1397
1398 /* Find the succeeding interval. */ 1394 /* Find the succeeding interval. */
1399 if (! NULL_RIGHT_CHILD (i)) /* It's below us. Add absorb 1395 if (! NULL_RIGHT_CHILD (i)) /* It's below us. Add absorb
1400 as we descend. */ 1396 as we descend. */
@@ -1413,6 +1409,10 @@ merge_interval_right (register INTERVAL i)
1413 return successor; 1409 return successor;
1414 } 1410 }
1415 1411
1412 /* Zero out this interval. */
1413 i->total_length -= absorb;
1414 CHECK_TOTAL_LENGTH (i);
1415
1416 successor = i; 1416 successor = i;
1417 while (! NULL_PARENT (successor)) /* It's above us. Subtract as 1417 while (! NULL_PARENT (successor)) /* It's above us. Subtract as
1418 we ascend. */ 1418 we ascend. */
@@ -1447,10 +1447,6 @@ merge_interval_left (register INTERVAL i)
1447 register ptrdiff_t absorb = LENGTH (i); 1447 register ptrdiff_t absorb = LENGTH (i);
1448 register INTERVAL predecessor; 1448 register INTERVAL predecessor;
1449 1449
1450 /* Zero out this interval. */
1451 i->total_length -= absorb;
1452 CHECK_TOTAL_LENGTH (i);
1453
1454 /* Find the preceding interval. */ 1450 /* Find the preceding interval. */
1455 if (! NULL_LEFT_CHILD (i)) /* It's below us. Go down, 1451 if (! NULL_LEFT_CHILD (i)) /* It's below us. Go down,
1456 adding ABSORB as we go. */ 1452 adding ABSORB as we go. */
@@ -1469,9 +1465,13 @@ merge_interval_left (register INTERVAL i)
1469 return predecessor; 1465 return predecessor;
1470 } 1466 }
1471 1467
1468 /* Zero out this interval. */
1469 i->total_length -= absorb;
1470 CHECK_TOTAL_LENGTH (i);
1471
1472 predecessor = i; 1472 predecessor = i;
1473 while (! NULL_PARENT (predecessor)) /* It's above us. Go up, 1473 while (! NULL_PARENT (predecessor)) /* It's above us. Go up,
1474 subtracting ABSORB. */ 1474 subtracting ABSORB. */
1475 { 1475 {
1476 if (AM_RIGHT_CHILD (predecessor)) 1476 if (AM_RIGHT_CHILD (predecessor))
1477 { 1477 {