aboutsummaryrefslogtreecommitdiffstats
path: root/src/region-cache.c
diff options
context:
space:
mode:
authorDan Nicolaescu2010-07-04 00:50:25 -0700
committerDan Nicolaescu2010-07-04 00:50:25 -0700
commit971de7fb158335fbda39525feb2d7776a26bc030 (patch)
tree605333d85f16e35bb06baffcb66ac49f4ec0dce9 /src/region-cache.c
parentb8463cbfbe2c5183cf40772df2746e58b787ddeb (diff)
downloademacs-971de7fb158335fbda39525feb2d7776a26bc030.tar.gz
emacs-971de7fb158335fbda39525feb2d7776a26bc030.zip
Convert (most) functions in src to standard C.
* src/alloc.c: Convert function definitions to standard C. * src/atimer.c: * src/bidi.c: * src/bytecode.c: * src/callint.c: * src/callproc.c: * src/casefiddle.c: * src/casetab.c: * src/category.c: * src/ccl.c: * src/character.c: * src/charset.c: * src/chartab.c: * src/cmds.c: * src/coding.c: * src/composite.c: * src/data.c: * src/dbusbind.c: * src/dired.c: * src/dispnew.c: * src/doc.c: * src/doprnt.c: * src/ecrt0.c: * src/editfns.c: * src/fileio.c: * src/filelock.c: * src/filemode.c: * src/fns.c: * src/font.c: * src/fontset.c: * src/frame.c: * src/fringe.c: * src/ftfont.c: * src/ftxfont.c: * src/gtkutil.c: * src/indent.c: * src/insdel.c: * src/intervals.c: * src/keymap.c: * src/lread.c: * src/macros.c: * src/marker.c: * src/md5.c: * src/menu.c: * src/minibuf.c: * src/prefix-args.c: * src/print.c: * src/ralloc.c: * src/regex.c: * src/region-cache.c: * src/scroll.c: * src/search.c: * src/sound.c: * src/strftime.c: * src/syntax.c: * src/sysdep.c: * src/termcap.c: * src/terminal.c: * src/terminfo.c: * src/textprop.c: * src/tparam.c: * src/undo.c: * src/unexelf.c: * src/window.c: * src/xfaces.c: * src/xfns.c: * src/xfont.c: * src/xftfont.c: * src/xgselect.c: * src/xmenu.c: * src/xrdb.c: * src/xselect.c: * src/xsettings.c: * src/xsmfns.c: * src/xterm.c: Likewise.
Diffstat (limited to 'src/region-cache.c')
-rw-r--r--src/region-cache.c59
1 files changed, 14 insertions, 45 deletions
diff --git a/src/region-cache.c b/src/region-cache.c
index d03d7df0bda..45eb723c885 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -122,13 +122,13 @@ struct region_cache {
122 preserve that information, instead of throwing it away. */ 122 preserve that information, instead of throwing it away. */
123#define PRESERVE_THRESHOLD (500) 123#define PRESERVE_THRESHOLD (500)
124 124
125static void revalidate_region_cache (); 125static void revalidate_region_cache (struct buffer *buf, struct region_cache *c);
126 126
127 127
128/* Interface: Allocating, initializing, and disposing of region caches. */ 128/* Interface: Allocating, initializing, and disposing of region caches. */
129 129
130struct region_cache * 130struct region_cache *
131new_region_cache () 131new_region_cache (void)
132{ 132{
133 struct region_cache *c 133 struct region_cache *c
134 = (struct region_cache *) xmalloc (sizeof (struct region_cache)); 134 = (struct region_cache *) xmalloc (sizeof (struct region_cache));
@@ -156,8 +156,7 @@ new_region_cache ()
156} 156}
157 157
158void 158void
159free_region_cache (c) 159free_region_cache (struct region_cache *c)
160 struct region_cache *c;
161{ 160{
162 xfree (c->boundaries); 161 xfree (c->boundaries);
163 xfree (c); 162 xfree (c);
@@ -174,9 +173,7 @@ free_region_cache (c)
174 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
175 reference, too, by searching entries near the last entry found. */ 174 reference, too, by searching entries near the last entry found. */
176static int 175static int
177find_cache_boundary (c, pos) 176find_cache_boundary (struct region_cache *c, int pos)
178 struct region_cache *c;
179 int pos;
180{ 177{
181 int low = 0, high = c->cache_len; 178 int low = 0, high = c->cache_len;
182 179
@@ -210,10 +207,7 @@ find_cache_boundary (c, pos)
210/* 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
211 for at least MIN_SIZE boundaries. */ 208 for at least MIN_SIZE boundaries. */
212static void 209static void
213move_cache_gap (c, pos, min_size) 210move_cache_gap (struct region_cache *c, int pos, int min_size)
214 struct region_cache *c;
215 int pos;
216 int min_size;
217{ 211{
218 /* Copy these out of the cache and into registers. */ 212 /* Copy these out of the cache and into registers. */
219 int gap_start = c->gap_start; 213 int gap_start = c->gap_start;
@@ -298,10 +292,7 @@ move_cache_gap (c, pos, min_size)
298/* 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,
299 and have the specified POS and VALUE. */ 293 and have the specified POS and VALUE. */
300static void 294static void
301insert_cache_boundary (c, index, pos, value) 295insert_cache_boundary (struct region_cache *c, int index, int pos, int value)
302 struct region_cache *c;
303 int index;
304 int pos, value;
305{ 296{
306 /* index must be a valid cache index. */ 297 /* index must be a valid cache index. */
307 if (index < 0 || index > c->cache_len) 298 if (index < 0 || index > c->cache_len)
@@ -337,9 +328,7 @@ insert_cache_boundary (c, index, pos, value)
337/* Delete the i'th entry from cache C if START <= i < END. */ 328/* Delete the i'th entry from cache C if START <= i < END. */
338 329
339static void 330static void
340delete_cache_boundaries (c, start, end) 331delete_cache_boundaries (struct region_cache *c, int start, int end)
341 struct region_cache *c;
342 int start, end;
343{ 332{
344 int len = end - start; 333 int len = end - start;
345 334
@@ -391,10 +380,7 @@ delete_cache_boundaries (c, start, end)
391 380
392/* Set the value in cache C for the region START..END to VALUE. */ 381/* Set the value in cache C for the region START..END to VALUE. */
393static void 382static void
394set_cache_region (c, start, end, value) 383set_cache_region (struct region_cache *c, int start, int end, int value)
395 struct region_cache *c;
396 int start, end;
397 int value;
398{ 384{
399 if (start > end) 385 if (start > end)
400 abort (); 386 abort ();
@@ -495,10 +481,7 @@ set_cache_region (c, start, end, value)
495 buffer positions in the presence of insertions and deletions; the 481 buffer positions in the presence of insertions and deletions; the
496 args to pass are the same before and after such an operation.) */ 482 args to pass are the same before and after such an operation.) */
497void 483void
498invalidate_region_cache (buf, c, head, tail) 484invalidate_region_cache (struct buffer *buf, struct region_cache *c, int head, int tail)
499 struct buffer *buf;
500 struct region_cache *c;
501 int head, tail;
502{ 485{
503 /* Let chead = c->beg_unchanged, and 486 /* Let chead = c->beg_unchanged, and
504 ctail = c->end_unchanged. 487 ctail = c->end_unchanged.
@@ -576,9 +559,7 @@ invalidate_region_cache (buf, c, head, tail)
576 the cache, and causes cache gap motion. */ 559 the cache, and causes cache gap motion. */
577 560
578static void 561static void
579revalidate_region_cache (buf, c) 562revalidate_region_cache (struct buffer *buf, struct region_cache *c)
580 struct buffer *buf;
581 struct region_cache *c;
582{ 563{
583 /* The boundaries now in the cache are expressed relative to the 564 /* The boundaries now in the cache are expressed relative to the
584 buffer_beg and buffer_end values stored in the cache. Now, 565 buffer_beg and buffer_end values stored in the cache. Now,
@@ -706,10 +687,7 @@ revalidate_region_cache (buf, c)
706 buffer positions) is "known," for the purposes of CACHE (e.g. "has 687 buffer positions) is "known," for the purposes of CACHE (e.g. "has
707 no newlines", in the case of the line cache). */ 688 no newlines", in the case of the line cache). */
708void 689void
709know_region_cache (buf, c, start, end) 690know_region_cache (struct buffer *buf, struct region_cache *c, int start, int end)
710 struct buffer *buf;
711 struct region_cache *c;
712 int start, end;
713{ 691{
714 revalidate_region_cache (buf, c); 692 revalidate_region_cache (buf, c);
715 693
@@ -723,11 +701,7 @@ know_region_cache (buf, c, start, end)
723 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest 701 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest
724 position after POS where the knownness changes. */ 702 position after POS where the knownness changes. */
725int 703int
726region_cache_forward (buf, c, pos, next) 704region_cache_forward (struct buffer *buf, struct region_cache *c, int pos, int *next)
727 struct buffer *buf;
728 struct region_cache *c;
729 int pos;
730 int *next;
731{ 705{
732 revalidate_region_cache (buf, c); 706 revalidate_region_cache (buf, c);
733 707
@@ -762,11 +736,7 @@ region_cache_forward (buf, c, pos, next)
762/* Return true if the text immediately before POS in BUF is known, for 736/* Return true if the text immediately before POS in BUF is known, for
763 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest 737 the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest
764 position before POS where the knownness changes. */ 738 position before POS where the knownness changes. */
765int region_cache_backward (buf, c, pos, next) 739int region_cache_backward (struct buffer *buf, struct region_cache *c, int pos, int *next)
766 struct buffer *buf;
767 struct region_cache *c;
768 int pos;
769 int *next;
770{ 740{
771 revalidate_region_cache (buf, c); 741 revalidate_region_cache (buf, c);
772 742
@@ -804,8 +774,7 @@ int region_cache_backward (buf, c, pos, next)
804/* Debugging: pretty-print a cache to the standard error output. */ 774/* Debugging: pretty-print a cache to the standard error output. */
805 775
806void 776void
807pp_cache (c) 777pp_cache (struct region_cache *c)
808 struct region_cache *c;
809{ 778{
810 int i; 779 int i;
811 int beg_u = c->buffer_beg + c->beg_unchanged; 780 int beg_u = c->buffer_beg + c->beg_unchanged;