chiark / gitweb /
Expunge revision histories in files.
[catacomb] / arena.h
1 /* -*-c-*-
2  *
3  * $Id: arena.h,v 1.2 2004/04/08 01:36:15 mdw Exp $
4  *
5  * Abstraction for memory allocation arenas
6  *
7  * (c) 2000 Straylight/Edgeware
8  */
9
10 /*----- Licensing notice --------------------------------------------------* 
11  *
12  * This file is part of Catacomb.
13  *
14  * Catacomb is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU Library General Public License as
16  * published by the Free Software Foundation; either version 2 of the
17  * License, or (at your option) any later version.
18  * 
19  * Catacomb is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU Library General Public License for more details.
23  * 
24  * You should have received a copy of the GNU Library General Public
25  * License along with Catacomb; if not, write to the Free
26  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27  * MA 02111-1307, USA.
28  */
29
30 #ifndef CATACOMB_ARENA_H
31 #define CATACOMB_ARENA_H
32
33 #ifdef __cplusplus
34   extern "C" {
35 #endif
36
37 /*----- Header files ------------------------------------------------------*/
38
39 #include <mLib/arena.h>
40 #include <mLib/sub.h>
41
42 /*----- Global variables --------------------------------------------------*/
43
44 extern arena *arena_secure;
45 extern subarena *arena_subsecure;
46
47 /*----- Handy macros ------------------------------------------------------*/
48
49 #define S_ALLOC(sz) A_ALLOC(arena_secure, sz)
50 #define S_FREE(sz) A_FREE(arena_secure, sz)
51
52 #define XS_ALLOC(sz) x_alloc(arena_secure, sz)
53 #define XS_REALLOC(p, sz) x_realloc(arena_secure, p, sz)
54 #define XS_FREE(p) x_free(arena_secure, p)
55
56 #define S_CREATE(type) A_CREATE(arena_subsecure, type)
57 #define S_DESTROY(p) A_DESTROY(arena_subsecure, p)
58
59 /*----- Functions provided ------------------------------------------------*/
60
61 /* --- @arena_setsecure@ --- *
62  *
63  * Arguments:   @arena *a@ = arena to use for secure allocation
64  *
65  * Returns:     ---
66  *
67  * Use:         Call at the beginning of the program to set the arena for
68  *              secure allocations.
69  */
70
71 extern void arena_setsecure(arena */*a*/);
72
73 /*----- That's all, folks -------------------------------------------------*/
74
75 #ifdef __cplusplus
76   }
77 #endif
78
79 #endif