| Line | |
|---|
| 1 | // ============================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : arb_msg_fwd.h // |
|---|
| 4 | // Purpose : easily provide formatted versions of functions // |
|---|
| 5 | // // |
|---|
| 6 | // Coded by Ralf Westram (coder@reallysoft.de) in August 2013 // |
|---|
| 7 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 8 | // http://www.arb-home.de/ // |
|---|
| 9 | // // |
|---|
| 10 | // ============================================================== // |
|---|
| 11 | |
|---|
| 12 | #ifndef ARB_MSG_FWD_H |
|---|
| 13 | #define ARB_MSG_FWD_H |
|---|
| 14 | |
|---|
| 15 | #ifndef ARB_MSG_H |
|---|
| 16 | #include <arb_msg.h> |
|---|
| 17 | #endif |
|---|
| 18 | |
|---|
| 19 | #define FORWARD_FORMATTED(receiver,format) \ |
|---|
| 20 | do { \ |
|---|
| 21 | va_list parg; \ |
|---|
| 22 | va_start(parg, format); \ |
|---|
| 23 | char *result = GBS_vglobal_string_copy(format, parg); \ |
|---|
| 24 | va_end(parg); \ |
|---|
| 25 | receiver(result); \ |
|---|
| 26 | free(result); \ |
|---|
| 27 | } while(0) |
|---|
| 28 | |
|---|
| 29 | #define FORWARD_FORMATTED_NORETURN(receiver,format) \ |
|---|
| 30 | do { \ |
|---|
| 31 | va_list parg; \ |
|---|
| 32 | va_start(parg, format); \ |
|---|
| 33 | const char *result = GBS_vglobal_string(format, parg); \ |
|---|
| 34 | va_end(parg); \ |
|---|
| 35 | receiver(result); \ |
|---|
| 36 | } while(0) |
|---|
| 37 | |
|---|
| 38 | #else |
|---|
| 39 | #error arb_msg_fwd.h included twice |
|---|
| 40 | #endif // ARB_MSG_FWD_H |
|---|
Note: See
TracBrowser
for help on using the repository browser.