2011-04-20 Paul Eggert <eggert@cs.ucla.edu>
+ * 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>.
+ (CHECK_TOTAL_LENGTH): Remove cast to EMACS_INT; no longer needed.
+ * intervals.c (interval_deletion_adjustment): Now returns EMACS_INT.
+ All uses changed.
+
* alloc.c (overrun_check_malloc, overrun_check_realloc): Now static.
(overrun_check_free): Likewise.
Do this by recursing down TREE to the interval in question, and
deleting the appropriate amount of text. */
-static EMACS_UINT
+static EMACS_INT
interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from,
register EMACS_INT amount)
{
/* Left branch */
if (relative_position < LEFT_TOTAL_LENGTH (tree))
{
- EMACS_UINT subtract = interval_deletion_adjustment (tree->left,
- relative_position,
- amount);
+ EMACS_INT subtract = interval_deletion_adjustment (tree->left,
+ relative_position,
+ amount);
tree->total_length -= subtract;
CHECK_TOTAL_LENGTH (tree);
return subtract;
else if (relative_position >= (TOTAL_LENGTH (tree)
- RIGHT_TOTAL_LENGTH (tree)))
{
- EMACS_UINT subtract;
+ EMACS_INT subtract;
relative_position -= (tree->total_length
- RIGHT_TOTAL_LENGTH (tree));
adjust_intervals_for_deletion (struct buffer *buffer,
EMACS_INT start, EMACS_INT length)
{
- register EMACS_UINT left_to_delete = length;
+ register EMACS_INT left_to_delete = length;
register INTERVAL tree = BUF_INTERVALS (buffer);
Lisp_Object parent;
EMACS_INT offset;
{
/* The first group of entries deal with the tree structure. */
- EMACS_UINT total_length; /* Length of myself and both children. */
- EMACS_UINT position; /* Cache of interval's character position. */
+ EMACS_INT total_length; /* Length of myself and both children. */
+ EMACS_INT position; /* Cache of interval's character position. */
/* This field is usually updated
simultaneously with an interval
traversal, there is no guarantee
#define CHECK_TOTAL_LENGTH(i) \
do \
{ \
- if ((EMACS_INT) (i)->total_length < 0) \
+ if ((i)->total_length < 0) \
abort (); \
} \
while (0)