ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/util.h
(Generate patch)

Comparing deliantra/server/include/util.h (file contents):
Revision 1.12 by root, Tue Sep 12 21:10:32 2006 UTC vs.
Revision 1.14 by root, Thu Sep 14 18:13:02 2006 UTC

8#endif 8#endif
9 9
10#include <cstddef> 10#include <cstddef>
11 11
12#include <glib.h> 12#include <glib.h>
13
14// use a gcc extension for auto declarations until ISO C++ sanctifies them
15#define AUTODECL(var,expr) typeof(expr) var = (expr)
13 16
14// makes dynamically allocated objects zero-initialised 17// makes dynamically allocated objects zero-initialised
15struct zero_initialised 18struct zero_initialised
16{ 19{
17 void *operator new (size_t s, void *p) 20 void *operator new (size_t s, void *p)
83 return static_cast<pointer>(alloc (n * sizeof (Tp))); 86 return static_cast<pointer>(alloc (n * sizeof (Tp)));
84 } 87 }
85 88
86 void deallocate (pointer p, size_type n) 89 void deallocate (pointer p, size_type n)
87 { 90 {
88 dealloc (static_cast<void *>(p), n); 91 dealloc (static_cast<void *>(p), n * sizeof (Tp));
89 } 92 }
90 93
91 size_type max_size ()const throw () 94 size_type max_size ()const throw ()
92 { 95 {
93 return size_t (-1) / sizeof (Tp); 96 return size_t (-1) / sizeof (Tp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines