]> jfr.im git - irc/quakenet/newserv.git/blobdiff - core/nsmalloc.h
fixes for clang
[irc/quakenet/newserv.git] / core / nsmalloc.h
index c7c4729b9e22efb06e06008e4331e9d21b6a2c2a..b62e6353d944446d3ac40a630583614cab325f8e 100644 (file)
@@ -5,12 +5,12 @@
 
 #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>
 
@@ -20,10 +20,26 @@ void nsfreeall(unsigned int poolid);
 void nsexit(void);
 void *nsrealloc(unsigned int poolid, void *ptr, size_t size);
 void nscheckfreeall(unsigned int poolid);
-void initnsmalloc(void);
+void *nscalloc(unsigned int poolid, size_t nmemb, size_t size);
 
 #define MAXPOOL                100
 
+struct nsminfo {
+  struct nsminfo *next;
+  struct nsminfo *prev;
+
+  size_t size;
+  char data[];
+};
+
+struct nsmpool {
+  unsigned long count;
+  size_t size;
+  struct nsminfo first;
+};
+
+extern struct nsmpool nsmpools[MAXPOOL];
+
 #endif
 
 /* Pools here in the order they were created */
@@ -41,6 +57,14 @@ beginpools() {
   pool(LUA),
   pool(TROJANSCAN),
   pool(NTERFACER),
+  pool(SQLITE),
+  pool(PQSQL),
+  pool(PATRICIA),
+  pool(PATRICIANICK),
+  pool(GLINE),
+  pool(TRUSTS),
+  pool(SPAMSCAN2),
+  pool(ACHIEVEMENTS)
 } endpools()
 
 #undef pool