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.35 by root, Fri Jan 19 22:47:57 2007 UTC vs.
Revision 1.36 by root, Thu Jan 25 03:54:45 2007 UTC

1#ifndef UTIL_H__ 1#ifndef UTIL_H__
2#define UTIL_H__ 2#define UTIL_H__
3
4//#define PREFER_MALLOC
3 5
4#if __GNUC__ >= 3 6#if __GNUC__ >= 3
5# define is_constant(c) __builtin_constant_p (c) 7# define is_constant(c) __builtin_constant_p (c)
6#else 8#else
7# define is_constant(c) 0 9# define is_constant(c) 0
133 135
134// for symmetry 136// for symmetry
135template<typename T> 137template<typename T>
136inline void sfree (T *ptr, int n = 1) throw () 138inline void sfree (T *ptr, int n = 1) throw ()
137{ 139{
140#ifdef PREFER_MALLOC
141 free (ptr);
142#else
138 g_slice_free1 (n * sizeof (T), (void *)ptr); 143 g_slice_free1 (n * sizeof (T), (void *)ptr);
144#endif
139} 145}
140 146
141// a STL-compatible allocator that uses g_slice 147// a STL-compatible allocator that uses g_slice
142// boy, this is verbose 148// boy, this is verbose
143template<typename Tp> 149template<typename Tp>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines