summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-04-20 01:04:17 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-04-20 01:04:17 -0700
commitc20db43fef1bceb545b05bec2dbf18b1fbb2b533 (patch)
tree7d2186191340a2d33fdf47b68c626e51f9608d39
parent2538aa2f5f92dd8878652d299e7d6ebabc352075 (diff)
downloademacs-c20db43fef1bceb545b05bec2dbf18b1fbb2b533.tar.gz
emacs-c20db43fef1bceb545b05bec2dbf18b1fbb2b533.tar.bz2
emacs-c20db43fef1bceb545b05bec2dbf18b1fbb2b533.zip
* 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.
-rw-r--r--src/ChangeLog7
-rw-r--r--src/intervals.c12
-rw-r--r--src/intervals.h6
3 files changed, 16 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5f01308a358..9a8177bf43f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/intervals.c b/src/intervals.c
index 3e73110845d..8f3840976d0 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -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;
diff --git a/src/intervals.h b/src/intervals.h
index 6cf5c89374b..720598fe7a6 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -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)