]> jfr.im git - irc/quakenet/newserv.git/blobdiff - core/nsmalloc.h
Merge chanserv-live into default.
[irc/quakenet/newserv.git] / core / nsmalloc.h
index ea5d862cb0efb909b45e03271647b20c530ad7e1..9410d2837211c0fb13ffd55b5b16e19732507eb9 100644 (file)
@@ -5,24 +5,43 @@
 
 #ifdef __NSMALLOC_C
 #define pool(x) #x
-#define beginpools() char *poolnames[MAXPOOL] =
+#define beginpools() char *nsmpoolnames[MAXPOOL] =
 #define endpools();
 #else
 #define pool(x) POOL_ ## x
 #define beginpools(x) typedef enum nsmallocpools
-#define endpools() nsmallocpools;
+#define endpools() nsmallocpools; extern char *nsmpoolnames[MAXPOOL];
 
 #include <stdlib.h>
+#include <stdint.h>
 
 void *nsmalloc(unsigned int poolid, size_t size);
 void nsfree(unsigned int poolid, void *ptr);
 void nsfreeall(unsigned int poolid);
+void nsinit(void);
 void nsexit(void);
 void *nsrealloc(unsigned int poolid, void *ptr, size_t size);
-int nspoolstats(unsigned int poolid, size_t *size, unsigned long *count, char **poolname, size_t *realsize);
 void nscheckfreeall(unsigned int poolid);
+void *nscalloc(unsigned int poolid, size_t nmemb, size_t size);
 
 #define MAXPOOL                100
+#define REDZONE_MAGIC   0x243653E957851F68ULL
+struct nsminfo {
+  struct nsminfo *next;
+  struct nsminfo *prev;
+
+  size_t size;
+  uint64_t redzone;
+  char data[];
+};
+
+struct nsmpool {
+  unsigned long count;
+  size_t size;
+  struct nsminfo *blocks;
+};
+
+extern struct nsmpool nsmpools[MAXPOOL];
 
 #endif
 
@@ -41,6 +60,16 @@ beginpools() {
   pool(LUA),
   pool(TROJANSCAN),
   pool(NTERFACER),
+  pool(SQLITE),
+  pool(PQSQL),
+  pool(PATRICIA),
+  pool(PATRICIANICK),
+  pool(GLINE),
+  pool(TRUSTS),
+  pool(SPAMSCAN2),
+  pool(ACHIEVEMENTS),
+  pool(CHANSTATS),
+  pool(SCHEDULE)
 } endpools()
 
 #undef pool