1 | #ifndef RXVT_UTIL_H |
1 | #ifndef RXVT_UTIL_H |
2 | #define RXVT_UTIL_H |
2 | #define RXVT_UTIL_H |
3 | |
3 | |
|
|
4 | #include <cstdlib> |
4 | #include <cstring> |
5 | #include <cstring> |
5 | |
6 | |
6 | #define PP_CONCAT_(a, b) a ## b |
7 | #define PP_CONCAT_(a, b) a ## b |
7 | #define PP_CONCAT(a, b) PP_CONCAT_(a, b) |
8 | #define PP_CONCAT(a, b) PP_CONCAT_(a, b) |
8 | #define PP_STRINGIFY_(a) #a |
9 | #define PP_STRINGIFY_(a) #a |
… | |
… | |
391 | struct stringvec : simplevec<char *> |
392 | struct stringvec : simplevec<char *> |
392 | { |
393 | { |
393 | ~stringvec () |
394 | ~stringvec () |
394 | { |
395 | { |
395 | for (char **c = begin (); c != end (); c++) |
396 | for (char **c = begin (); c != end (); c++) |
396 | delete [] *c; |
397 | free (*c); |
397 | } |
398 | } |
398 | }; |
399 | }; |
399 | |
400 | |
|
|
401 | // return a very temporary (and never deallocated) buffer. keep small. |
|
|
402 | void *rxvt_temp_buf (int len); |
|
|
403 | |
|
|
404 | template<typename T> |
|
|
405 | inline T * |
|
|
406 | rxvt_temp_buf (int len) |
|
|
407 | { |
|
|
408 | return (T *)rxvt_temp_buf (len * sizeof (T)); |
|
|
409 | } |
|
|
410 | |
400 | #endif |
411 | #endif |
401 | |
412 | |