ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/utils.C
(Generate patch)

Comparing deliantra/server/common/utils.C (file contents):
Revision 1.3 by root, Sun Sep 3 00:18:40 2006 UTC vs.
Revision 1.4 by root, Mon Sep 4 11:07:59 2006 UTC

1/* 1/*
2 * static char *rcsid_utils_c = 2 * static char *rcsid_utils_c =
3 * "$Id: utils.C,v 1.3 2006/09/03 00:18:40 root Exp $"; 3 * "$Id: utils.C,v 1.4 2006/09/04 11:07:59 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
31 */ 31 */
32 32
33#include <global.h> 33#include <global.h>
34#include <funcpoint.h> 34#include <funcpoint.h>
35#include <material.h> 35#include <material.h>
36
37#include <glib.h>
36 38
37/* 39/*
38 * The random functions here take luck into account when rolling random 40 * The random functions here take luck into account when rolling random
39 * dice or numbers. This function has less of an impact the larger the 41 * dice or numbers. This function has less of an impact the larger the
40 * difference becomes in the random numbers. IE, the effect is lessened 42 * difference becomes in the random numbers. IE, the effect is lessened
481 } 483 }
482 else strcpy(input, tmp); 484 else strcpy(input, tmp);
483 return; 485 return;
484} 486}
485 487
488//TODO: overhead due to specifying size twice
486void * 489void *
487zero_initialised::operator new (size_t s) 490zero_initialised::operator new (size_t s)
488{ 491{
489 void *p = malloc (s); 492 return g_slice_alloc0 (s);
490 493}
491 memset (p, 0, s); 494
492 return p; 495void *
496zero_initialised::operator new [] (size_t s)
497{
498 return g_slice_alloc0 (s);
493} 499}
494 500
495void 501void
496zero_initialised::operator delete (void *p, size_t s) 502zero_initialised::operator delete (void *p, size_t s)
497{ 503{
498 free (p); 504 g_slice_free1 (s, p);
499} 505}
500 506
507void
508zero_initialised::operator delete [] (void *p, size_t s)
509{
510 g_slice_free1 (s, p);
511}
512

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines