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.13 by root, Thu Sep 14 00:07:15 2006 UTC vs.
Revision 1.15 by root, Sat Sep 16 13:11:20 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)
107struct refcounted 110struct refcounted
108{ 111{
109 mutable int refcnt; 112 mutable int refcnt;
110 refcounted () : refcnt (0) { } 113 refcounted () : refcnt (0) { }
111 void refcnt_inc () { ++refcnt; } 114 void refcnt_inc () { ++refcnt; }
112 void refcnt_dec () { --refcnt; 115 void refcnt_dec () { --refcnt; }
113 if (refcnt < 0)abort();}//D
114}; 116};
115 117
116template<class T> 118template<class T>
117struct refptr 119struct refptr
118{ 120{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines