comparison src/buffer.c @ 3017:1e7cc382eb16

[xemacs-hg @ 2005-10-24 10:07:26 by ben] refactor mc-alloc dependencies next-error.el, occur.el: Fix some byte-compile warnings. alloc.c, buffer.c, buffer.h, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, console-impl.h, console-msw-impl.h, console.c, data.c, database.c, device-impl.h, device-msw.c, device.c, dialog-msw.c, elhash.c, events.h, extents-impl.h, extents.c, faces.c, faces.h, file-coding.c, file-coding.h, frame-impl.h, frame.c, glyphs.c, glyphs.h, gui.c, gui.h, keymap.c, lisp.h, lrecord.h, lstream.c, lstream.h, mule-charset.c, objects-impl.h, objects.c, opaque.c, opaque.h, print.c, process.c, procimpl.h, rangetab.c, rangetab.h, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, specifier.c, specifier.h, symbols.c, symeval.h, toolbar.c, toolbar.h, tooltalk.c, ui-gtk.c, ui-gtk.h, unicode.c, window-impl.h, window.c: Eliminate the majority of #ifdef MC_ALLOC occurrences through macros LCRECORD_HEADER, ALLOC_LCRECORD_TYPE, MALLOCED_STORAGE_SIZE, etc. (defined in lrecord.h).
author ben
date Mon, 24 Oct 2005 10:07:42 +0000
parents 6fa9919a9a0b
children b7f26b2f78bd
comparison
equal deleted inserted replaced
3016:f252275fb013 3017:1e7cc382eb16
585 } 585 }
586 586
587 static struct buffer * 587 static struct buffer *
588 allocate_buffer (void) 588 allocate_buffer (void)
589 { 589 {
590 #ifdef MC_ALLOC 590 struct buffer *b = ALLOC_LCRECORD_TYPE (struct buffer, &lrecord_buffer);
591 struct buffer *b = alloc_lrecord_type (struct buffer, &lrecord_buffer); 591
592 592 COPY_LCRECORD (b, XBUFFER (Vbuffer_defaults));
593 copy_lrecord (b, XBUFFER (Vbuffer_defaults));
594 #else /* not MC_ALLOC */
595 struct buffer *b = alloc_lcrecord_type (struct buffer, &lrecord_buffer);
596
597 copy_lcrecord (b, XBUFFER (Vbuffer_defaults));
598 #endif /* not MC_ALLOC */
599 593
600 return b; 594 return b;
601 } 595 }
602 596
603 static Lisp_Object 597 static Lisp_Object
1761 static void 1755 static void
1762 compute_buffer_usage (struct buffer *b, struct buffer_stats *stats, 1756 compute_buffer_usage (struct buffer *b, struct buffer_stats *stats,
1763 struct overhead_stats *ovstats) 1757 struct overhead_stats *ovstats)
1764 { 1758 {
1765 xzero (*stats); 1759 xzero (*stats);
1766 #ifdef MC_ALLOC 1760 stats->other += MALLOCED_STORAGE_SIZE (b, sizeof (*b), ovstats);
1767 stats->other += mc_alloced_storage_size (sizeof (*b), ovstats);
1768 #else /* not MC_ALLOC */
1769 stats->other += malloced_storage_size (b, sizeof (*b), ovstats);
1770 #endif /* not MC_ALLOC */
1771 stats->text += compute_buffer_text_usage (b, ovstats); 1761 stats->text += compute_buffer_text_usage (b, ovstats);
1772 stats->markers += compute_buffer_marker_usage (b, ovstats); 1762 stats->markers += compute_buffer_marker_usage (b, ovstats);
1773 stats->extents += compute_buffer_extent_usage (b, ovstats); 1763 stats->extents += compute_buffer_extent_usage (b, ovstats);
1774 } 1764 }
1775 1765
2202 DEFVAR_BUFFER_DEFAULTS_MAGIC (lname, field_name, 0) 2192 DEFVAR_BUFFER_DEFAULTS_MAGIC (lname, field_name, 0)
2203 2193
2204 static void 2194 static void
2205 nuke_all_buffer_slots (struct buffer *b, Lisp_Object zap) 2195 nuke_all_buffer_slots (struct buffer *b, Lisp_Object zap)
2206 { 2196 {
2207 #ifdef MC_ALLOC 2197 ZERO_LCRECORD (b);
2208 zero_lrecord (b);
2209 #else /* not MC_ALLOC */
2210 zero_lcrecord (b);
2211 #endif /* not MC_ALLOC */
2212 2198
2213 b->extent_info = Qnil; 2199 b->extent_info = Qnil;
2214 b->indirect_children = Qnil; 2200 b->indirect_children = Qnil;
2215 b->own_text.line_number_cache = Qnil; 2201 b->own_text.line_number_cache = Qnil;
2216 2202
2221 static void 2207 static void
2222 common_init_complex_vars_of_buffer (void) 2208 common_init_complex_vars_of_buffer (void)
2223 { 2209 {
2224 /* Make sure all markable slots in buffer_defaults 2210 /* Make sure all markable slots in buffer_defaults
2225 are initialized reasonably, so mark_buffer won't choke. */ 2211 are initialized reasonably, so mark_buffer won't choke. */
2226 #ifdef MC_ALLOC 2212 struct buffer *defs = ALLOC_LCRECORD_TYPE (struct buffer, &lrecord_buffer);
2227 struct buffer *defs = alloc_lrecord_type (struct buffer, &lrecord_buffer); 2213 struct buffer *syms = ALLOC_LCRECORD_TYPE (struct buffer, &lrecord_buffer);
2228 struct buffer *syms = alloc_lrecord_type (struct buffer, &lrecord_buffer);
2229 #else /* not MC_ALLOC */
2230 struct buffer *defs = alloc_lcrecord_type (struct buffer, &lrecord_buffer);
2231 struct buffer *syms = alloc_lcrecord_type (struct buffer, &lrecord_buffer);
2232 #endif /* not MC_ALLOC */
2233 2214
2234 staticpro_nodump (&Vbuffer_defaults); 2215 staticpro_nodump (&Vbuffer_defaults);
2235 staticpro_nodump (&Vbuffer_local_symbols); 2216 staticpro_nodump (&Vbuffer_local_symbols);
2236 Vbuffer_defaults = wrap_buffer (defs); 2217 Vbuffer_defaults = wrap_buffer (defs);
2237 Vbuffer_local_symbols = wrap_buffer (syms); 2218 Vbuffer_local_symbols = wrap_buffer (syms);