--- rxvt-unicode/src/rxvtutil.h 2005/12/21 14:23:30 1.14 +++ rxvt-unicode/src/rxvtutil.h 2006/01/17 16:06:48 1.18 @@ -3,6 +3,11 @@ #include +#define PP_CONCAT_(a, b) a ## b +#define PP_CONCAT(a, b) PP_CONCAT_(a, b) +#define PP_STRINGIFY_(a) #a +#define PP_STRINGIFY(a) PP_STRINGIFY_(a) + extern class byteorder { static unsigned int e; // at least 32 bits public: @@ -14,6 +19,7 @@ static bool vax () { return e == 0x44332211; }; } byteorder; +// various utility functions template static inline T min (T a, U b) { return a < (T)b ? a : (T)b; } template static inline void min_it (T &a, U b) { a = a < (T)b ? a : (T)b; } template static inline T max (T a, U b) { return a > (T)b ? a : (T)b; } @@ -32,6 +38,7 @@ #define IN_RANGE_EXC(val,beg,end) \ ((unsigned int)(val) - (unsigned int)(beg) < (unsigned int)(end) - (unsigned int)(beg)) +// makes dynamically allocated objects zero-initialised struct zero_initialized { void *operator new (size_t s); void operator delete (void *p, size_t s); @@ -251,14 +258,14 @@ void erase (iterator first, iterator last) { if (last != first) { - memmove (first, last, (end ()-last)*sizeof (T)); + memmove (first, last, (end () - last) * sizeof (T)); _last -= last - first; } } void erase (iterator pos) { if (pos != end ()) { - memmove (pos, pos+1, (end ()- (pos+1))*sizeof (T)); + memmove (pos, pos+1, (end () - (pos+1)) * sizeof (T)); --_last; } }