* 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.
This commit is contained in:
Paul Eggert 2011-04-20 01:04:17 -07:00
parent 2538aa2f5f
commit c20db43fef
3 changed files with 16 additions and 9 deletions

View file

@ -1,5 +1,12 @@
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.

View file

@ -1313,7 +1313,7 @@ delete_interval (register INTERVAL i)
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)
{
@ -1325,9 +1325,9 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from,
/* 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;
@ -1336,7 +1336,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from,
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));
@ -1378,7 +1378,7 @@ static void
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;

View file

@ -27,8 +27,8 @@ struct interval
{
/* 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
@ -164,7 +164,7 @@ struct interval
#define CHECK_TOTAL_LENGTH(i) \
do \
{ \
if ((EMACS_INT) (i)->total_length < 0) \
if ((i)->total_length < 0) \
abort (); \
} \
while (0)