]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/common.h
fixed registration process (uncommitted code from afternets x3 applied)
[irc/evilnet/x3.git] / src / common.h
index cd4bb62a5b018e5e5dd8c39abc9ec9db9e67922d..e9e5c0ea0b7798ea80af9069c17b1a054e0b049a 100644 (file)
@@ -1,7 +1,7 @@
 /* common.h - Common functions/includes
  * Copyright 2000-2004 srvx Development Team
  *
- * This file is part of srvx.
+ * This file is part of x3.
  *
  * srvx is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -102,6 +102,24 @@ extern void srvx_free(const char *, unsigned int, void *);
 extern void verify(const void *ptr);
 #  define verify(x) verify(x)
 # endif
+#elif defined(WITH_MALLOC_SLAB)
+# define malloc(n) slab_malloc(__FILE__, __LINE__, (n))
+# undef calloc
+# define calloc(m,n) slab_malloc(__FILE__, __LINE__, (m)*(n))
+# undef realloc
+# define realloc(p,n) slab_realloc(__FILE__, __LINE__, (p), (n))
+# undef free
+# define free(p) slab_free(__FILE__, __LINE__, (p))
+# undef strdup
+# define strdup(s) slab_strdup(__FILE__, __LINE__, (s))
+extern void *slab_malloc(const char *, unsigned int, size_t);
+extern void *slab_realloc(const char *, unsigned int, void *, size_t);
+extern char *slab_strdup(const char *, unsigned int, const char *);
+extern void slab_free(const char *, unsigned int, void *);
+# if !defined(NDEBUG)
+extern void verify(const void *ptr);
+#  define verify(x) verify(x)
+# endif
 #endif
 
 #ifndef verify