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.16 by root, Fri Nov 17 19:40:54 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)
104 } 107 }
105}; 108};
106 109
107struct refcounted 110struct refcounted
108{ 111{
112 refcounted () : refcnt (0) { }
113// virtual ~refcounted ();
114 void refcnt_inc () { ++refcnt; }
115 void refcnt_dec () { --refcnt; }
116 bool dead () { return refcnt == 0; }
109 mutable int refcnt; 117 mutable int refcnt;
110 refcounted () : refcnt (0) { } 118#if 0
111 void refcnt_inc () { ++refcnt; } 119private:
112 void refcnt_dec () { --refcnt; 120 static refcounted *rc_first;
113 if (refcnt < 0)abort();}//D 121 refcounted *rc_next;
122#endif
114}; 123};
115 124
116template<class T> 125template<class T>
117struct refptr 126struct refptr
118{ 127{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines