{
new->total_length = (BUF_Z (XBUFFER (parent))
- BUF_BEG (XBUFFER (parent)));
- CHECK_TOTAL_LENGTH (new);
+ eassert (0 <= TOTAL_LENGTH (new));
BUF_INTERVALS (XBUFFER (parent)) = new;
new->position = BEG;
}
else if (STRINGP (parent))
{
new->total_length = SCHARS (parent);
- CHECK_TOTAL_LENGTH (new);
+ eassert (0 <= TOTAL_LENGTH (new));
STRING_SET_INTERVALS (parent, new);
new->position = 0;
}
/* A's total length is decreased by the length of B and its left child. */
interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval);
- CHECK_TOTAL_LENGTH (interval);
+ eassert (0 <= TOTAL_LENGTH (interval));
/* B must have the same total length of A. */
B->total_length = old_total;
- CHECK_TOTAL_LENGTH (B);
+ eassert (0 <= TOTAL_LENGTH (B));
return B;
}
/* A's total length is decreased by the length of B and its right child. */
interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval);
- CHECK_TOTAL_LENGTH (interval);
+ eassert (0 <= TOTAL_LENGTH (interval));
/* B must have the same total length of A. */
B->total_length = old_total;
- CHECK_TOTAL_LENGTH (B);
+ eassert (0 <= TOTAL_LENGTH (B));
return B;
}
{
interval_set_right (interval, new);
new->total_length = new_length;
- CHECK_TOTAL_LENGTH (new);
+ eassert (0 <= TOTAL_LENGTH (new));
}
else
{
interval_set_parent (interval->right, new);
interval_set_right (interval, new);
new->total_length = new_length + new->right->total_length;
- CHECK_TOTAL_LENGTH (new);
+ eassert (0 <= TOTAL_LENGTH (new));
balance_an_interval (new);
}
{
interval_set_left (interval, new);
new->total_length = new_length;
- CHECK_TOTAL_LENGTH (new);
+ eassert (0 <= TOTAL_LENGTH (new));
}
else
{
interval_set_parent (new->left, new);
interval_set_left (interval, new);
new->total_length = new_length + new->left->total_length;
- CHECK_TOTAL_LENGTH (new);
+ eassert (0 <= TOTAL_LENGTH (new));
balance_an_interval (new);
}
for (temp = prev ? prev : i; temp; temp = INTERVAL_PARENT_OR_NULL (temp))
{
temp->total_length += length;
- CHECK_TOTAL_LENGTH (temp);
+ eassert (0 <= TOTAL_LENGTH (temp));
temp = balance_possible_root_interval (temp);
}
for (temp = i; temp; temp = INTERVAL_PARENT_OR_NULL (temp))
{
temp->total_length += length;
- CHECK_TOTAL_LENGTH (temp);
+ eassert (0 <= TOTAL_LENGTH (temp));
temp = balance_possible_root_interval (temp);
}
}
this = this->left;
this->total_length += migrate_amt;
}
- CHECK_TOTAL_LENGTH (this);
+ eassert (0 <= TOTAL_LENGTH (this));
interval_set_left (this, migrate);
interval_set_parent (migrate, this);
relative_position,
amount);
tree->total_length -= subtract;
- CHECK_TOTAL_LENGTH (tree);
+ eassert (0 <= TOTAL_LENGTH (tree));
return subtract;
}
/* Right branch. */
relative_position,
amount);
tree->total_length -= subtract;
- CHECK_TOTAL_LENGTH (tree);
+ eassert (0 <= TOTAL_LENGTH (tree));
return subtract;
}
/* Here -- this node. */
amount = my_amount;
tree->total_length -= amount;
- CHECK_TOTAL_LENGTH (tree);
+ eassert (0 <= TOTAL_LENGTH (tree));
if (LENGTH (tree) == 0)
delete_interval (tree);
if (ONLY_INTERVAL_P (tree))
{
tree->total_length -= length;
- CHECK_TOTAL_LENGTH (tree);
+ eassert (0 <= TOTAL_LENGTH (tree));
return;
}
while (! NULL_LEFT_CHILD (successor))
{
successor->total_length += absorb;
- CHECK_TOTAL_LENGTH (successor);
+ eassert (0 <= TOTAL_LENGTH (successor));
successor = successor->left;
}
successor->total_length += absorb;
- CHECK_TOTAL_LENGTH (successor);
+ eassert (0 <= TOTAL_LENGTH (successor));
delete_interval (i);
return successor;
}
/* Zero out this interval. */
i->total_length -= absorb;
- CHECK_TOTAL_LENGTH (i);
+ eassert (0 <= TOTAL_LENGTH (i));
successor = i;
while (! NULL_PARENT (successor)) /* It's above us. Subtract as
successor = INTERVAL_PARENT (successor);
successor->total_length -= absorb;
- CHECK_TOTAL_LENGTH (successor);
+ eassert (0 <= TOTAL_LENGTH (successor));
}
/* This must be the rightmost or last interval and cannot
while (! NULL_RIGHT_CHILD (predecessor))
{
predecessor->total_length += absorb;
- CHECK_TOTAL_LENGTH (predecessor);
+ eassert (0 <= TOTAL_LENGTH (predecessor));
predecessor = predecessor->right;
}
predecessor->total_length += absorb;
- CHECK_TOTAL_LENGTH (predecessor);
+ eassert (0 <= TOTAL_LENGTH (predecessor));
delete_interval (i);
return predecessor;
}
/* Zero out this interval. */
i->total_length -= absorb;
- CHECK_TOTAL_LENGTH (i);
+ eassert (0 <= TOTAL_LENGTH (i));
predecessor = i;
while (! NULL_PARENT (predecessor)) /* It's above us. Go up,
predecessor = INTERVAL_PARENT (predecessor);
predecessor->total_length -= absorb;
- CHECK_TOTAL_LENGTH (predecessor);
+ eassert (0 <= TOTAL_LENGTH (predecessor));
}
/* This must be the leftmost or first interval and cannot
new->position = 0;
got = (LENGTH (i) - (start - i->position));
new->total_length = length;
- CHECK_TOTAL_LENGTH (new);
+ eassert (0 <= TOTAL_LENGTH (new));
copy_properties (i, new);
t = new;
i->total_length = end - start;
else
i->total_length = end_byte - start_byte;
- CHECK_TOTAL_LENGTH (i);
+ eassert (0 <= TOTAL_LENGTH (i));
if (TOTAL_LENGTH (i) == 0)
{