Mercurial > emacs
changeset 110505:e67da919e2b5
Fix uses of int instead of EMACS_INT in intervals.c.
intervals.c (traverse_intervals, rotate_right, rotate_left)
(balance_an_interval, split_interval_right, split_interval_left)
(find_interval, next_interval, update_interval)
(adjust_intervals_for_insertion, delete_node, delete_interval)
(interval_deletion_adjustment, adjust_intervals_for_deletion)
(offset_intervals, merge_interval_right, merge_interval_left)
(graft_intervals_into_buffer, adjust_for_invis_intang)
(move_if_not_intangible, get_local_map, copy_intervals)
(copy_intervals_to_string, compare_string_intervals)
(set_intervals_multibyte_1): Use EMACS_INT for buffer positions
and EMACS_UINT for interval tree size.
intervals.h (traverse_intervals, split_interval_right)
(split_interval_left, find_interval, offset_intervals)
(graft_intervals_into_buffer, copy_intervals)
(copy_intervals_to_string, move_if_not_intangible, get_local_map)
(update_interval): Adjust prototypes.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Thu, 23 Sep 2010 11:46:54 -0400 |
parents | 0fdd992ff057 |
children | 2cac83f5f8bc |
files | src/ChangeLog src/intervals.c src/intervals.h |
diffstat | 3 files changed, 93 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Thu Sep 23 10:32:38 2010 -0400 +++ b/src/ChangeLog Thu Sep 23 11:46:54 2010 -0400 @@ -1,5 +1,23 @@ 2010-09-23 Eli Zaretskii <eliz@gnu.org> + * intervals.c (traverse_intervals, rotate_right, rotate_left) + (balance_an_interval, split_interval_right, split_interval_left) + (find_interval, next_interval, update_interval) + (adjust_intervals_for_insertion, delete_node, delete_interval) + (interval_deletion_adjustment, adjust_intervals_for_deletion) + (offset_intervals, merge_interval_right, merge_interval_left) + (graft_intervals_into_buffer, adjust_for_invis_intang) + (move_if_not_intangible, get_local_map, copy_intervals) + (copy_intervals_to_string, compare_string_intervals) + (set_intervals_multibyte_1): Use EMACS_INT for buffer positions + and EMACS_UINT for interval tree size. + + * intervals.h (traverse_intervals, split_interval_right) + (split_interval_left, find_interval, offset_intervals) + (graft_intervals_into_buffer, copy_intervals) + (copy_intervals_to_string, move_if_not_intangible, get_local_map) + (update_interval): Adjust prototypes. + * xdisp.c (check_point_in_composition, reconsider_clip_changes): Use EMACS_INT for buffer position variables and arguments.
--- a/src/intervals.c Thu Sep 23 10:32:38 2010 -0400 +++ b/src/intervals.c Thu Sep 23 11:46:54 2010 -0400 @@ -222,7 +222,8 @@ Pass FUNCTION two args: an interval, and ARG. */ void -traverse_intervals (INTERVAL tree, int position, void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) +traverse_intervals (INTERVAL tree, EMACS_UINT position, + void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) { while (!NULL_INTERVAL_P (tree)) { @@ -316,7 +317,7 @@ { INTERVAL i; INTERVAL B = interval->left; - int old_total = interval->total_length; + EMACS_UINT old_total = interval->total_length; /* Deal with any Parent of A; make it point to B. */ if (! ROOT_INTERVAL_P (interval)) @@ -363,7 +364,7 @@ { INTERVAL i; INTERVAL B = interval->right; - int old_total = interval->total_length; + EMACS_UINT old_total = interval->total_length; /* Deal with any parent of A; make it point to B. */ if (! ROOT_INTERVAL_P (interval)) @@ -402,7 +403,7 @@ static INTERVAL balance_an_interval (INTERVAL i) { - register int old_diff, new_diff; + register EMACS_INT old_diff, new_diff; while (1) { @@ -502,11 +503,11 @@ it is still a root after this operation. */ INTERVAL -split_interval_right (INTERVAL interval, int offset) +split_interval_right (INTERVAL interval, EMACS_INT offset) { INTERVAL new = make_interval (); - int position = interval->position; - int new_length = LENGTH (interval) - offset; + EMACS_UINT position = interval->position; + EMACS_UINT new_length = LENGTH (interval) - offset; new->position = position + offset; SET_INTERVAL_PARENT (new, interval); @@ -547,10 +548,10 @@ it is still a root after this operation. */ INTERVAL -split_interval_left (INTERVAL interval, int offset) +split_interval_left (INTERVAL interval, EMACS_INT offset) { INTERVAL new = make_interval (); - int new_length = offset; + EMACS_INT new_length = offset; new->position = interval->position; interval->position = interval->position + offset; @@ -613,11 +614,11 @@ will update this cache based on the result of find_interval. */ INTERVAL -find_interval (register INTERVAL tree, register int position) +find_interval (register INTERVAL tree, register EMACS_INT position) { /* The distance from the left edge of the subtree at TREE to POSITION. */ - register int relative_position; + register EMACS_UINT relative_position; if (NULL_INTERVAL_P (tree)) return NULL_INTERVAL; @@ -670,7 +671,7 @@ next_interval (register INTERVAL interval) { register INTERVAL i = interval; - register int next_position; + register EMACS_UINT next_position; if (NULL_INTERVAL_P (i)) return NULL_INTERVAL; @@ -745,7 +746,7 @@ To speed up the process, we assume that the ->position of I and all its parents is already uptodate. */ INTERVAL -update_interval (register INTERVAL i, int pos) +update_interval (register INTERVAL i, EMACS_INT pos) { if (NULL_INTERVAL_P (i)) return NULL_INTERVAL; @@ -864,13 +865,14 @@ this text, and make it have the merged properties of both ends. */ static INTERVAL -adjust_intervals_for_insertion (INTERVAL tree, int position, int length) +adjust_intervals_for_insertion (INTERVAL tree, + EMACS_INT position, EMACS_INT length) { register INTERVAL i; register INTERVAL temp; int eobp = 0; Lisp_Object parent; - int offset; + EMACS_INT offset; if (TOTAL_LENGTH (tree) == 0) /* Paranoia */ abort (); @@ -1228,7 +1230,7 @@ delete_node (register INTERVAL i) { register INTERVAL migrate, this; - register int migrate_amt; + register EMACS_UINT migrate_amt; if (NULL_INTERVAL_P (i->left)) return i->right; @@ -1261,7 +1263,7 @@ delete_interval (register INTERVAL i) { register INTERVAL parent; - int amt = LENGTH (i); + EMACS_UINT amt = LENGTH (i); if (amt > 0) /* Only used on zero-length intervals now. */ abort (); @@ -1311,10 +1313,11 @@ Do this by recursing down TREE to the interval in question, and deleting the appropriate amount of text. */ -static int -interval_deletion_adjustment (register INTERVAL tree, register int from, register int amount) +static EMACS_UINT +interval_deletion_adjustment (register INTERVAL tree, register EMACS_UINT from, + register EMACS_UINT amount) { - register int relative_position = from; + register EMACS_UINT relative_position = from; if (NULL_INTERVAL_P (tree)) return 0; @@ -1322,9 +1325,9 @@ /* Left branch */ if (relative_position < LEFT_TOTAL_LENGTH (tree)) { - int subtract = interval_deletion_adjustment (tree->left, - relative_position, - amount); + EMACS_UINT subtract = interval_deletion_adjustment (tree->left, + relative_position, + amount); tree->total_length -= subtract; CHECK_TOTAL_LENGTH (tree); return subtract; @@ -1333,7 +1336,7 @@ else if (relative_position >= (TOTAL_LENGTH (tree) - RIGHT_TOTAL_LENGTH (tree))) { - int subtract; + EMACS_UINT subtract; relative_position -= (tree->total_length - RIGHT_TOTAL_LENGTH (tree)); @@ -1348,9 +1351,9 @@ else { /* How much can we delete from this interval? */ - int my_amount = ((tree->total_length - - RIGHT_TOTAL_LENGTH (tree)) - - relative_position); + EMACS_UINT my_amount = ((tree->total_length + - RIGHT_TOTAL_LENGTH (tree)) + - relative_position); if (amount > my_amount) amount = my_amount; @@ -1372,12 +1375,13 @@ buffer position, i.e. origin 1). */ static void -adjust_intervals_for_deletion (struct buffer *buffer, int start, int length) +adjust_intervals_for_deletion (struct buffer *buffer, + EMACS_INT start, EMACS_INT length) { - register int left_to_delete = length; + register EMACS_INT left_to_delete = length; register INTERVAL tree = BUF_INTERVALS (buffer); Lisp_Object parent; - int offset; + EMACS_UINT offset; GET_INTERVAL_OBJECT (parent, tree); offset = (BUFFERP (parent) ? BUF_BEG (XBUFFER (parent)) : 0); @@ -1423,7 +1427,7 @@ of LENGTH. */ INLINE void -offset_intervals (struct buffer *buffer, int start, int length) +offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length) { if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0) return; @@ -1446,7 +1450,7 @@ INTERVAL merge_interval_right (register INTERVAL i) { - register int absorb = LENGTH (i); + register EMACS_UINT absorb = LENGTH (i); register INTERVAL successor; /* Zero out this interval. */ @@ -1502,7 +1506,7 @@ INTERVAL merge_interval_left (register INTERVAL i) { - register int absorb = LENGTH (i); + register EMACS_UINT absorb = LENGTH (i); register INTERVAL predecessor; /* Zero out this interval. */ @@ -1598,7 +1602,7 @@ static INTERVAL make_new_interval (intervals, start, length) INTERVAL intervals; - int start, length; + EMACS_INT start, length; { INTERVAL slot; @@ -1670,11 +1674,13 @@ text... */ void -graft_intervals_into_buffer (INTERVAL source, int position, int length, struct buffer *buffer, int inherit) +graft_intervals_into_buffer (INTERVAL source, EMACS_INT position, + EMACS_INT length, struct buffer *buffer, + int inherit) { register INTERVAL under, over, this, prev; register INTERVAL tree; - int over_used; + EMACS_UINT over_used; tree = BUF_INTERVALS (buffer); @@ -1921,7 +1927,8 @@ if the invisible property comes from an overlay. */ static int -adjust_for_invis_intang (int pos, int test_offs, int adj, int test_intang) +adjust_for_invis_intang (EMACS_INT pos, EMACS_INT test_offs, EMACS_INT adj, + int test_intang) { Lisp_Object invis_propval, invis_overlay; Lisp_Object test_pos; @@ -2183,7 +2190,7 @@ segment that reaches all the way to point. */ void -move_if_not_intangible (int position) +move_if_not_intangible (EMACS_INT position) { Lisp_Object pos; Lisp_Object intangible_propval; @@ -2290,10 +2297,11 @@ POSITION must be in the accessible part of BUFFER. */ Lisp_Object -get_local_map (register int position, register struct buffer *buffer, Lisp_Object type) +get_local_map (register EMACS_INT position, register struct buffer *buffer, + Lisp_Object type) { Lisp_Object prop, lispy_position, lispy_buffer; - int old_begv, old_zv, old_begv_byte, old_zv_byte; + EMACS_INT old_begv, old_zv, old_begv_byte, old_zv_byte; /* Perhaps we should just change `position' to the limit. */ if (position > BUF_ZV (buffer) || position < BUF_BEGV (buffer)) @@ -2343,10 +2351,10 @@ The new interval tree has no parent and has a starting-position of 0. */ INTERVAL -copy_intervals (INTERVAL tree, int start, int length) +copy_intervals (INTERVAL tree, EMACS_INT start, EMACS_INT length) { register INTERVAL i, new, t; - register int got, prevlen; + register EMACS_UINT got, prevlen; if (NULL_INTERVAL_P (tree) || length <= 0) return NULL_INTERVAL; @@ -2384,7 +2392,8 @@ /* Give STRING the properties of BUFFER from POSITION to LENGTH. */ INLINE void -copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, int position, int length) +copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, + EMACS_INT position, EMACS_INT length) { INTERVAL interval_copy = copy_intervals (BUF_INTERVALS (buffer), position, length); @@ -2402,8 +2411,8 @@ compare_string_intervals (Lisp_Object s1, Lisp_Object s2) { INTERVAL i1, i2; - int pos = 0; - int end = SCHARS (s1); + EMACS_INT pos = 0; + EMACS_INT end = SCHARS (s1); i1 = find_interval (STRING_INTERVALS (s1), 0); i2 = find_interval (STRING_INTERVALS (s2), 0); @@ -2411,9 +2420,9 @@ while (pos < end) { /* Determine how far we can go before we reach the end of I1 or I2. */ - int len1 = (i1 != 0 ? INTERVAL_LAST_POS (i1) : end) - pos; - int len2 = (i2 != 0 ? INTERVAL_LAST_POS (i2) : end) - pos; - int distance = min (len1, len2); + EMACS_INT len1 = (i1 != 0 ? INTERVAL_LAST_POS (i1) : end) - pos; + EMACS_INT len2 = (i2 != 0 ? INTERVAL_LAST_POS (i2) : end) - pos; + EMACS_INT distance = min (len1, len2); /* If we ever find a mismatch between the strings, they differ. */ @@ -2437,7 +2446,9 @@ START_BYTE ... END_BYTE in bytes. */ static void -set_intervals_multibyte_1 (INTERVAL i, int multi_flag, int start, int start_byte, int end, int end_byte) +set_intervals_multibyte_1 (INTERVAL i, int multi_flag, + EMACS_INT start, EMACS_INT start_byte, + EMACS_INT end, EMACS_INT end_byte) { /* Fix the length of this interval. */ if (multi_flag) @@ -2455,11 +2466,11 @@ /* Recursively fix the length of the subintervals. */ if (i->left) { - int left_end, left_end_byte; + EMACS_INT left_end, left_end_byte; if (multi_flag) { - int temp; + EMACS_INT temp; left_end_byte = start_byte + LEFT_TOTAL_LENGTH (i); left_end = BYTE_TO_CHAR (left_end_byte); @@ -2488,11 +2499,11 @@ } if (i->right) { - int right_start_byte, right_start; + EMACS_INT right_start_byte, right_start; if (multi_flag) { - int temp; + EMACS_INT temp; right_start_byte = end_byte - RIGHT_TOTAL_LENGTH (i); right_start = BYTE_TO_CHAR (right_start_byte);
--- a/src/intervals.h Thu Sep 23 10:32:38 2010 -0400 +++ b/src/intervals.h Thu Sep 23 11:46:54 2010 -0400 @@ -250,36 +250,36 @@ extern INTERVAL create_root_interval (Lisp_Object); extern void copy_properties (INTERVAL, INTERVAL); extern int intervals_equal (INTERVAL, INTERVAL); -extern void traverse_intervals (INTERVAL, int, +extern void traverse_intervals (INTERVAL, EMACS_UINT, void (*) (INTERVAL, Lisp_Object), Lisp_Object); extern void traverse_intervals_noorder (INTERVAL, void (*) (INTERVAL, Lisp_Object), Lisp_Object); -extern INTERVAL split_interval_right (INTERVAL, int); -extern INTERVAL split_interval_left (INTERVAL, int); -extern INTERVAL find_interval (INTERVAL, int); +extern INTERVAL split_interval_right (INTERVAL, EMACS_INT); +extern INTERVAL split_interval_left (INTERVAL, EMACS_INT); +extern INTERVAL find_interval (INTERVAL, EMACS_INT); extern INTERVAL next_interval (INTERVAL); extern INTERVAL previous_interval (INTERVAL); extern INTERVAL merge_interval_left (INTERVAL); extern INTERVAL merge_interval_right (INTERVAL); extern void delete_interval (INTERVAL); -extern INLINE void offset_intervals (struct buffer *, int, int); -extern void graft_intervals_into_buffer (INTERVAL, int, int, +extern INLINE void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT); +extern void graft_intervals_into_buffer (INTERVAL, EMACS_INT, EMACS_INT, struct buffer *, int); extern void verify_interval_modification (struct buffer *, int, int); extern INTERVAL balance_intervals (INTERVAL); extern INLINE void copy_intervals_to_string (Lisp_Object, struct buffer *, - int, int); -extern INTERVAL copy_intervals (INTERVAL, int, int); + EMACS_INT, EMACS_INT); +extern INTERVAL copy_intervals (INTERVAL, EMACS_INT, EMACS_INT); extern int compare_string_intervals (Lisp_Object, Lisp_Object); extern Lisp_Object textget (Lisp_Object, Lisp_Object); extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, int); -extern void move_if_not_intangible (int); +extern void move_if_not_intangible (EMACS_INT); extern int get_property_and_range (EMACS_INT, Lisp_Object, Lisp_Object *, EMACS_INT *, EMACS_INT *, Lisp_Object); -extern Lisp_Object get_local_map (int, struct buffer *, Lisp_Object); -extern INTERVAL update_interval (INTERVAL, int); +extern Lisp_Object get_local_map (EMACS_INT, struct buffer *, Lisp_Object); +extern INTERVAL update_interval (INTERVAL, EMACS_INT); extern void set_intervals_multibyte (int); extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *, Lisp_Object *, int);