--- rxvt-unicode/src/rxvtutil.h 2007/11/22 15:32:39 1.31 +++ rxvt-unicode/src/rxvtutil.h 2007/12/02 22:37:14 1.34 @@ -64,6 +64,25 @@ return (long(a) * long(100 - p) + long(b) * long(p) + 50) / 100; } +template +I find (I first, I last, const T& value) +{ + while (first != last && *first != value) + ++first; + + return first; +} + +// return a very temporary (and never deallocated) buffer. keep small. +void *rxvt_temp_buf (int len); + +template +static inline T * +rxvt_temp_buf (int len) +{ + return (T *)rxvt_temp_buf (len * sizeof (T)); +} + // some bit functions, xft fuck me plenty #if HAVE_GCC_BUILTINS static inline int ctz (unsigned int x) { return __builtin_ctz (x); } @@ -347,6 +366,15 @@ struct vector : simplevec { }; +struct stringvec : simplevec +{ + ~stringvec () + { + for (char **c = begin (); c != end (); c++) + free (*c); + } +}; + #if 0 template struct rxvt_vec : simplevec { @@ -363,15 +391,6 @@ }; #endif -template -I find (I first, I last, const T& value) -{ - while (first != last && *first != value) - ++first; - - return first; -} - template struct auto_ptr { T *p; @@ -432,24 +451,5 @@ typedef auto_ptr auto_str; -struct stringvec : simplevec -{ - ~stringvec () - { - for (char **c = begin (); c != end (); c++) - free (*c); - } -}; - -// return a very temporary (and never deallocated) buffer. keep small. -void *rxvt_temp_buf (int len); - -template -static inline T * -rxvt_temp_buf (int len) -{ - return (T *)rxvt_temp_buf (len * sizeof (T)); -} - #endif