--- deliantra/server/common/utils.C 2006/09/03 00:18:40 1.3 +++ deliantra/server/common/utils.C 2006/09/08 16:51:43 1.6 @@ -1,6 +1,6 @@ /* * static char *rcsid_utils_c = - * "$Id: utils.C,v 1.3 2006/09/03 00:18:40 root Exp $"; + * "$Id: utils.C,v 1.6 2006/09/08 16:51:43 root Exp $"; */ /* @@ -34,6 +34,8 @@ #include #include +#include + /* * The random functions here take luck into account when rolling random * dice or numbers. This function has less of an impact the larger the @@ -304,7 +306,9 @@ void set_materialname(object *op, int difficulty, materialtype_t *nmt) { materialtype_t *mt, *lmt; +#ifdef NEW_MATERIAL_CODE int j; +#endif if (op->materialname != NULL) return; @@ -483,18 +487,30 @@ return; } +//TODO: overhead due to specifying size twice void * zero_initialised::operator new (size_t s) { - void *p = malloc (s); - - memset (p, 0, s); - return p; +printf ("new(%d)\n", s);//D + return g_slice_alloc0 (s); +} + +void * +zero_initialised::operator new [] (size_t s) +{ +printf ("new[](%d)\n", s);//D + return g_slice_alloc0 (s); } void zero_initialised::operator delete (void *p, size_t s) { - free (p); + g_slice_free1 (s, p); +} + +void +zero_initialised::operator delete [] (void *p, size_t s) +{ + g_slice_free1 (s, p); }