]>
Commit | Line | Data |
---|---|---|
34da4416 | 1 | /* nsmalloc: Simple pooled malloc() thing. */ |
2 | ||
271ef2d2 CP |
3 | #ifndef __NSMALLOC_H |
4 | #define __NSMALLOC_H | |
5 | ||
6 | #ifdef __NSMALLOC_C | |
7 | #define pool(x) #x | |
8 | #define beginpools() char *poolnames[MAXPOOL] = | |
9 | #define endpools(); | |
10 | #else | |
11 | #define pool(x) POOL_ ## x | |
64e3058f | 12 | #define beginpools(x) typedef enum nsmallocpools |
271ef2d2 CP |
13 | #define endpools() nsmallocpools; |
14 | ||
34da4416 | 15 | #include <stdlib.h> |
16 | ||
17 | void *nsmalloc(unsigned int poolid, size_t size); | |
18 | void nsfree(unsigned int poolid, void *ptr); | |
19 | void nsfreeall(unsigned int poolid); | |
103521a1 | 20 | void nsexit(void); |
48005496 | 21 | void *nsrealloc(unsigned int poolid, void *ptr, size_t size); |
f8d5cfcf | 22 | void nscheckfreeall(unsigned int poolid); |
19f37c5c | 23 | void initnsmalloc(void); |
34da4416 | 24 | |
25 | #define MAXPOOL 100 | |
26 | ||
271ef2d2 CP |
27 | #endif |
28 | ||
34da4416 | 29 | /* Pools here in the order they were created */ |
271ef2d2 CP |
30 | |
31 | beginpools() { | |
32 | pool(AUTHEXT), | |
33 | pool(CHANINDEX), | |
34 | pool(BANS), | |
35 | pool(CHANNEL), | |
36 | pool(NICK), | |
37 | pool(CHANSERVDB), | |
38 | pool(SSTRING), | |
39 | pool(AUTHTRACKER), | |
40 | pool(PROXYSCAN), | |
41 | pool(LUA), | |
42 | pool(TROJANSCAN), | |
43 | pool(NTERFACER), | |
44 | } endpools() | |
45 | ||
46 | #undef pool | |
47 | #undef beginpools | |
48 | #undef endpools | |
49 | ||
50 | #endif |