ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtutil.h
(Generate patch)

Comparing rxvt-unicode/src/rxvtutil.h (file contents):
Revision 1.15 by root, Mon Jan 2 15:35:43 2006 UTC vs.
Revision 1.16 by root, Wed Jan 11 00:59:58 2006 UTC

17 static bool network () { return e == 0x11223344; }; 17 static bool network () { return e == 0x11223344; };
18 static bool little_endian () { return e == 0x44332211; }; 18 static bool little_endian () { return e == 0x44332211; };
19 static bool vax () { return e == 0x44332211; }; 19 static bool vax () { return e == 0x44332211; };
20} byteorder; 20} byteorder;
21 21
22// various utility functions
22template<typename T, typename U> static inline T min (T a, U b) { return a < (T)b ? a : (T)b; } 23template<typename T, typename U> static inline T min (T a, U b) { return a < (T)b ? a : (T)b; }
23template<typename T, typename U> static inline void min_it (T &a, U b) { a = a < (T)b ? a : (T)b; } 24template<typename T, typename U> static inline void min_it (T &a, U b) { a = a < (T)b ? a : (T)b; }
24template<typename T, typename U> static inline T max (T a, U b) { return a > (T)b ? a : (T)b; } 25template<typename T, typename U> static inline T max (T a, U b) { return a > (T)b ? a : (T)b; }
25template<typename T, typename U> static inline void max_it (T &a, U b) { a = a > (T)b ? a : (T)b; } 26template<typename T, typename U> static inline void max_it (T &a, U b) { a = a > (T)b ? a : (T)b; }
26 27
35 36
36// in range excluding end 37// in range excluding end
37#define IN_RANGE_EXC(val,beg,end) \ 38#define IN_RANGE_EXC(val,beg,end) \
38 ((unsigned int)(val) - (unsigned int)(beg) < (unsigned int)(end) - (unsigned int)(beg)) 39 ((unsigned int)(val) - (unsigned int)(beg) < (unsigned int)(end) - (unsigned int)(beg))
39 40
41// makes dynamically allocated objects zero-initialised
40struct zero_initialized { 42struct zero_initialized {
41 void *operator new (size_t s); 43 void *operator new (size_t s);
42 void operator delete (void *p, size_t s); 44 void operator delete (void *p, size_t s);
43}; 45};
44 46
393 for (char **c = begin (); c != end (); c++) 395 for (char **c = begin (); c != end (); c++)
394 delete [] *c; 396 delete [] *c;
395 } 397 }
396}; 398};
397 399
400// temporarily replace the process environment
401extern char **environ;
402
403struct temp_environ
404{
405 char **prev;
406
407 temp_environ (const stringvec *envv)
408 : prev (environ)
409 {
410 if (envv)
411 environ = (char **)envv->begin ();
412 }
413
414 ~temp_environ ()
415 {
416 environ = prev;
417 }
418};
419
398#endif 420#endif
399 421

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines