1 /* Copyright (C) 2001-2019 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
13    CA 94945, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 /* chunk consolidating wrapper on a base memory allocator */
18 
19 #ifndef gsmchunk_INCLUDED
20 #  define gsmchunk_INCLUDED
21 
22 #include "std.h"
23 
24 #define CHUNK_SIZE		65536
25 
26 /* ---------- Public constructors/destructors ---------- */
27 
28 /* Initialize a gs_memory_chunk_t */
29         /* -ve error code or 0 */
30 int gs_memory_chunk_wrap(gs_memory_t **wrapped,	/* chunk allocator init */
31                       gs_memory_t * target );	/* base allocator */
32 
33 /* Release a chunk memory manager and all of the memory it held */
34 void gs_memory_chunk_release(gs_memory_t *cmem);
35 
36 /* Release chunk memory manager, and return the target */
37 /* if "mem" is not a chunk memory manager instance, "mem"
38  * is return untouched
39  */
40 gs_memory_t * /* Always succeeds */
41 gs_memory_chunk_unwrap(gs_memory_t *mem);
42 
43 /* ---------- Accessors ------------- */
44 
45 /* Retrieve this allocator's target */
46 gs_memory_t *gs_memory_chunk_target(const gs_memory_t *cmem);
47 
48 #ifdef DEBUG
49     void gs_memory_chunk_dump_memory(const gs_memory_t *mem);
50 #endif /* DEBUG */
51 
52 #endif /* gsmchunk_INCLUDED */
53