Mercurial > hg > xemacs-beta
diff src/lrecord.h @ 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 | ec5f23ea6d2e |
children | b7f26b2f78bd |
line wrap: on
line diff
--- a/src/lrecord.h Mon Oct 24 08:12:59 2005 +0000 +++ b/src/lrecord.h Mon Oct 24 10:07:42 2005 +0000 @@ -1,6 +1,6 @@ /* The "lrecord" structure (header of a compound lisp object). Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. - Copyright (C) 1996, 2001, 2002, 2004 Ben Wing. + Copyright (C) 1996, 2001, 2002, 2004, 2005 Ben Wing. This file is part of XEmacs. @@ -659,11 +659,7 @@ struct Lisp_Hash_Table { -#ifdef MC_ALLOC - struct lrecord_header header; -#else - struct lcrecord_header header; -#endif + struct LCRECORD_HEADER header; Elemcount size; Elemcount count; Elemcount rehash_count; @@ -728,11 +724,7 @@ struct Lisp_Specifier { -#ifdef MC_ALLOC - struct lrecord_header header; -#else - struct lcrecord_header header; -#endif + struct LCRECORD_HEADER header; struct specifier_methods *methods; ... @@ -1206,11 +1198,7 @@ 1. Declare the struct for your object in a header file somewhere. Remember that it must begin with -#ifdef MC_ALLOC - struct lrecord_header header; -#else - struct lcrecord_header header; -#endif + struct LCRECORD_HEADER header; 2. Put the "standard junk" (DECLARE_RECORD()/XFOO/etc.) below the struct definition -- see below. @@ -1244,11 +1232,7 @@ struct toolbar_button { -#ifdef MC_ALLOC - struct lrecord_header header; -#else - struct lcrecord_header header; -#endif + struct LCRECORD_HEADER header; Lisp_Object next; Lisp_Object frame; @@ -1618,6 +1602,7 @@ MODULE_API void * alloc_automanaged_lcrecord (Bytecount size, const struct lrecord_implementation *); + #define alloc_lcrecord_type(type, lrecord_implementation) \ ((type *) alloc_automanaged_lcrecord (sizeof (type), lrecord_implementation)) @@ -1681,14 +1666,14 @@ #define copy_lrecord(dst, src) copy_sized_lrecord (dst, src, sizeof (*(dst))) +#endif /* MC_ALLOC */ + #define zero_sized_lrecord(lcr, size) \ memset ((char *) (lcr) + sizeof (struct lrecord_header), 0, \ (size) - sizeof (struct lrecord_header)) #define zero_lrecord(lcr) zero_sized_lrecord (lcr, sizeof (*(lcr))) -#endif /* MC_ALLOC */ - DECLARE_INLINE_HEADER ( Bytecount detagged_lisp_object_size (const struct lrecord_header *h) @@ -1709,6 +1694,27 @@ return detagged_lisp_object_size (XRECORD_LHEADER (o)); } +#ifdef MC_ALLOC +#define ALLOC_LCRECORD_TYPE alloc_lrecord_type +#define COPY_SIZED_LCRECORD copy_sized_lrecord +#define COPY_LCRECORD copy_lrecord +#define MALLOCED_STORAGE_SIZE(ptr, size, stats) \ + mc_alloced_storage_size (size, stats) +#define ZERO_LCRECORD zero_lrecord +#define LCRECORD_HEADER lrecord_header +#define BASIC_ALLOC_LCRECORD alloc_lrecord +#define FREE_LCRECORD free_lrecord +#else +#define ALLOC_LCRECORD_TYPE alloc_lcrecord_type +#define COPY_SIZED_LCRECORD copy_sized_lcrecord +#define COPY_LCRECORD copy_lcrecord +#define MALLOCED_STORAGE_SIZE malloced_storage_size +#define ZERO_LCRECORD zero_lcrecord +#define LCRECORD_HEADER lcrecord_header +#define BASIC_ALLOC_LCRECORD basic_alloc_lcrecord +#define FREE_LCRECORD free_lcrecord +#endif + /************************************************************************/ /* Dumping */