aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2010-09-24 17:13:43 +0200
committerLars Magne Ingebrigtsen2010-09-24 17:13:43 +0200
commitf5c7fc2739e556fc377868b8ef5399dc52287bd2 (patch)
treeb12bb25e95861b788327039725cd5b6781898e94
parentdb063399123f02faeec4beaedf2ee375a9a50c49 (diff)
downloademacs-f5c7fc2739e556fc377868b8ef5399dc52287bd2.tar.gz
emacs-f5c7fc2739e556fc377868b8ef5399dc52287bd2.zip
Fix EMACS_INT/int conversion in region-cache.c.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/region-cache.c28
2 files changed, 19 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ecebe75e7ff..867abf25749 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
12010-09-24 Lars Magne Ingebrigtsen <larsi@gnus.org> 12010-09-24 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 2
3 * region-cache.c (move_cache_gap, set_cache_region, pp_cache)
4 (region_cache_backward, region_cache_forward)
5 (revalidate_region_cache, set_cache_region): FIX EMACS_INT/int
6 conversion.
7
3 * xdisp.c (message_dolog): Fix EMACS_INT/int conversion. 8 * xdisp.c (message_dolog): Fix EMACS_INT/int conversion.
4 9
5 * eval.c (verror): Fix EMACS_INT/int conversion. 10 * eval.c (verror): Fix EMACS_INT/int conversion.
diff --git a/src/region-cache.c b/src/region-cache.c
index b3eb4beac02..b6c43359b1b 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -76,7 +76,7 @@ struct region_cache {
76 76
77 /* The number of elements allocated to boundaries, not including the 77 /* The number of elements allocated to boundaries, not including the
78 gap. */ 78 gap. */
79 int cache_len; 79 EMACS_INT cache_len;
80 80
81 /* The areas that haven't changed since the last time we cleaned out 81 /* The areas that haven't changed since the last time we cleaned out
82 invalid entries from the cache. These overlap when the buffer is 82 invalid entries from the cache. These overlap when the buffer is
@@ -172,16 +172,16 @@ free_region_cache (struct region_cache *c)
172 This operation should be logarithmic in the number of cache 172 This operation should be logarithmic in the number of cache
173 entries. It would be nice if it took advantage of locality of 173 entries. It would be nice if it took advantage of locality of
174 reference, too, by searching entries near the last entry found. */ 174 reference, too, by searching entries near the last entry found. */
175static int 175static EMACS_INT
176find_cache_boundary (struct region_cache *c, EMACS_INT pos) 176find_cache_boundary (struct region_cache *c, EMACS_INT pos)
177{ 177{
178 int low = 0, high = c->cache_len; 178 EMACS_INT low = 0, high = c->cache_len;
179 179
180 while (low + 1 < high) 180 while (low + 1 < high)
181 { 181 {
182 /* mid is always a valid index, because low < high and ">> 1" 182 /* mid is always a valid index, because low < high and ">> 1"
183 rounds down. */ 183 rounds down. */
184 int mid = (low + high) >> 1; 184 EMACS_INT mid = (low + high) >> 1;
185 EMACS_INT boundary = BOUNDARY_POS (c, mid); 185 EMACS_INT boundary = BOUNDARY_POS (c, mid);
186 186
187 if (pos < boundary) 187 if (pos < boundary)
@@ -207,7 +207,7 @@ find_cache_boundary (struct region_cache *c, EMACS_INT pos)
207/* Move the gap of cache C to index POS, and make sure it has space 207/* Move the gap of cache C to index POS, and make sure it has space
208 for at least MIN_SIZE boundaries. */ 208 for at least MIN_SIZE boundaries. */
209static void 209static void
210move_cache_gap (struct region_cache *c, EMACS_INT pos, int min_size) 210move_cache_gap (struct region_cache *c, EMACS_INT pos, EMACS_INT min_size)
211{ 211{
212 /* Copy these out of the cache and into registers. */ 212 /* Copy these out of the cache and into registers. */
213 EMACS_INT gap_start = c->gap_start; 213 EMACS_INT gap_start = c->gap_start;
@@ -292,7 +292,7 @@ move_cache_gap (struct region_cache *c, EMACS_INT pos, int min_size)
292/* Insert a new boundary in cache C; it will have cache index INDEX, 292/* Insert a new boundary in cache C; it will have cache index INDEX,
293 and have the specified POS and VALUE. */ 293 and have the specified POS and VALUE. */
294static void 294static void
295insert_cache_boundary (struct region_cache *c, int index, EMACS_INT pos, 295insert_cache_boundary (struct region_cache *c, EMACS_INT index, EMACS_INT pos,
296 int value) 296 int value)
297{ 297{
298 /* index must be a valid cache index. */ 298 /* index must be a valid cache index. */
@@ -406,8 +406,8 @@ set_cache_region (struct region_cache *c,
406 index of the earliest boundary after the last character in 406 index of the earliest boundary after the last character in
407 start..end. (This tortured terminology is intended to answer 407 start..end. (This tortured terminology is intended to answer
408 all the "< or <=?" sort of questions.) */ 408 all the "< or <=?" sort of questions.) */
409 int start_ix = find_cache_boundary (c, start); 409 EMACS_INT start_ix = find_cache_boundary (c, start);
410 int end_ix = find_cache_boundary (c, end - 1) + 1; 410 EMACS_INT end_ix = find_cache_boundary (c, end - 1) + 1;
411 411
412 /* We must remember the value established by the last boundary 412 /* We must remember the value established by the last boundary
413 before end; if that boundary's domain stretches beyond end, 413 before end; if that boundary's domain stretches beyond end,
@@ -623,7 +623,7 @@ revalidate_region_cache (struct buffer *buf, struct region_cache *c)
623 corresponds to the modified region of the buffer. */ 623 corresponds to the modified region of the buffer. */
624 else 624 else
625 { 625 {
626 int modified_ix; 626 EMACS_INT modified_ix;
627 627
628 /* These positions are correct, relative to both the cache basis 628 /* These positions are correct, relative to both the cache basis
629 and the buffer basis. */ 629 and the buffer basis. */
@@ -712,9 +712,9 @@ region_cache_forward (struct buffer *buf, struct region_cache *c,
712 revalidate_region_cache (buf, c); 712 revalidate_region_cache (buf, c);
713 713
714 { 714 {
715 int i = find_cache_boundary (c, pos); 715 EMACS_INT i = find_cache_boundary (c, pos);
716 int i_value = BOUNDARY_VALUE (c, i); 716 int i_value = BOUNDARY_VALUE (c, i);
717 int j; 717 EMACS_INT j;
718 718
719 /* Beyond the end of the buffer is unknown, by definition. */ 719 /* Beyond the end of the buffer is unknown, by definition. */
720 if (pos >= BUF_Z (buf)) 720 if (pos >= BUF_Z (buf))
@@ -756,9 +756,9 @@ int region_cache_backward (struct buffer *buf, struct region_cache *c,
756 } 756 }
757 757
758 { 758 {
759 int i = find_cache_boundary (c, pos - 1); 759 EMACS_INT i = find_cache_boundary (c, pos - 1);
760 int i_value = BOUNDARY_VALUE (c, i); 760 int i_value = BOUNDARY_VALUE (c, i);
761 int j; 761 EMACS_INT j;
762 762
763 if (next) 763 if (next)
764 { 764 {
@@ -794,7 +794,7 @@ pp_cache (struct region_cache *c)
794 794
795 for (i = 0; i < c->cache_len; i++) 795 for (i = 0; i < c->cache_len; i++)
796 { 796 {
797 int pos = BOUNDARY_POS (c, i); 797 EMACS_INT pos = BOUNDARY_POS (c, i);
798 798
799 putc (((pos < beg_u) ? 'v' 799 putc (((pos < beg_u) ? 'v'
800 : (pos == beg_u) ? '-' 800 : (pos == beg_u) ? '-'