Mercurial > hg > xemacs-beta
comparison src/buffer.c @ 647:b39c14581166
[xemacs-hg @ 2001-08-13 04:45:47 by ben]
removal of unsigned, size_t, etc.
author | ben |
---|---|
date | Mon, 13 Aug 2001 04:46:48 +0000 |
parents | af57a77cbc92 |
children | fdefd0186b75 |
comparison
equal
deleted
inserted
replaced
646:00c54252fe4f | 647:b39c14581166 |
---|---|
1670 int markers; | 1670 int markers; |
1671 int extents; | 1671 int extents; |
1672 int other; | 1672 int other; |
1673 }; | 1673 }; |
1674 | 1674 |
1675 static size_t | 1675 static Memory_Count |
1676 compute_buffer_text_usage (struct buffer *b, struct overhead_stats *ovstats) | 1676 compute_buffer_text_usage (struct buffer *b, struct overhead_stats *ovstats) |
1677 { | 1677 { |
1678 int was_requested = b->text->z - 1; | 1678 int was_requested = b->text->z - 1; |
1679 size_t gap = b->text->gap_size + b->text->end_gap_size; | 1679 Memory_Count gap = b->text->gap_size + b->text->end_gap_size; |
1680 size_t malloc_use = malloced_storage_size (b->text->beg, was_requested + gap, 0); | 1680 Memory_Count malloc_use = malloced_storage_size (b->text->beg, was_requested + gap, 0); |
1681 | 1681 |
1682 ovstats->gap_overhead += gap; | 1682 ovstats->gap_overhead += gap; |
1683 ovstats->was_requested += was_requested; | 1683 ovstats->was_requested += was_requested; |
1684 ovstats->malloc_overhead += malloc_use - (was_requested + gap); | 1684 ovstats->malloc_overhead += malloc_use - (was_requested + gap); |
1685 return malloc_use; | 1685 return malloc_use; |
1911 /* decoding_stream will gc-protect outstream */ | 1911 /* decoding_stream will gc-protect outstream */ |
1912 GCPRO2 (instream, outstream); | 1912 GCPRO2 (instream, outstream); |
1913 | 1913 |
1914 while (1) | 1914 while (1) |
1915 { | 1915 { |
1916 Lstream_data_count size_in_bytes; | 1916 Lstream_Data_Count size_in_bytes; |
1917 char tempbuf[1024]; /* some random amount */ | 1917 char tempbuf[1024]; /* some random amount */ |
1918 | 1918 |
1919 size_in_bytes = Lstream_read (reader, tempbuf, sizeof (tempbuf)); | 1919 size_in_bytes = Lstream_read (reader, tempbuf, sizeof (tempbuf)); |
1920 | 1920 |
1921 if (size_in_bytes == 0) | 1921 if (size_in_bytes == 0) |
2049 /* outstream will gc-protect its sink stream, if necessary */ | 2049 /* outstream will gc-protect its sink stream, if necessary */ |
2050 GCPRO2 (instream, outstream); | 2050 GCPRO2 (instream, outstream); |
2051 | 2051 |
2052 while (1) | 2052 while (1) |
2053 { | 2053 { |
2054 Lstream_data_count size_in_bytes; | 2054 Lstream_Data_Count size_in_bytes; |
2055 char tempbuf[1024]; /* some random amount */ | 2055 char tempbuf[1024]; /* some random amount */ |
2056 | 2056 |
2057 size_in_bytes = Lstream_read (reader, tempbuf, sizeof (tempbuf)); | 2057 size_in_bytes = Lstream_read (reader, tempbuf, sizeof (tempbuf)); |
2058 | 2058 |
2059 if (size_in_bytes == 0) | 2059 if (size_in_bytes == 0) |
2319 | 2319 |
2320 /* The docstrings for DEFVAR_* are recorded externally by make-docfile. */ | 2320 /* The docstrings for DEFVAR_* are recorded externally by make-docfile. */ |
2321 | 2321 |
2322 /* Renamed from DEFVAR_PER_BUFFER because FSFmacs D_P_B takes | 2322 /* Renamed from DEFVAR_PER_BUFFER because FSFmacs D_P_B takes |
2323 a bogus extra arg, which confuses an otherwise identical make-docfile.c */ | 2323 a bogus extra arg, which confuses an otherwise identical make-docfile.c */ |
2324 #define DEFVAR_BUFFER_LOCAL_1(lname, field_name, forward_type, magicfun) do { \ | 2324 #define DEFVAR_BUFFER_LOCAL_1(lname, field_name, forward_type, magicfun) do { \ |
2325 static const struct symbol_value_forward I_hate_C = \ | 2325 static const struct symbol_value_forward I_hate_C = \ |
2326 { /* struct symbol_value_forward */ \ | 2326 { /* struct symbol_value_forward */ \ |
2327 { /* struct symbol_value_magic */ \ | 2327 { /* struct symbol_value_magic */ \ |
2328 { /* struct lcrecord_header */ \ | 2328 { /* struct lcrecord_header */ \ |
2329 { /* struct lrecord_header */ \ | 2329 { /* struct lrecord_header */ \ |
2330 lrecord_type_symbol_value_forward, /* lrecord_type_index */ \ | 2330 lrecord_type_symbol_value_forward, /* lrecord_type_index */ \ |
2331 1, /* mark bit */ \ | 2331 1, /* mark bit */ \ |
2332 1, /* c_readonly bit */ \ | 2332 1, /* c_readonly bit */ \ |
2333 1 /* lisp_readonly bit */ \ | 2333 1 /* lisp_readonly bit */ \ |
2334 }, \ | 2334 }, \ |
2335 0, /* next */ \ | 2335 0, /* next */ \ |
2336 0, /* uid */ \ | 2336 0, /* uid */ \ |
2337 0 /* free */ \ | 2337 0 /* free */ \ |
2338 }, \ | 2338 }, \ |
2339 &(buffer_local_flags.field_name), \ | 2339 &(buffer_local_flags.field_name), \ |
2340 forward_type \ | 2340 forward_type \ |
2341 }, \ | 2341 }, \ |
2342 magicfun \ | 2342 magicfun \ |
2343 }; \ | 2343 }; \ |
2344 \ | 2344 \ |
2345 { \ | 2345 { \ |
2346 int offset = ((char *)symbol_value_forward_forward (&I_hate_C) - \ | 2346 int offset = ((char *)symbol_value_forward_forward (&I_hate_C) - \ |
2347 (char *)&buffer_local_flags); \ | 2347 (char *)&buffer_local_flags); \ |
2348 defvar_magic (lname, &I_hate_C); \ | 2348 defvar_magic (lname, &I_hate_C); \ |
2349 \ | 2349 \ |
2350 *((Lisp_Object *)(offset + (char *)XBUFFER (Vbuffer_local_symbols))) \ | 2350 *((Lisp_Object *)(offset + (char *)XBUFFER (Vbuffer_local_symbols))) \ |
2351 = intern (lname); \ | 2351 = intern (lname); \ |
2352 } \ | 2352 } \ |
2353 } while (0) | 2353 } while (0) |
2354 | 2354 |
2355 #define DEFVAR_BUFFER_LOCAL_MAGIC(lname, field_name, magicfun) \ | 2355 #define DEFVAR_BUFFER_LOCAL_MAGIC(lname, field_name, magicfun) \ |
2356 DEFVAR_BUFFER_LOCAL_1 (lname, field_name, \ | 2356 DEFVAR_BUFFER_LOCAL_1 (lname, field_name, \ |
2357 SYMVAL_CURRENT_BUFFER_FORWARD, magicfun) | 2357 SYMVAL_CURRENT_BUFFER_FORWARD, magicfun) |