xref: /plan9/sys/src/cmd/gs/src/gsmdebug.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1995, 1996, 1998 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: gsmdebug.h,v 1.6 2002/06/16 08:45:42 lpd Exp $ */
18 /* Allocator debugging definitions and interface */
19 /* Requires gdebug.h (for gs_debug) */
20 
21 #ifndef gsmdebug_INCLUDED
22 #  define gsmdebug_INCLUDED
23 
24 /* Define the fill patterns used for debugging the allocator. */
25 extern const byte
26        gs_alloc_fill_alloc,	/* allocated but not initialized */
27        gs_alloc_fill_block,	/* locally allocated block */
28        gs_alloc_fill_collected,	/* garbage collected */
29        gs_alloc_fill_deleted,	/* locally deleted block */
30        gs_alloc_fill_free;	/* freed */
31 
32 /* Define an alias for a specialized debugging flag */
33 /* that used to be a separate variable. */
34 #define gs_alloc_debug gs_debug['@']
35 
36 /* Conditionally fill unoccupied blocks with a pattern. */
37 extern void gs_alloc_memset(void *, int /*byte */ , ulong);
38 
39 #ifdef DEBUG
40 #  define gs_alloc_fill(ptr, fill, len)\
41      BEGIN if ( gs_alloc_debug ) gs_alloc_memset(ptr, fill, (ulong)(len)); END
42 #else
43 #  define gs_alloc_fill(ptr, fill, len)\
44      DO_NOTHING
45 #endif
46 
47 #endif /* gsmdebug_INCLUDED */
48