comparison src/window.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 05d62157e048
children b7f26b2f78bd
comparison
equal deleted inserted replaced
3016:f252275fb013 3017:1e7cc382eb16
344 here because the window must have its frame pointer set or 344 here because the window must have its frame pointer set or
345 reset_face_cachels will fail. */ 345 reset_face_cachels will fail. */
346 Lisp_Object 346 Lisp_Object
347 allocate_window (void) 347 allocate_window (void)
348 { 348 {
349 #ifdef MC_ALLOC 349 struct window *p = ALLOC_LCRECORD_TYPE (struct window, &lrecord_window);
350 struct window *p = alloc_lrecord_type (struct window, &lrecord_window);
351 #else /* not MC_ALLOC */
352 struct window *p = alloc_lcrecord_type (struct window, &lrecord_window);
353 #endif /* not MC_ALLOC */
354 Lisp_Object val = wrap_window (p); 350 Lisp_Object val = wrap_window (p);
355 351
356 #define WINDOW_SLOT(slot) p->slot = Qnil; 352 #define WINDOW_SLOT(slot) p->slot = Qnil;
357 #include "winslots.h" 353 #include "winslots.h"
358 354
485 structs. */ 481 structs. */
486 static struct window_mirror * 482 static struct window_mirror *
487 new_window_mirror (struct frame *f) 483 new_window_mirror (struct frame *f)
488 { 484 {
489 struct window_mirror *t = 485 struct window_mirror *t =
490 #ifdef MC_ALLOC 486 ALLOC_LCRECORD_TYPE (struct window_mirror, &lrecord_window_mirror);
491 alloc_lrecord_type (struct window_mirror, &lrecord_window_mirror);
492 #else /* not MC_ALLOC */
493 alloc_lcrecord_type (struct window_mirror, &lrecord_window_mirror);
494 #endif /* not MC_ALLOC */
495 487
496 t->frame = f; 488 t->frame = f;
497 t->current_display_lines = Dynarr_new (display_line); 489 t->current_display_lines = Dynarr_new (display_line);
498 t->desired_display_lines = Dynarr_new (display_line); 490 t->desired_display_lines = Dynarr_new (display_line);
499 491
3808 static void 3800 static void
3809 make_dummy_parent (Lisp_Object window) 3801 make_dummy_parent (Lisp_Object window)
3810 { 3802 {
3811 Lisp_Object new; 3803 Lisp_Object new;
3812 struct window *o = XWINDOW (window); 3804 struct window *o = XWINDOW (window);
3813 #ifdef MC_ALLOC 3805 struct window *p = ALLOC_LCRECORD_TYPE (struct window, &lrecord_window);
3814 struct window *p = alloc_lrecord_type (struct window, &lrecord_window);
3815 #else /* not MC_ALLOC */
3816 struct window *p = alloc_lcrecord_type (struct window, &lrecord_window);
3817 #endif /* not MC_ALLOC */
3818 3806
3819 new = wrap_window (p); 3807 new = wrap_window (p);
3820 #ifdef MC_ALLOC 3808 COPY_LCRECORD (p, o);
3821 copy_lrecord (p, o);
3822 #else /* MC_ALLOC */
3823 copy_lcrecord (p, o);
3824 #endif /* MC_ALLOC */
3825 3809
3826 /* Don't copy the pointers to the line start cache or the face 3810 /* Don't copy the pointers to the line start cache or the face
3827 instances. */ 3811 instances. */
3828 p->line_start_cache = Dynarr_new (line_start_cache); 3812 p->line_start_cache = Dynarr_new (line_start_cache);
3829 p->face_cachels = Dynarr_new (face_cachel); 3813 p->face_cachels = Dynarr_new (face_cachel);
5110 struct window_stats *stats, 5094 struct window_stats *stats,
5111 struct overhead_stats *ovstats) 5095 struct overhead_stats *ovstats)
5112 { 5096 {
5113 if (!mir) 5097 if (!mir)
5114 return; 5098 return;
5115 #ifdef MC_ALLOC 5099 stats->other += MALLOCED_STORAGE_SIZE (mir, sizeof (struct window_mirror),
5116 stats->other += mc_alloced_storage_size (sizeof (struct window_mirror),
5117 ovstats);
5118 #else /* not MC_ALLOC */
5119 stats->other += malloced_storage_size (mir, sizeof (struct window_mirror),
5120 ovstats); 5100 ovstats);
5121 #endif /* not MC_ALLOC */
5122 #ifdef HAVE_SCROLLBARS 5101 #ifdef HAVE_SCROLLBARS
5123 { 5102 {
5124 struct device *d = XDEVICE (FRAME_DEVICE (mir->frame)); 5103 struct device *d = XDEVICE (FRAME_DEVICE (mir->frame));
5125 5104
5126 stats->scrollbar += 5105 stats->scrollbar +=
5140 static void 5119 static void
5141 compute_window_usage (struct window *w, struct window_stats *stats, 5120 compute_window_usage (struct window *w, struct window_stats *stats,
5142 struct overhead_stats *ovstats) 5121 struct overhead_stats *ovstats)
5143 { 5122 {
5144 xzero (*stats); 5123 xzero (*stats);
5145 #ifdef MC_ALLOC 5124 stats->other += MALLOCED_STORAGE_SIZE (w, sizeof (struct window), ovstats);
5146 stats->other += mc_alloced_storage_size (sizeof (struct window), ovstats);
5147 #else /* not MC_ALLOC */
5148 stats->other += malloced_storage_size (w, sizeof (struct window), ovstats);
5149 #endif /* not MC_ALLOC */
5150 stats->face += compute_face_cachel_usage (w->face_cachels, ovstats); 5125 stats->face += compute_face_cachel_usage (w->face_cachels, ovstats);
5151 stats->glyph += compute_glyph_cachel_usage (w->glyph_cachels, ovstats); 5126 stats->glyph += compute_glyph_cachel_usage (w->glyph_cachels, ovstats);
5152 stats->line_start += 5127 stats->line_start +=
5153 compute_line_start_cache_dynarr_usage (w->line_start_cache, ovstats); 5128 compute_line_start_cache_dynarr_usage (w->line_start_cache, ovstats);
5154 compute_window_mirror_usage (find_window_mirror (w), stats, ovstats); 5129 compute_window_mirror_usage (find_window_mirror (w), stats, ovstats);