Commit f5c7fc27 authored by Lars Magne Ingebrigtsen's avatar Lars Magne Ingebrigtsen
Browse files

Fix EMACS_INT/int conversion in region-cache.c.

parent db063399
2010-09-24 Lars Magne Ingebrigtsen <larsi@gnus.org> 2010-09-24 Lars Magne Ingebrigtsen <larsi@gnus.org>
   
* region-cache.c (move_cache_gap, set_cache_region, pp_cache)
(region_cache_backward, region_cache_forward)
(revalidate_region_cache, set_cache_region): FIX EMACS_INT/int
conversion.
* xdisp.c (message_dolog): Fix EMACS_INT/int conversion. * xdisp.c (message_dolog): Fix EMACS_INT/int conversion.
   
* eval.c (verror): Fix EMACS_INT/int conversion. * eval.c (verror): Fix EMACS_INT/int conversion.
......
...@@ -76,7 +76,7 @@ struct region_cache { ...@@ -76,7 +76,7 @@ struct region_cache {
/* The number of elements allocated to boundaries, not including the /* The number of elements allocated to boundaries, not including the
gap. */ gap. */
int cache_len; EMACS_INT cache_len;
/* The areas that haven't changed since the last time we cleaned out /* The areas that haven't changed since the last time we cleaned out
invalid entries from the cache. These overlap when the buffer is invalid entries from the cache. These overlap when the buffer is
...@@ -172,16 +172,16 @@ free_region_cache (struct region_cache *c) ...@@ -172,16 +172,16 @@ free_region_cache (struct region_cache *c)
This operation should be logarithmic in the number of cache This operation should be logarithmic in the number of cache
entries. It would be nice if it took advantage of locality of entries. It would be nice if it took advantage of locality of
reference, too, by searching entries near the last entry found. */ reference, too, by searching entries near the last entry found. */
static int static EMACS_INT
find_cache_boundary (struct region_cache *c, EMACS_INT pos) find_cache_boundary (struct region_cache *c, EMACS_INT pos)
{ {
int low = 0, high = c->cache_len; EMACS_INT low = 0, high = c->cache_len;
while (low + 1 < high) while (low + 1 < high)
{ {
/* mid is always a valid index, because low < high and ">> 1" /* mid is always a valid index, because low < high and ">> 1"
rounds down. */ rounds down. */
int mid = (low + high) >> 1; EMACS_INT mid = (low + high) >> 1;
EMACS_INT boundary = BOUNDARY_POS (c, mid); EMACS_INT boundary = BOUNDARY_POS (c, mid);
if (pos < boundary) if (pos < boundary)
...@@ -207,7 +207,7 @@ find_cache_boundary (struct region_cache *c, EMACS_INT pos) ...@@ -207,7 +207,7 @@ find_cache_boundary (struct region_cache *c, EMACS_INT pos)
/* Move the gap of cache C to index POS, and make sure it has space /* Move the gap of cache C to index POS, and make sure it has space
for at least MIN_SIZE boundaries. */ for at least MIN_SIZE boundaries. */
static void static void
move_cache_gap (struct region_cache *c, EMACS_INT pos, int min_size) move_cache_gap (struct region_cache *c, EMACS_INT pos, EMACS_INT min_size)
{ {
/* Copy these out of the cache and into registers. */ /* Copy these out of the cache and into registers. */
EMACS_INT gap_start = c->gap_start; 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,7 +292,7 @@ move_cache_gap (struct region_cache *c, EMACS_INT pos, int min_size)
/* Insert a new boundary in cache C; it will have cache index INDEX, /* Insert a new boundary in cache C; it will have cache index INDEX,
and have the specified POS and VALUE. */ and have the specified POS and VALUE. */
static void static void
insert_cache_boundary (struct region_cache *c, int index, EMACS_INT pos, insert_cache_boundary (struct region_cache *c, EMACS_INT index, EMACS_INT pos,
int value) int value)
{ {
/* index must be a valid cache index. */ /* index must be a valid cache index. */
...@@ -406,8 +406,8 @@ set_cache_region (struct region_cache *c, ...@@ -406,8 +406,8 @@ set_cache_region (struct region_cache *c,
index of the earliest boundary after the last character in index of the earliest boundary after the last character in
start..end. (This tortured terminology is intended to answer start..end. (This tortured terminology is intended to answer
all the "< or <=?" sort of questions.) */ all the "< or <=?" sort of questions.) */
int start_ix = find_cache_boundary (c, start); EMACS_INT start_ix = find_cache_boundary (c, start);
int end_ix = find_cache_boundary (c, end - 1) + 1; EMACS_INT end_ix = find_cache_boundary (c, end - 1) + 1;
/* We must remember the value established by the last boundary /* We must remember the value established by the last boundary
before end; if that boundary's domain stretches beyond end, 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,7 +623,7 @@ revalidate_region_cache (struct buffer *buf, struct region_cache *c)
corresponds to the modified region of the buffer. */ corresponds to the modified region of the buffer. */
else else
{ {
int modified_ix; EMACS_INT modified_ix;
/* These positions are correct, relative to both the cache basis /* These positions are correct, relative to both the cache basis
and the buffer basis. */ and the buffer basis. */
...@@ -712,9 +712,9 @@ region_cache_forward (struct buffer *buf, struct region_cache *c, ...@@ -712,9 +712,9 @@ region_cache_forward (struct buffer *buf, struct region_cache *c,
revalidate_region_cache (buf, c); revalidate_region_cache (buf, c);
{ {
int i = find_cache_boundary (c, pos); EMACS_INT i = find_cache_boundary (c, pos);
int i_value = BOUNDARY_VALUE (c, i); int i_value = BOUNDARY_VALUE (c, i);
int j; EMACS_INT j;
/* Beyond the end of the buffer is unknown, by definition. */ /* Beyond the end of the buffer is unknown, by definition. */
if (pos >= BUF_Z (buf)) if (pos >= BUF_Z (buf))
...@@ -756,9 +756,9 @@ int region_cache_backward (struct buffer *buf, struct region_cache *c, ...@@ -756,9 +756,9 @@ int region_cache_backward (struct buffer *buf, struct region_cache *c,
} }
{ {
int i = find_cache_boundary (c, pos - 1); EMACS_INT i = find_cache_boundary (c, pos - 1);
int i_value = BOUNDARY_VALUE (c, i); int i_value = BOUNDARY_VALUE (c, i);
int j; EMACS_INT j;
if (next) if (next)
{ {
...@@ -794,7 +794,7 @@ pp_cache (struct region_cache *c) ...@@ -794,7 +794,7 @@ pp_cache (struct region_cache *c)
for (i = 0; i < c->cache_len; i++) for (i = 0; i < c->cache_len; i++)
{ {
int pos = BOUNDARY_POS (c, i); EMACS_INT pos = BOUNDARY_POS (c, i);
putc (((pos < beg_u) ? 'v' putc (((pos < beg_u) ? 'v'
: (pos == beg_u) ? '-' : (pos == beg_u) ? '-'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment