]> jfr.im git - irc/quakenet/newserv.git/blame - core/nsmalloc.h
Add real pool size and pool names.
[irc/quakenet/newserv.git] / core / nsmalloc.h
CommitLineData
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
12#define beginpools(x) enum
13#define endpools() nsmallocpools;
14
34da4416 15#include <stdlib.h>
16
17void *nsmalloc(unsigned int poolid, size_t size);
18void nsfree(unsigned int poolid, void *ptr);
19void nsfreeall(unsigned int poolid);
103521a1 20void nsexit(void);
48005496 21void *nsrealloc(unsigned int poolid, void *ptr, size_t size);
271ef2d2 22int nspoolstats(unsigned int poolid, size_t *size, unsigned long *count, char **poolname, size_t *realsize);
34da4416 23
24#define MAXPOOL 100
25
271ef2d2
CP
26#endif
27
34da4416 28/* Pools here in the order they were created */
271ef2d2
CP
29
30beginpools() {
31 pool(AUTHEXT),
32 pool(CHANINDEX),
33 pool(BANS),
34 pool(CHANNEL),
35 pool(NICK),
36 pool(CHANSERVDB),
37 pool(SSTRING),
38 pool(AUTHTRACKER),
39 pool(PROXYSCAN),
40 pool(LUA),
41 pool(TROJANSCAN),
42 pool(NTERFACER),
43} endpools()
44
45#undef pool
46#undef beginpools
47#undef endpools
48
49#endif